1(function($) { 2 "use strict"; 3 console.log($(window).width()); 4 $.Master = function(settings) { 5 var config = { 6 weekstart: 0, 7 ampm: 0, 8 url: '', 9 lang: { 10 monthsFull: '', 11 monthsShort: '', 12 weeksFull: '', 13 weeksShort: '', 14 weeksMed: '', 15 today: "Today", 16 now: "Now", 17 button_text: "Choose file...", 18 empty_text: "No file...", 19 sel_pic: "Choose image...", 20 } 21 }; 22 23 if (settings) { 24 $.extend(config, settings); 25 } 26 27 $('.wojo.dropdown').dropdown(); 28 $('.wojo.checkbox').checkbox(); 29 $('.wojo.progress').progress(); 30 $('.wojo.accordion').accordion(); 31 $('.rangeslider').jRange(); 32 $('.wojo.tabs li').tab(); 33 $('.spinner').wojoSpinner(); 34 35 // sticky menu desktop only 36 if (($(window).width() > 645) && $("header").length) { 37 var stickyNavTop = $('header').offset().top; 38 var stickyNav = function() { 39 var scrollTop = $(window).scrollTop(); 40 if (scrollTop > stickyNavTop) { 41 $('header').addClass('sticky'); 42 } else { 43 $('header').removeClass('sticky'); 44 } 45 }; 46 stickyNav(); 47 $(window).on('scroll', stickyNav); 48 } else if (($(window).width() < 646) && $("#bottombar").length) { 49 var stickyNavTop = $('#bottombar').offset().top; 50 var stickyNav = function() { 51 var scrollTop = $(window).scrollTop(); 52 if (scrollTop > stickyNavTop) { 53 $('#bottombar').addClass('sticky'); 54 } else { 55 $('#bottombar').removeClass('sticky'); 56 } 57 }; 58 stickyNav(); 59 $(window).on('scroll', stickyNav); 60 } 61 62 $('[data-content]').popup({ 63 variation: "mini inverted", 64 inline: true, 65 }); 66 67 /* == Fluid Grid == */ 68 $('.wojo.blocks').waitForImages(true).done(function() { 69 $('.wojo.blocks').each(function() { 70 var set = $(this).data('wblocks'); 71 $(this).pinto(set); 72 }); 73 }); 74 75 //Lightbox 76 $('.lightbox').wlightbox(); 77 78 //Poll 79 $('.poll').Poll({ 80 url: config.url + '/plugins_/poll/controller.php' 81 }); 82 83 //Comments 84 $('#comments').Comments({ 85 url: config.url + '/modules_/comments/' 86 }); 87 88 //Carousel 89 $('.wojo.carousel').each(function() { 90 var set = $(this).data('wcarousel'); 91 $(this).owlCarousel(set); 92 }); 93 94 //Dimmable 95 $('.wDimmer').dimmer({ 96 on: 'hover' 97 }); 98 99 //wojo slider 100 $('.wSlider').each(function() { 101 var set = $(this).data('wslider'); 102 $(this).wojoSlider({ 103 startWidth: set.width, 104 startHeight: set.height, 105 automaticSlide: set.automaticSlide, 106 theme: set.layout, 107 hasThumbs: set.thumbs, 108 showControls: set.arrows, 109 showNavigation: set.buttons, 110 showProgressBar: set.showProgressBar, 111 }); 112 }); 113 114 /* == Responsive Tables == */ 115 $('.wojo.table:not(.unstackable)').responsiveTable(); 116 117 /* == Vertical Menus == */ 118 $("ul.vertical-menu").find('ul.menu-submenu').parent().prepend('<i class=\"icon chevron down\"></i>'); 119 $('ul.vertical-menu .chevron.down').click(function() { 120 var icon = this; 121 var isOpen = $(this).siblings('ul.vertical-menu ul.menu-submenu').is(':visible'); 122 var slideDir = isOpen ? 'slideUp' : 'slideDown'; 123 $(this).siblings('ul.vertical-menu ul.menu-submenu').velocity(slideDir, { 124 easing: 'easeOutQuart', 125 duration: 300, 126 complete: function() { 127 $(icon).toggleClass('vertically flipped'); 128 } 129 }); 130 }); 131 132 /* == Basic color picker == */ 133 $('[data-color="true"]').spectrum({ 134 showPaletteOnly: true, 135 showPalette: true, 136 move: function(color) { 137 var newcolor = color.toHexString(); 138 $(this).children().css('background', newcolor); 139 $(this).prev('input').val(newcolor); 140 } 141 }); 142 143 /* == Advanced color picker == */
144 $('[data-adv-color="true"]').spectrum({ 145 showInput: true, 146 showAlpha: true, 147 move: function(color) { 148 var rgba = "transparent"; 149 if (color) { 150 rgba = color.toRgbString(); 151 $(this).children().css('background', rgba); 152 $(this).children('input').val(rgba); 153 } 154 }, 155 }); 156 157 /* == Datepicker == */ 158 $('[data-datepicker]').calendar({ 159 firstDayOfWeek: config.weekstart, 160 today: true, 161 type: 'date', 162 text: { 163 days: config.lang.weeksShort, 164 months: config.lang.monthsFull, 165 monthsShort: config.lang.monthsShort, 166 today: config.lang.today, 167 } 168 }); 169 170 /* == Time Picker == */ 171 $('[data-timepicker]').calendar({ 172 firstDayOfWeek: config.weekstart, 173 today: true, 174 type: 'time', 175 className: { 176 popup: 'wojo inverted popup', 177 }, 178 ampm: config.ampm, 179 text: { 180 days: config.lang.weeksShort, 181 months: config.lang.monthsFull, 182 monthsShort: config.lang.monthsShort, 183 now: config.lang.now 184 } 185 }); 186 187 //Main menu 188 $('nav.menu > ul > li:has( > ul)').addClass('menu-dropdown-icon'); 189 $('nav.menu > ul > li > ul:not(:has(ul))').addClass('normal-sub'); 190 $("nav.menu > ul").before("<a href=\"#\" class=\"menu-mobile\"></a>"); 191 $("nav.menu > ul > li").hover(function(e) { 192 if ($(window).width() > 1080) { 193 $(this).children("ul").stop(true, false).slideToggle(150); 194 e.preventDefault(); 195 } 196 }); 197 $("nav.menu > ul > li").click(function() { 198 if ($(window).width() <= 1080) { 199 $(this).children("ul").fadeToggle(150); 200 } 201 }); 202 $("nav.menu .menu-mobile").click(function(e) { 203 $("nav.menu > ul").toggleClass('show-on-mobile'); 204 e.preventDefault(); 205 }); 206 207 /* == Change User Poster == */ 208 $("#changePoster").on('click', function() { 209 if ($('#posterPopup').length === 0) { 210 var that = $(".icon", this); 211 that.attr("class", "icon circles spinner spinning"); 212 $('<div id="posterPopup" class="wojo popup" style="min-width:300px"><div class="wojo images"></div></div>').appendTo('body'); 213 $.get(config.url + '/controller.php', { 214 action: "posters" 215 }, function(data) { 216 $('#posterPopup .images').html(data); 217 that.attr("class", "icon horizontal ellipsis"); 218 }); 219 } 220 221 $(this).popup({ 222 on: 'manual', 223 popup: $("#posterPopup"), 224 lastResort: true, 225 exclusive: true, 226 hideOnScroll: false, 227 hoverable: true, 228 }).popup('show'); 229 }); 230 231 $(document).on('click', '#posterPopup img', function() { 232 var img = $(this).attr('src'); 233 var uimg = img.split(/[\\\/]/).pop(); 234 $("#userProfile").css('background-image', 'url(' + img + ')'); 235 $.cookie("CMSPRO_POSTER", uimg, { 236 expires: 120, 237 path: '/' 238 }); 239 }); 240 241 /* == Membership Select == */ 242 $(".add-membership").on("click", function() { 243 $("#membershipSelect .segment").removeClass('active'); 244 $(this).closest('.segment').addClass('active'); 245 var id = $(this).data('id'); 246 $.post(config.url + "/controller.php", { 247 action: "buyMembership", 248 id: id 249 }, function(json) { 250 $("#mResult").html(json.message); 251 $("#mResult").velocity('scroll', { 252 duration: 500, 253 offset: -40, 254 easing: 'ease-in-out' 255 }); 256 }, "json"); 257 }); 258 259 /* == Gateway Select == */ 260 $("#mResult").on("click", ".sGateway", function() { 261 var button = $(this); 262 $("#mResult .sGateway").removeClass('primary'); 263 button.addClass('primary loading'); 264 var id = $(this).data('id'); 265 $.post(config.url + "/controller.php", { 266 action: "selectGateway", 267 id: id 268 }, function(json) { 269 $("#mResult #gdata").html(json.message); 270 $("#mResult #gdata").velocity('scroll', { 271 duration: 500, 272 offset: -40, 273 easing: 'ease-in-out' 274 }); 275 button.removeClass('loading'); 276 }, "json"); 277 }); 278 279 /* == Membership Select == */ 280 $("#mResult").on("click", "#cinput", function() { 281 var id = $(this).data('id'); 282 var $this = $(this); 283 var $parent = $(this).parent(); 284 var $input = $("input[name=coupon]"); 285 if (!$input.val()) { 286 $parent.addClass('error'); 287 } else { 288 $parent.addClass('loading'); 289 $.post(config.url + "/controller.php", { 290 action: "getCoupon", 291 id: id, 292 code: $input.val() 293 }, function(json) { 294 if (json.type === "success") { 295 $parent.removeClass('error'); 296 $this.toggleClass('find check'); 297 $parent.prop('disabled', true); 298 $(".totaltax").html(json.tax); 299 $(".totalamt").html(json.gtotal); 300 $(".disc").html(json.disc); 301 $(".disc").parent().addClass('highlite'); 302 } else { 303 $parent.addClass('error'); 304 } 305 $parent.removeClass('loading'); 306 }, "json"); 307 } 308 }); 309 310 // Scroll to top 311 $(window).scroll(function() { 312 if ($(this).scrollTop() > 100) { 313 $('#back-to-top').fadeIn(500); 314 } else { 315 $('#back-to-top').fadeOut(300); 316 } 317 }); 318 319 $('#back-to-top').click(function() { 320 $('html,body').velocity('scroll', { 321 duration: 700, 322 offset: 0, 323 easing: 'ease-in-out' 324 }); 325 return false;
326 }); 327 328 /* == Clear Session Debug Queries == */ 329 $("#debug-panel").on('click', 'a.clear_session', function() { 330 $.get(config.url + '/controller.php', { 331 ClearSessionQueries: 1 332 }); 333 $(this).css('color', '#222'); 334 }); 335 336 /* == Master Form == */ 337 $(document).on('click', 'button[name=dosubmit]', function() { 338 var $button = $(this); 339 var action = $(this).data('action'); 340 var $form = $(this).closest("form"); 341 var asseturl = $(this).data('url'); 342 var hide = $(this).data('hide'); 343 344 function showResponse(json) { 345 setTimeout(function() { 346 $($button).removeClass("loading").prop("disabled", false); 347 }, 500); 348 $.notice(json.message, { 349 autoclose: 12000, 350 type: json.type, 351 title: json.title 352 }); 353 if (json.type === "success" && json.redirect) { 354 $('body') 355 .velocity('transition.swoopOut', { 356 delay: 2500, 357 duration: 800, 358 complete: function() { 359 window.location.href = json.redirect; 360 } 361 }); 362 } 363 if (json.type === "success" && hide) { 364 $form.children().velocity('transition.swoopOut', { 365 stagger: 250 366 }, 800); 367 } 368 } 369 370 function showLoader() { 371 $($button).addClass("loading").prop("disabled", true); 372 } 373 var options = { 374 target: null, 375 beforeSubmit: showLoader, 376 success: showResponse, 377 type: "post", 378 url: asseturl ? config.url + "/" + asseturl + "/controller.php" : config.url + "/controller.php", 379 data: { 380 action: action 381 }, 382 dataType: 'json' 383 }; 384
385 $($form).ajaxForm(options).submit(); 386 }); 387 388 /* == Avatar Upload == */ 389 $('[data-type="image"]').ezdz({ 390 text: config.lang.sel_pic, 391 validators: { 392 maxWidth: 1200, 393 maxHeight: 1200 394 }, 395 reject: function(file, errors) { 396 if (errors.mimeType) { 397 $.notice(decodeURIComponent(file.name + ' must be an image.'), { 398 autoclose: 4000, 399 type: "error", 400 title: 'Error' 401 }); 402 } 403 if (errors.maxWidth || errors.maxHeight) { 404 $.notice(decodeURIComponent(file.name + ' must be width:1200px, and height:1200px max.'), { 405 autoclose: 4000, 406 type: "error", 407 title: 'Error' 408 }); 409 } 410 }, 411 accept: function() { 412 if ($(this).data('process')) { 413 var action = $(this).data('action'); 414 var data = new FormData(); 415 data.append(action, $(this).prop('files')[0]); 416 data.append("action", "avatar"); 417 418 $.ajax({ 419 type: 'POST', 420 processData: false, 421 contentType: false, 422 data: data, 423 url: config.url + "/controller.php", 424 dataType: 'json', 425 }); 426 427 } 428 429 } 430 }); 431 432 /* == Password Reset == */ 433 $("#backto").on('click', function() { 434 $("#passform").velocity('transition.slideDownBigOut', { 435 duration: 500, 436 complete: function() { 437 $("#loginform").velocity("transition.slideUpBigIn", { 438 duration: 150 439 }); 440 } 441 }); 442 }); 443 $("#passreset").on('click', function() { 444 $("#loginform").velocity('transition.slideUpBigOut', { 445 duration: 500, 446 complete: function() { 447 $("#passform").velocity("transition.slideDownBigIn", { 448 duration: 150 449 }); 450 } 451 }); 452 453 }); 454 $("button[name=passreset]").on('click', function() { 455 var $btn = $(this); 456 var $cont = $("#pass_form").find('.wojo.form').parent(); 457 $btn.addClass('loading'); 458 $btn.prop('disabled', true); 459 var email = $("input[name=pemail]").val(); 460 var fname = $("input[name=fname]").val(); 461 $.ajax({ 462 type: 'post', 463 url: config.url + "/controller.php", 464 data: { 465 'action': 'uResetPass', 466 'email': email, 467 'fname': fname 468 }, 469 dataType: "json", 470 success: function(json) { 471 if (json.type === "success") { 472 $("#passform .field").removeClass('error'); 473 $("#passform .field i.icon").removeClass('asterisk'); 474 $btn.remove(); 475 $cont.closest('.wojo.segment').removeClass('top attached'); 476 $cont.replaceWith('<div class="wojo notice success"><div class="content content-center"><span>' + json.message + '</span></div></div>'); 477 } else { 478 $("#passform .field").addClass('error'); 479 $("#passform .field i.icon").addClass('asterisk'); 480 } 481 $btn.removeClass('loading'); 482 $btn.prop('disabled', false); 483 } 484 }); 485 }); 486 487 /* == Language Switcher == */ 488 $('#langChange').on('click', 'a', function() { 489 $.cookie("LANG_CMSPRO", $(this).data('value'), { 490 expires: 120, 491 path: '/' 492 }); 493 $('body') 494 .velocity('transition.swoopOut', { 495 duration: 1200, 496 complete: function() { 497 window.location.href = config.surl; 498 } 499 }); 500 return false;
501 }); 502 503 /* == Search == */ 504 $("#searchButton").on('click', function() { 505 var icon = $(this); 506 var input = $("#masterSearch").find("input"); 507 var url = $("#masterSearch").data('url'); 508 509 $("#masterSearch").animate({ 510 "width": "100%", 511 "opacity": 1 512 }, 300, function() { 513 input.focus(); 514 }); 515 icon.css('opacity', 0); 516 517 input.blur(function() { 518 if (!input.val()) { 519 $("#masterSearch").animate({ 520 "width": "0", 521 "opacity": 0 522 }, 200); 523 icon.css('opacity', 1); 524 } 525 }); 526 527 input.keypress(function(e) { 528 var key = e.which; 529 if (key === 13) { 530 var value = $.trim($(this).val()); 531 if (value.length) { 532 window.location.href = url + '?keyword=' + value; 533 } 534 } 535 }); 536 }); 537 538 // convert logo svg to editable 539 $('.logo img').each(function() { 540 var $img = $(this); 541 var imgID = $img.attr('id'); 542 var imgClass = $img.attr('class'); 543 var imgURL = $img.attr('src'); 544 545 $.get(imgURL, function(data) { 546 var $svg = $(data).find('svg'); 547 if (typeof imgID !== 'undefined') { 548 $svg = $svg.attr('id', imgID); 549 } 550 if (typeof imgClass !== 'undefined') { 551 $svg = $svg.attr('class', imgClass + ' replaced-svg'); 552 } 553 $svg = $svg.removeAttr('xmlns:a'); 554 $img.replaceWith($svg); 555 }, 'xml'); 556 557 }); 558 }; 559})(jQuery);
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.