Skip to content

Commit 5f83af2

Browse files
committed
added styles for hover on mass operation checkbox, fixed incorrect blink behavior (issue hestiacp#41)
1 parent e83f745 commit 5f83af2

File tree

7 files changed

+618
-12
lines changed

7 files changed

+618
-12
lines changed

web/css/main.css

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Title : Vesta
33
Author : Eugen Lobicov, eugen.lobicov@gmail.com
44
55
created : November 27, 2009
6-
last updated : January 26, 2012
6+
last updated : January 30, 2012
77
- - - - - - - - - - - - - - - - - - */
88

99
html{
@@ -578,33 +578,41 @@ input::-moz-focus-inner{
578578
}
579579

580580
.checkbox-selector,
581-
.context-actions{
581+
.context-actions,
582+
.checkbox-selector .ui-checkbox{
582583
display:-moz-inline-stack;
583584
display: inline-block;
584585
zoom: 1;
585586
*display: inline;
586587
vertical-align:top;
587588
}
588-
.checkbox-selector .checkbox{
589-
display:block;
590-
float:left;
589+
.ui-helper-hidden-accessible{
590+
display:none;
591+
}
592+
.checkbox-selector span.ui-checkbox{
593+
float:none;
591594
width:11px;
592595
height:11px;
593-
margin:2px 5px 0 0;
594-
background:url(../images/checkbox-selector.png) no-repeat;
596+
margin:2px 2px 0 0;
597+
background:url(../images/checkbox-selector-2012-01-29.png) no-repeat;
595598
cursor:pointer;
596599
}
597600
.checkbox-selector .selector-title{
598-
float:left;
599601
font-size:11px;
600602
line-height:15px;
601603
text-transform:uppercase;
602604
color:#5d5d5d;
603605
cursor:pointer;
604606
white-space:nowrap;
605607
}
606-
.checkbox-selector:hover .checkbox{
607-
background-position:0 -90px;
608+
.checkbox-selector span.ui-checkbox-hover{
609+
background-position:0 -20px;
610+
}
611+
.checkbox-selector span.ui-checkbox-state-checked{
612+
background-position:0 -40px;
613+
}
614+
.checkbox-selector span.ui-checkbox-state-checked-hover{
615+
background-position:0 -60px;
608616
}
609617
.checkbox-selector .selector-title:hover{
610618
color:#2ea8bd;
1.25 KB
Loading

web/index.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ <h1 class="logo"><a href="/">Vesta panel <span>&nbsp;</span></a></h1>
209209
<div class="row-filters cc">
210210
<div id="batch-processor" class="b-row-selector">
211211
<div class="checkbox-selector cc">
212-
<input class="styled do_action_toggle_batch_selector" autocomplete="off" type="checkbox" value="" />
213-
<span class="selector-title">None</span>
212+
<input id="select-rows" class="cust-checkbox do_action_toggle_batch_selector" autocomplete="off" type="checkbox" value="" />
213+
<label for="select-rows" class="selector-title">None</label>
214214
</div>
215215
<div class="context-actions c-s-box">
216216
<div class="b-cust-sel complex-select c-s-opt">
@@ -251,6 +251,14 @@ <h1 class="logo"><a href="/">Vesta panel <span>&nbsp;</span></a></h1>
251251
<script type="text/javascript" src="js/lib/cookie.js"></script>
252252
<script type="text/javascript" src="js/lib/jquery-1.6.1.js"></script>
253253
<script type="text/javascript" src="js/lib/jquery-ui-1.8.13.custom.min.js"></script>
254+
255+
<!-- Larsz's include for custom checkboxes -->
256+
<script type="text/javascript" src="js/lib/jquery.ui.widget.js"></script>
257+
<script type="text/javascript" src="js/lib/jquery.usermode.js"></script>
258+
<script type="text/javascript" src="js/lib/ui.checkbox.js"></script>
259+
<script type="text/javascript" src="js/ui.checkbox.init.js"></script>
260+
<!-- // Larsz's include for custom checkboxes -->
261+
254262
<script type="text/javascript" src="js/lib/auth.js"></script>
255263
<script type="text/javascript" src="js/date_format.js"></script>
256264
<script type="text/javascript" src="js/lib/custom-form-elements.js"></script>

web/js/lib/jquery.ui.widget.js

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
/*!
2+
* jQuery UI Widget 1.8
3+
*
4+
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
5+
* Dual licensed under the MIT (MIT-LICENSE.txt)
6+
* and GPL (GPL-LICENSE.txt) licenses.
7+
*
8+
* http://docs.jquery.com/UI/Widget
9+
*/
10+
(function( $ ) {
11+
12+
var _remove = $.fn.remove;
13+
14+
$.fn.remove = function( selector, keepData ) {
15+
return this.each(function() {
16+
if ( !keepData ) {
17+
if ( !selector || $.filter( selector, [ this ] ).length ) {
18+
$( "*", this ).add( this ).each(function() {
19+
$( this ).triggerHandler( "remove" );
20+
});
21+
}
22+
}
23+
return _remove.call( $(this), selector, keepData );
24+
});
25+
};
26+
27+
$.widget = function( name, base, prototype ) {
28+
var namespace = name.split( "." )[ 0 ],
29+
fullName;
30+
name = name.split( "." )[ 1 ];
31+
fullName = namespace + "-" + name;
32+
33+
if ( !prototype ) {
34+
prototype = base;
35+
base = $.Widget;
36+
}
37+
38+
// create selector for plugin
39+
$.expr[ ":" ][ fullName ] = function( elem ) {
40+
return !!$.data( elem, name );
41+
};
42+
43+
$[ namespace ] = $[ namespace ] || {};
44+
$[ namespace ][ name ] = function( options, element ) {
45+
// allow instantiation without initializing for simple inheritance
46+
if ( arguments.length ) {
47+
this._createWidget( options, element );
48+
}
49+
};
50+
51+
var basePrototype = new base();
52+
// we need to make the options hash a property directly on the new instance
53+
// otherwise we'll modify the options hash on the prototype that we're
54+
// inheriting from
55+
// $.each( basePrototype, function( key, val ) {
56+
// if ( $.isPlainObject(val) ) {
57+
// basePrototype[ key ] = $.extend( {}, val );
58+
// }
59+
// });
60+
basePrototype.options = $.extend( {}, basePrototype.options );
61+
$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
62+
namespace: namespace,
63+
widgetName: name,
64+
widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
65+
widgetBaseClass: fullName
66+
}, prototype );
67+
68+
$.widget.bridge( name, $[ namespace ][ name ] );
69+
};
70+
71+
$.widget.bridge = function( name, object ) {
72+
$.fn[ name ] = function( options ) {
73+
var isMethodCall = typeof options === "string",
74+
args = Array.prototype.slice.call( arguments, 1 ),
75+
returnValue = this;
76+
77+
// allow multiple hashes to be passed on init
78+
options = !isMethodCall && args.length ?
79+
$.extend.apply( null, [ true, options ].concat(args) ) :
80+
options;
81+
82+
// prevent calls to internal methods
83+
if ( isMethodCall && options.substring( 0, 1 ) === "_" ) {
84+
return returnValue;
85+
}
86+
87+
if ( isMethodCall ) {
88+
this.each(function() {
89+
var instance = $.data( this, name ),
90+
methodValue = instance && $.isFunction( instance[options] ) ?
91+
instance[ options ].apply( instance, args ) :
92+
instance;
93+
if ( methodValue !== instance && methodValue !== undefined ) {
94+
returnValue = methodValue;
95+
return false;
96+
}
97+
});
98+
} else {
99+
this.each(function() {
100+
var instance = $.data( this, name );
101+
if ( instance ) {
102+
if ( options ) {
103+
instance.option( options );
104+
}
105+
instance._init();
106+
} else {
107+
$.data( this, name, new object( options, this ) );
108+
}
109+
});
110+
}
111+
112+
return returnValue;
113+
};
114+
};
115+
116+
$.Widget = function( options, element ) {
117+
// allow instantiation without initializing for simple inheritance
118+
if ( arguments.length ) {
119+
this._createWidget( options, element );
120+
}
121+
};
122+
123+
$.Widget.prototype = {
124+
widgetName: "widget",
125+
widgetEventPrefix: "",
126+
options: {
127+
disabled: false
128+
},
129+
_createWidget: function( options, element ) {
130+
// $.widget.bridge stores the plugin instance, but we do it anyway
131+
// so that it's stored even before the _create function runs
132+
this.element = $( element ).data( this.widgetName, this );
133+
this.options = $.extend( true, {},
134+
this.options,
135+
$.metadata && $.metadata.get( element )[ this.widgetName ],
136+
options );
137+
138+
var self = this;
139+
this.element.bind( "remove." + this.widgetName, function() {
140+
self.destroy();
141+
});
142+
143+
this._create();
144+
this._init();
145+
},
146+
_create: function() {},
147+
_init: function() {},
148+
149+
destroy: function() {
150+
this.element
151+
.unbind( "." + this.widgetName )
152+
.removeData( this.widgetName );
153+
this.widget()
154+
.unbind( "." + this.widgetName )
155+
.removeAttr( "aria-disabled" )
156+
.removeClass(
157+
this.widgetBaseClass + "-disabled " +
158+
this.namespace + "-state-disabled" );
159+
},
160+
161+
widget: function() {
162+
return this.element;
163+
},
164+
165+
option: function( key, value ) {
166+
var options = key,
167+
self = this;
168+
169+
if ( arguments.length === 0 ) {
170+
// don't return a reference to the internal hash
171+
return $.extend( {}, self.options );
172+
}
173+
174+
if (typeof key === "string" ) {
175+
if ( value === undefined ) {
176+
return this.options[ key ];
177+
}
178+
options = {};
179+
options[ key ] = value;
180+
}
181+
182+
$.each( options, function( key, value ) {
183+
self._setOption( key, value );
184+
});
185+
186+
return self;
187+
},
188+
_setOption: function( key, value ) {
189+
this.options[ key ] = value;
190+
191+
if ( key === "disabled" ) {
192+
this.widget()
193+
[ value ? "addClass" : "removeClass"](
194+
this.widgetBaseClass + "-disabled" + " " +
195+
this.namespace + "-state-disabled" )
196+
.attr( "aria-disabled", value );
197+
}
198+
199+
return this;
200+
},
201+
202+
enable: function() {
203+
return this._setOption( "disabled", false );
204+
},
205+
disable: function() {
206+
return this._setOption( "disabled", true );
207+
},
208+
209+
_trigger: function( type, event, data ) {
210+
var callback = this.options[ type ];
211+
212+
event = $.Event( event );
213+
event.type = ( type === this.widgetEventPrefix ?
214+
type :
215+
this.widgetEventPrefix + type ).toLowerCase();
216+
data = data || {};
217+
218+
// copy original event properties over to the new event
219+
// this would happen if we could call $.event.fix instead of $.Event
220+
// but we don't have a way to force an event to be fixed multiple times
221+
if ( event.originalEvent ) {
222+
for ( var i = $.event.props.length, prop; i; ) {
223+
prop = $.event.props[ --i ];
224+
event[ prop ] = event.originalEvent[ prop ];
225+
}
226+
}
227+
228+
this.element.trigger( event, data );
229+
230+
return !( $.isFunction(callback) &&
231+
callback.call( this.element[0], event, data ) === false ||
232+
event.isDefaultPrevented() );
233+
}
234+
};
235+
236+
})( jQuery );

web/js/lib/jquery.usermode.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/**
2+
* @author trixta
3+
*/
4+
(function($){
5+
$.userMode = (function(){
6+
var userBg,
7+
timer,
8+
testDiv,
9+
boundEvents = 0;
10+
11+
function testBg(){
12+
testDiv = testDiv || $('<div></div>').css({position: 'absolute', left: '-999em', top: '-999px', width: '0px', height: '0px'}).appendTo('body');
13+
var black = $.curCSS( testDiv.css({backgroundColor: '#000000'})[0], 'backgroundColor', true),
14+
white = $.curCSS( testDiv.css({backgroundColor: '#ffffff'})[0], 'backgroundColor', true),
15+
newBgStatus = (black === white || white === 'transparent');
16+
if(newBgStatus != userBg){
17+
userBg = newBgStatus;
18+
$.event.trigger('_internalusermode');
19+
}
20+
return userBg;
21+
}
22+
23+
function init(){
24+
testBg();
25+
timer = setInterval(testBg, 3000);
26+
}
27+
28+
function stop(){
29+
clearInterval(timer);
30+
testDiv.remove();
31+
testDiv = null;
32+
}
33+
34+
$.event.special.usermode = {
35+
setup: function(){
36+
(!boundEvents && init());
37+
boundEvents++;
38+
var jElem = $(this)
39+
.bind('_internalusermode', $.event.special.usermode.handler);
40+
//always trigger
41+
setTimeout(function(){
42+
jElem.triggerHandler('_internalusermode');
43+
}, 1);
44+
return true;
45+
},
46+
teardown: function(){
47+
boundEvents--;
48+
(!boundEvents && stop());
49+
$(this).unbind('_internalusermode', $.event.special.usermode.handler);
50+
return true;
51+
},
52+
handler: function(e){
53+
e.type = 'usermode';
54+
e.disabled = !userBg;
55+
e.enabled = userBg;
56+
return jQuery.event.handle.apply(this, arguments);
57+
}
58+
};
59+
60+
return {
61+
get: testBg
62+
};
63+
64+
})();
65+
66+
$.fn.userMode = function(fn){
67+
return this[(fn) ? 'bind' : 'trigger']('usermode', fn);
68+
};
69+
70+
$(function(){
71+
$('html').userMode(function(e){
72+
$('html')[e.enabled ? 'addClass' : 'removeClass']('hcm');
73+
});
74+
});
75+
})(jQuery);

0 commit comments

Comments
 (0)