1/* Author: Boyan Kostov, http://wh1sp.com/ 2 3*/ 4 5 6jQuery(document).ready(function(){ 7 8 // Run Matt Kersley's jQuery Responsive menu plugin (see plugins.js) 9 if ($.fn.mobileMenu) { 10 $('ol#id').mobileMenu({ 11 switchWidth: 768, // width (in px to switch at) 12 topOptionText: 'Choose a page', // first option text 13 indentString: ' ' // string for indenting nested items 14 }); 15 } 16 17 // Run Mathias Bynens jQuery placeholder plugin (see plugins.js) 18 if ($.fn.placeholder) { 19 $('input, textarea').placeholder(); 20 } 21 22 if ($.fn.superfish) { 23 $('ul.sf_menu').superfish(); 24 } 25 26 $("#main").sortable({ 27 placeholder: "box box-placeholder", forcePlaceholderSize: "true",handle: "a.move" 28 }); 29 30 // Tabs 31 $('.tabs div.tab').hide(); 32 $('.tabs').each(function() {$(this).find('div.tab:eq(0)').show();}); 33 $('.tabs ul').each(function() {$(this).find('li:eq(0)').addClass('active');}); 34 35 $('.tabs ul li').click(function(){ 36 $(this).siblings().removeClass('active'); 37 $(this).addClass('active'); 38 var currentTab = $('a', this).attr('href'); 39 $(this).parent().parent().find('.tab').hide(); 40 $(currentTab).show(); 41 return false; 42 }); 43 44 $(".tabsjqui").tabs(); 45 $('.tabsjquistep').tabs(); 46 47 var $tabs = $('.tabsjquistep').tabs(); 48 49 $(".tabsjquistep .ui-tabs-panel").each(function(i){ 50 51 var totalSize = $(".tabsjquistep .ui-tabs-panel").size() - 1; 52 53 $(this).append('<div class="clear"> </div>'); 54 55 if (i != 0) { 56 prev = i; 57 $(this).append("<a href='#' class='btn stepprev red mt15' rel='" + prev + "'>« Prev Page</a>"); 58 } 59 if (i != totalSize) { 60 next = i + 2; 61 $(this).append("<a href='#' class='btn stepnext green mt15' rel='" + next + "'>Next Page »</a>"); 62 } 63 $(this).append('<div class="clear"> </div>'); 64 65 66 }); 67 68 $('.btn.stepprev, .btn.stepnext').click(function() { 69 $tabs.tabs('select', $(this).attr("rel")); 70 return false; 71 }); 72 73 // Accordions and collapsible 74 75 $('.acc_content:eq(0)').show(); 76 $('.acc_heading').click(function() { 77 $(this).next('.acc_content').slideToggle(500).siblings('.acc_content').slideUp('normal'); 78 $(this).siblings('.acc_heading').removeClass('active'); 79 }); 80 if($.fn.collapsible) { 81 $(".coll_heading").collapsible({ 82 defaultOpen: 'opened', 83 cookieName: 'collapsible', 84 cssOpen: 'open', 85 cssClose: 'close', 86 speed: 300 87 }); 88 } 89 90 function ha_openMenus(ha_open) { 91 $(ha_open).children("ul").show(); 92 $(ha_open).children("span").addClass("opened"); 93 } 94 ha_openMenus('.box.menu ul li.hasul.opened'); 95 96 $(".box.menu ul li.hasul span").click(function() { 97 $(this).parent().children("ul").slideToggle(); 98 $(this).toggleClass('opened'); 99 $(this).parent().toggleClass("opened"); 100 }); 101 102 103 $(".accjqui").accordion(); 104 105 // Progress bar 106 $(".progressbar").progressbar(); 107 $(".progressbarwithvalue").progressbar({value: 55}); 108 var pGress = setInterval(function() { 109 var pVal = $('#progressbarmoving').progressbar('option', 'value'); 110 var pCnt = !isNaN(pVal) ? (pVal + 1) : 1; 111 if (pCnt > 100) { 112 clearInterval(pGress); 113 } else { 114 $('#progressbarmoving').progressbar({value: pCnt}); 115 } 116 },10); 117 118 // Datepicker 119 $( ".datepicker" ).datepicker(); 120 121 // Dialog 122 $( "#dialog" ).dialog({ 123 autoOpen: false, 124 show: "fade", 125 hide: "fade" 126 }); 127 128 $( "#opener" ).click(function() { 129 $( "#dialog" ).dialog( "open" ); 130 return false; 131 }); 132 133 $( "#dialog_overlay" ).dialog({ 134 autoOpen: false, 135 modal: true, 136 show: "fade", 137 hide: "fade" 138 }); 139 140 $( "#opener_overlay" ).click(function() { 141 $( "#dialog_overlay" ).dialog( "open" ); 142 return false; 143 }); 144 145 // Slider 146 $( ".slider" ).slider(); 147 $( ".slider_increments" ).slider({ 148 value:100, 149 min: 0, 150 max: 500, 151 step: 50, 152 slide: function( event, ui ) { 153 $( "#amount_increments" ).val( "$" + ui.value ); 154 } 155 }); 156 $( "#amount_increments" ).val( "$" + $( ".slider_increments" ).slider( "value" ) ); 157 $( ".slider_range" ).slider({ 158 range: true, 159 min: 0, 160 max: 500, 161 values: [ 75, 300 ], 162 slide: function( event, ui ) { 163 $( "#amount_range" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] ); 164 } 165 }); 166 $( "#amount_range" ).val( "$" + $( ".slider_range" ).slider( "values", 0 ) + 167 " - $" + $( ".slider_range" ).slider( "values", 1 ) ); 168 $( ".slider_range_min" ).slider({ 169 range: "min", 170 value: 37, 171 min: 1, 172 max: 700, 173 slide: function( event, ui ) { 174 $( "#amount_range_min" ).val( "$" + ui.value ); 175 } 176 }); 177 $( "#amount_range_min" ).val( "$" + $( ".slider_range_min" ).slider( "value" ) ); 178 $( ".slider_range_max" ).slider({ 179 range: "max", 180 min: 1, 181 max: 10, 182 value: 2, 183 slide: function( event, ui ) { 184 $( "#amount_range_max" ).val( ui.value ); 185 } 186 }); 187 $( "#amount_range_max" ).val( $( ".slider_range_max" ).slider( "value" ) ); 188 $( "#eq > span" ).each(function() { 189 // read initial values from markup and remove that 190 var value = parseInt( $( this ).text(), 10 ); 191 $( this ).empty().slider({ 192 value: value, 193 range: "min", 194 animate: true, 195 orientation: "vertical" 196 }); 197 }); 198 199 // Autocomplete 200 var availableTags = [ 201 "ActionScript", 202 "AppleScript", 203 "Asp", 204 "BASIC", 205 "C", 206 "C++", 207 "Clojure", 208 "COBOL", 209 "ColdFusion", 210 "Erlang", 211 "Fortran", 212 "Groovy", 213 "Haskell", 214 "Java", 215 "JavaScript", 216 "Lisp", 217 "Perl", 218 "PHP", 219 "Python", 220 "Ruby", 221 "Scala", 222 "Scheme" 223 ]; 224 $( "#tags" ).autocomplete({ 225 source: availableTags 226 }); 227 228 // Go to top link 229 $('#top').click(function() { 230 $('body,html').animate({scrollTop:0},800); 231 }); 232 // Go to footer link 233 $('#contato').click(function() { 234 $('body,html').animate({scrollTop:0},800); 235 }); 236 237 // Autofocus 238 $('.formfocus:first').focus(); 239 240 // Tipsy configuration 241 if ($.fn.tipsy) { 242 $('.tip').tipsy({gravity: $.fn.tipsy.autoNS}); 243 $('.tipRight').tipsy({gravity: 'w'}); 244 $('.tipLeft').tipsy({gravity: 'e'}); 245 $('.tipTop').tipsy({gravity: 's'}); 246 $('.tipBottom').tipsy({gravity: 'n'}); 247 $('#tipRight').tipsy({gravity: 'w'}); 248 $('#tipLeft').tipsy({gravity: 'e'}); 249 $('#tipTop').tipsy({gravity: 's'}); 250 $('#tipBottom').tipsy({gravity: 'n'}); 251 } 252 253 // Autoresize 254 if ($.fn.autoResize) { 255 $('textarea.resize').autoResize({extraSpace: 10}); 256 } 257 258 // Autotab config 259 if ($.fn.autotab_filter) { 260 $('.atab_numbers li input').autotab_magic().autotab_filter('numeric'); 261 $('.atab_letters li input').autotab_magic().autotab_filter('text');
262 $('.atab_alpha li input').autotab_magic().autotab_filter('alpha'); 263 $('.atab_customOne li input').autotab_magic().autotab_filter({format: 'custom', pattern: '[^a]'}); 264 $('.atab_uppercase li input').autotab_magic().autotab_filter({uppercase: 'true'}); 265 $('.atab_lowercase li input').autotab_magic().autotab_filter({lowercase: 'true'}); 266 $('.atab_nospace li input').autotab_magic().autotab_filter({nospace: 'true'}); 267 } 268 269 // Uniform.js 270 if ($.fn.uniform) { 271 $("select.regular, input:checkbox, input:radio, input.regularfile").uniform(); 272 } 273 274 // UI Multiselect 275 if ($.fn.multiselect) { 276 $("select.multiple").multiselect(); 277 } 278 // UI Spinner 279 if ($.fn.spinner) { 280 var itemList = [ 281 {url: "#", title: "Sample One"}, 282 {url: "#", title: "Sample Two"}, 283 {url: "#", title: "Sample Three"}, 284 {url: "#", title: "Sample Four"}, 285 {url: "#", title: "Sample Five"} 286 ]; 287 288 var opts = { 289 's1': {decimals:2}, 290 's2': {stepping: 0.25}, 291 's3': {currency: '$'}, 292 's4': {}, 293 's5': { 294 // 295 // Two methods of adding external items to the spinner 296 // 297 // method 1: on initalisation call the add method directly and format html manually 298 init: function(e, ui) { 299 for (var i=0; i<itemList.length; i++) { 300 ui.add('<a href="'+ itemList[i].url +'" target="_blank">'+ itemList[i].title +'</a>'); 301 } 302 }, 303 304 // method 2: use the format and items options in combination 305 format: '<a href="%(url)" target="_blank">%(title)</a>', 306 items: itemList 307 } 308 }; 309 310 for (var n in opts) 311 $("#"+n).spinner(opts[n]); 312 313 $("button").click(function(e){ 314 var ns = $(this).attr('id').match(/(s\d)\-(\w+)$/); 315 if (ns != null) 316 $('#'+ns[1]).spinner( (ns[2] == 'create') ? opts[ns[1]] : ns[2]); 317 }); 318 319 } 320 321 // Hider 322 323 $(".hider").click(function() { 324 $(this).fadeOut(500); 325 $(this).closest(".notification").fadeOut(500); 326 }) 327 328 // FullCalendar setup 329 if ($.fn.fullCalendar) { 330 331 var date = new Date(); 332 var d = date.getDate(); 333 var m = date.getMonth(); 334 var y = date.getFullYear(); 335 336 /* initialize the external events 337 -----------------------------------------------------------------*/ 338 339 $('#external-events div.external-event').each(function() { 340 341 // create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/) 342 // it doesn't need to have a start or end 343 var eventObject = { 344 title: $.trim($(this).text()) // use the element's text as the event title 345 }; 346 347 // store the Event Object in the DOM element so we can get to it later 348 $(this).data('eventObject', eventObject); 349 350 // make the event draggable using jQuery UI 351 $(this).draggable({ 352 zIndex: 999, 353 revert: true, // will cause the event to go back to its 354 revertDuration: 0 // original position after the drag 355 }); 356 357 }); 358 359 360 /* initialize the calendar 361 -----------------------------------------------------------------*/ 362 363 $('#calendar').fullCalendar({ 364 header: { 365 left: 'prev,next', 366 center: 'title', 367 right: 'month,basicWeek,basicDay' 368 }, 369 editable: true, 370 droppable: true, // this allows things to be dropped onto the calendar !!! 371 drop: function(date, allDay) { // this function is called when something is dropped 372 373 // retrieve the dropped element's stored Event Object 374 var originalEventObject = $(this).data('eventObject'); 375 376 // we need to copy it, so that multiple events don't have a reference to the same object 377 var copiedEventObject = $.extend({}, originalEventObject); 378 379 // assign it the date that was reported 380 copiedEventObject.start = date; 381 copiedEventObject.allDay = allDay; 382 383 // render the event on the calendar 384 // the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/) 385 $('#calendar').fullCalendar('renderEvent', copiedEventObject, true); 386 387 // is the "remove after drop" checkbox checked? 388 if ($('#drop-remove').is(':checked')) { 389 // if so, remove the element from the "Draggable Events" list 390 $(this).remove(); 391 } 392 393 } 394 }); 395 } 396 397 // Fancybox 398 if ($.fn.fancybox) { 399 $("a.fancybox").fancybox(); 400 } 401 402 // Breadcrumbs 403 if ($.fn.jBreadCrumb) { 404 $(".jBreadcrumb").jBreadCrumb(); 405 } 406 407 // jGrowl 408 if ($.fn.jGrowl) { 409 // This value can be true, false or a function to be used as a callback when the closer is clciked 410 $.jGrowl.defaults.closer = function() { 411 console.log("Closing everything!", this); 412 }; 413 414 // A callback for logging notifications. 415 $.jGrowl.defaults.log = function(e,m,o) { 416 $('#logs').append("<div><strong>#" + $(e).attr('id') + "</strong> <em>" + (new Date()).getTime() + "</em>: " + m + " (" + o.theme + ")</div>") 417 } 418 419 $.jGrowl("Testing jGrowl. Hello world!", {position: 'bottom-right'});
420 $.jGrowl("This notification will live a little longer.", { life: 2000 }); 421 $.jGrowl("Sticky notification with a header", { header: 'A Header', sticky: true }); 422 423 424 $.jGrowl("This message will not open because we have a callback that returns false.", { 425 beforeOpen: function() { 426 console.log("Going to open a notification, but not really..."); 427 }, 428 open: function() { 429 return false; 430 } 431 }); 432 433 $.jGrowl.defaults.closerTemplate = '<div>hide everything</div>'; 434 435 } 436 437 // WYSIWYG 438 if($.fn.wysiwyg) { 439 $('.editor').wysiwyg(); 440 } 441 442 // This is DataTables initialization 443 if ($.fn.dataTable) { 444 445 $('#tabled a.delete').click(function() { 446 $(this).parents('tr').remove(); 447 }); 448 449 // Selecting a row highlights it 450 $('#tabled tr td input:checkbox').click(function(event) { 451 $(this).parents('tr').toggleClass('row_selected'); 452 }); 453 454 // Select all checkboxes, thanks to Bill Beckelman 455 $("#tabled thead tr th:first input:checkbox").click(function() { 456 var checkedStatus = this.checked; 457 $("#tabled tbody tr td:first-child input:checkbox").each(function() { 458 this.checked = checkedStatus; 459 if (checkedStatus == this.checked) { 460 $(this).parents('tr').removeClass('row_selected'); 461 $(this).closest('.checker span').removeClass('checked'); 462 } 463 if (this.checked) { 464 $(this).parents('tr').addClass('row_selected'); 465 $(this).closest('.checker span').addClass('checked'); 466 } 467 }); 468 }); 469 470 $("#tabled tr td:odd").addClass("odd"); 471 $("#tabled tr td:even").addClass("even"); 472 473 /* Init DataTables, thanks to Datatable forums */ 474 var oTable = $('#tabled').dataTable({ 475 "sPaginationType": "full_numbers", 476 "iDisplayLength": 25, 477 "bFilter": true, 478 "bLengthChange": true, 479 "bSort": true, 480 "sDom": 'rtiplf', 481 "aoColumnDefs": [ { "bSortable": false, "sClass": "readonly", "aTargets": [ 'tview', 'tedit', 'tdelete', 'check' ] }] 482 483 }); 484 485 /* Ajax connector */ 486 /*$('td:not(.readonly)', oTable.fnGetNodes()).editable( '../examples_support/editable_ajax.php', { 487 "callback": function( sValue, y ) { 488 var aPos = oTable.fnGetPosition( this ); 489 oTable.fnUpdate( sValue, aPos[0], aPos[1] ); 490 }, 491 "submitdata": function ( value, settings ) { 492 return { 493 "row_id": this.parentNode.getAttribute('id'), 494 "column": oTable.fnGetPosition( this )[2] 495 }; 496 }, 497 "height": "14px" 498 });*/ 499 500 } 501 502 // Elfinder 503 if($.fn.elfinder) { 504 var f = $('#finder').elfinder({ 505 url : 'filemanager/connectors/php/connector.php', 506 lang : 'en', 507 docked : true 508 }) 509 // window.console.log(f) 510 $('#close,#open,#dock,#undock').click(function() { 511 $('#finder').elfinder($(this).attr('id')); 512 }) 513 } 514 515 // jAlert 516 if($.alerts) { 517 $(".alert_button").click( function() { 518 jAlert('This is a custom alert box', 'Alert Dialog'); 519 }); 520 $(".alert_button_confirm").click( function() { 521 jConfirm('Can you confirm this?', 'Confirmation Dialog', function(r) { 522 jAlert('Confirmed: ' + r, 'Confirmation Results'); 523 }); 524 }); 525 $(".alert_button_prompt").click( function() { 526 jPrompt('Type something:', 'Prefilled value', 'Prompt Dialog', function(r) { 527 if( r ) alert('You entered ' + r); 528 }); 529 }); 530 } 531 532 // Color picker 533 if($.fn.miniColors) { 534 $(".colors").miniColors({ 535 536 change: function(hex, rgb) { 537 $("#console").prepend('HEX: ' + hex + ' (RGB: ' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ')<br />'); 538 } 539 540 }); 541 } 542 543 // Validation engine 544 if($.fn.validationEngine) { 545 $("#validation").validationEngine(); 546 } 547 548 // Slidernav 549 if($.fn.sliderNav) { 550 $('.slidernav').sliderNav(); 551 } 552 553 // Fixing padding in inputs and textareas 554 $('textarea').css("width","100%").css("width","-=22"); 555 $('input.text').css("width","100%").css("width","-=22"); 556 557 var ha_window = $(window).width(); 558 if(ha_window < 800) { 559 $('header').addClass('mobile'); 560 } 561 else { 562 $('header').removeClass('mobile'); 563 } 564 565 $(window).resize(function(){ 566 if(ha_window < 800) { 567 $('header').addClass('mobile'); 568 } 569 else { 570 $('header').removeClass('mobile'); 571 } 572 }); 573 // Something else? :) 574}); 575 576 577 578 579
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.