- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/common.js
r3 r131 6 6 handler.apply(this, arguments); 7 7 if (existingFunction) 8 existingFunction.apply(this, arguments); 8 existingFunction.apply(this, arguments); 9 9 }; 10 10 })(handlerName in obj ? obj[handlerName] : null); … … 45 45 else 46 46 range = trparent.prevUntil('#'+dotclear.lastclicked); 47 47 48 48 range.find('input[type=checkbox]').setChecked(dotclear.lastclickedstatus); 49 49 this.checked = dotclear.lastclickedstatus; … … 57 57 } 58 58 59 jQuery.fn.toggleWithLegend = function(target,s ) {59 jQuery.fn.toggleWithLegend = function(target,s, callback) { 60 60 var defaults = { 61 61 img_on_src: dotclear.img_plus_src, … … 71 71 }; 72 72 var p = jQuery.extend(defaults,s); 73 73 74 74 if (!target) { return this; } 75 75 76 76 var set_cookie = p.hide ^ p.reverse_cookie; 77 77 if (p.cookie && jQuery.cookie(p.cookie)) { 78 78 p.hide = p.reverse_cookie; 79 79 } 80 81 var toggle = function(i,speed ) {80 81 var toggle = function(i,speed, callback) { 82 82 speed = speed || 0; 83 83 if (p.hide) { 84 84 $(i).get(0).src = p.img_on_src; 85 85 $(i).get(0).alt = p.img_on_alt; 86 target.hide(speed );86 target.hide(speed, callback); 87 87 } else { 88 88 $(i).get(0).src = p.img_off_src; 89 89 $(i).get(0).alt = p.img_off_alt; 90 target.show(speed );90 target.show(speed, callback); 91 91 if (p.fn) { 92 92 p.fn.apply(target); … … 94 94 } 95 95 } 96 96 97 97 if (p.cookie && set_cookie) { 98 98 if (p.hide ^ p.reverse_cookie) { … … 102 102 } 103 103 } 104 104 105 105 p.hide = !p.hide; 106 106 }; 107 107 108 108 return this.each(function() { 109 109 var i = document.createElement('img'); … … 117 117 outline: 'none' 118 118 }); 119 119 120 120 var ctarget = p.legend_click ? this : a; 121 121 122 122 $(ctarget).css('cursor','pointer'); 123 123 $(ctarget).click(function() { 124 toggle(i,p.speed );125 return false; 126 }); 127 128 124 toggle(i,p.speed, callback); 125 return false; 126 }); 127 128 129 129 toggle($(i).get(0)); 130 130 $(this).prepend(' ').prepend(a); … … 136 136 return this; 137 137 } 138 138 139 139 var p = { 140 140 img_on_src: dotclear.img_plus_src, … … 156 156 return false; 157 157 }; 158 158 159 159 var sizeBox = function() { 160 160 This.css('height','auto'); … … 163 163 } 164 164 }; 165 165 166 166 var textToggler = function(o) { 167 167 var i = $('<img src="'+p.img_on_src+'" alt="'+p.img_on_alt+'" />'); 168 168 o.css('cursor','pointer'); 169 169 var hide = true; 170 170 171 171 o.prepend(' ').prepend(i); 172 172 o.click(function() { … … 188 188 }); 189 189 }; 190 190 191 191 this.addClass('help-box'); 192 192 this.find('>hr').remove(); 193 193 194 194 this.find('h3').each(function() { textToggler($(this)); }); 195 195 this.find('h3:first').nextAll('*:not(h3)').hide(); 196 196 sizeBox(); 197 197 198 198 var img = $('<span id="help-button">'+dotclear.msg.help+'</span>'); 199 199 var select = $(); 200 200 img.click(function() { return toggle(); }); 201 201 202 202 $('#content').append(img); 203 203 204 204 return this; 205 205 }; … … 209 209 var dotclear = { 210 210 msg: {}, 211 211 212 212 hideLockable: function() { 213 213 $('div.lockable').each(function() { … … 217 217 this.disabled = true; 218 218 $(this).width(($(this).width()-14) + 'px'); 219 219 220 220 var imgE = document.createElement('img'); 221 221 imgE.src = 'images/locker.png'; … … 224 224 imgE.style.left = ($(this).width()+4)+'px'; 225 225 $(imgE).css('cursor','pointer'); 226 226 227 227 $(imgE).click(function() { 228 228 $(this).hide(); … … 233 233 $(current_lockable_div).find('p.form-note').show(); 234 234 }); 235 235 236 236 $(this).parent().css('position','relative'); 237 237 $(this).after(imgE); … … 239 239 }); 240 240 }, 241 241 242 242 checkboxesHelpers: function(e) { 243 243 var a = document.createElement('a'); … … 249 249 }; 250 250 $(e).append(a); 251 251 252 252 $(e).append(document.createTextNode(' - ')); 253 253 254 254 a = document.createElement('a'); 255 255 a.href='#'; … … 260 260 }; 261 261 $(e).append(a); 262 262 263 263 $(e).append(document.createTextNode(' - ')); 264 264 265 265 a = document.createElement('a'); 266 266 a.href='#'; … … 272 272 $(e).append(a); 273 273 }, 274 274 275 275 postsActionsHelper: function() { 276 276 $('#form-entries').submit(function() { 277 277 var action = $(this).find('select[name="action"]').val(); 278 278 var checked = false; 279 279 280 280 $(this).find('input[name="entries[]"]').each(function() { 281 281 if (this.checked) { … … 283 283 } 284 284 }); 285 285 286 286 if (!checked) { return false; } 287 287 288 288 if (action == 'delete') { 289 289 return window.confirm(dotclear.msg.confirm_delete_posts.replace('%s',$('input[name="entries[]"]:checked').size())); 290 290 } 291 291 292 292 return true; 293 293 }); 294 294 }, 295 295 296 296 commentsActionsHelper: function() { 297 297 $('#form-comments').submit(function() { 298 298 var action = $(this).find('select[name="action"]').val(); 299 299 var checked = false; 300 300 301 301 $(this).find('input[name="comments[]"]').each(function() { 302 302 if (this.checked) { … … 304 304 } 305 305 }); 306 306 307 307 if (!checked) { return false; } 308 308 309 309 if (action == 'delete') { 310 310 return window.confirm(dotclear.msg.confirm_delete_comments.replace('%s',$('input[name="comments[]"]:checked').size())); 311 311 } 312 312 313 313 return true; 314 314 }); … … 323 323 this.form.submit(); 324 324 }); 325 325 326 326 var menu_settings = { 327 327 img_on_src: dotclear.img_menu_off, … … 331 331 } 332 332 $('#blog-menu h3:first').toggleWithLegend($('#blog-menu ul:first'), 333 $.extend({cookie:'dc_blog_menu',hide:false,reverse_cookie:true},menu_settings) 333 $.extend({cookie:'dc_blog_menu',hide:false,reverse_cookie:true},menu_settings), 334 positionFooter 334 335 ); 335 336 $('#system-menu h3:first').toggleWithLegend($('#system-menu ul:first'), 336 $.extend({cookie:'dc_system_menu'},menu_settings) 337 $.extend({cookie:'dc_system_menu'},menu_settings), 338 positionFooter 337 339 ); 338 340 $('#plugins-menu h3:first').toggleWithLegend($('#plugins-menu ul:first'), 339 $.extend({cookie:'dc_plugins_menu'},menu_settings) 341 $.extend({cookie:'dc_plugins_menu'},menu_settings), 342 positionFooter 340 343 ); 341 344 $('#favorites-menu h3:first').toggleWithLegend($('#favorites-menu ul:first'), 342 $.extend({cookie:'dc_favorites_menu'},menu_settings) 345 $.extend({cookie:'dc_favorites_menu'},menu_settings), 346 positionFooter 343 347 ); 344 348 345 349 $('#help').helpViewer(); 346 350 347 351 $('.message').backgroundFade({sColor:'#cccccc',eColor:'#666666',steps:20}); 348 352 $('.error').backgroundFade({sColor:'#f5e5e5',eColor:'#e5bfbf',steps:20}); 349 353 350 354 $('form:has(input[type=password][name=your_pwd])').submit(function() { 351 355 var e = this.elements['your_pwd']; … … 359 363 return true; 360 364 }); 365 366 367 // Sticky footer 368 positionFooter(); 369 function positionFooter() { 370 $("#wrapper").css({ overflow: "auto" }); 371 var page_height = $("#top").height() + $("#wrapper").height() - $("#footer").height(); 372 if( page_height < $(window).height() ){ 373 // calcul de la largeur 374 var page_width = $(document).width() - 30; 375 $("#footer").css({ 376 position: "absolute", 377 bottom: "10px", 378 width: page_width+"px", 379 padding: ".75em 0", 380 marginbottom: "0" 381 }); 382 } else { 383 $("#footer").css({ 384 position: "static", 385 padding: ".75em 0", 386 width: "auto", 387 }); 388 } 389 390 } 391 $(window).resize(positionFooter); 392 361 393 }); 362 394
Note: See TracChangeset
for help on using the changeset viewer.