1 2(function($) { 3 "use strict"; 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.progress').wProgress(); 28 $('.wojo.accordion').wAccordion(); 29 $('.wojo.input.number').wNumber(); 30 31 /* == Tabs == */ 32 $(".wojo.tabs").wTabs(); 33 34 if ($.browser.desktop) { 35 $('[data-wanimate]').Aos(); 36 } 37 38 // sticky menu desktop only 39 if (false && $.browser.desktop && $("#header").length) { 40 var stickyNavTop = $('#header').offset().top + 320; 41 var stickyNav = function() { 42 var scrollTop = $(window).scrollTop(); 43 if (scrollTop > stickyNavTop ) { 44 $('#header').addClass('sticky'); 45 $('#header .top-bar').hide(); 46 } 47 else { 48 49 $('#header').removeClass('sticky'); 50 $('#header .top-bar').fadeIn(); 51 52 } 53 }; 54 stickyNav(); 55 $(window).on('scroll', stickyNav); 56 } 57 58 //Lightbox 59 $('.lightbox').wlightbox(); 60 61 62 $(".wojo.tab.item").hide(); 63 $(".wojo.tab.item:first").show(); 64 $(".wojo.tabs:not(.responsive) a").on('click', function(e) { 65 $(".wojo.tabs:not(.responsive) li").removeClass("active"); 66 $(this).parent().addClass("active"); 67 $(".wojo.tab.item").hide(); 68 var activeTab = $(this).data("tab"); 69 if ($(activeTab).is(':first-child')) { 70 $(activeTab).parent().addClass('tabbed'); 71 } else { 72 $(activeTab).parent().removeClass('tabbed'); 73 } 74 $(activeTab).show(); 75 e.preventDefault(); 76 }); 77 78 //Paralax 79 $('.paralax').paralax({ 80 speed: 0.6, 81 mode: 'background', 82 xpos: '50%', 83 outer: true, 84 offset: 0, 85 }); 86 87 //Carousel 88 $('.wojo.carousel').each(function() { 89 var set = $(this).data('wcarousel'); 90 $(this).owlCarousel(set); 91 }); 92 93 //Poll 94 $('.poll').Poll({ 95 url: config.url + '/plugins_/poll/controller.php' 96 }); 97 98 //Comments 99 $('#comments').Comments({ 100 url: config.url + '/modules_/comments/' 101 }); 102 103 //wojo slider 104 $(".wSlider").on("initialized.owl.carousel", function() { 105 //setTimeout(function() { 106 $(".owl-item.active .ws-layer").each(function() { 107 var animation = $(this).data('animation'); 108 $(this).addClass("animate " + animation); 109 }); 110 //}, 1500); 111 }); 112 $('.wSlider').each(function() { 113 var set = $(this).data('wslider'); 114 $(this).owlCarousel({ 115 dots: set.buttons, 116 nav: set.arrows, 117 autoplay: set.autoplay, 118 autoplaySpeed: set.autoplaySpeed, 119 autoplayHoverPause: set.autoplayHoverPause, 120 margin: 0, 121 loop: set.autoloop, 122 rtl: set.rtl, 123 "responsive": { 124 "0": { 125 "items": 1 126 }, 127 "769": { 128 "items": 1 129 }, 130 "1024": { 131 "items": 1 132 } 133 } 134 }); 135 136 $(this).on("translate.owl.carousel", function() { 137 $(".ws-layer", this).each(function() { 138 var animation = $(this).data("animation"); 139 $(this).removeClass("animate " + animation).css("opacity", 0); 140 }); 141 }); 142 143 $(this).on("translated.owl.carousel", function(event) { 144 var $active = $(".owl-item", this).eq(event.item.index); 145 $active.find(".ws-layer").each(function() { 146 var animation = $(this).data("animation"); 147 $(this).addClass("animate " + animation).css("opacity", 1); 148 }); 149 }); 150 }); 151 152 /* == Vertical Menus == */ 153 $("ul.vertical-menu").find('ul.menu-submenu').parent().prepend('<i class=\"icon chevron down\"></i>'); 154 $('ul.vertical-menu .chevron.down').click(function() { 155 var icon = this; 156 $(this).siblings('ul.vertical-menu ul.menu-submenu').slideToggle(200); 157 $(icon).toggleClass('vertically flipped'); 158 }); 159 160 /* == Basic color picker == */ 161 $('[data-color="true"]').spectrum({ 162 showPaletteOnly: true, 163 showPalette: true, 164 move: function(color) { 165 var newcolor = color.toHexString(); 166 $(this).children().css('background', newcolor); 167 $(this).prev('input').val(newcolor); 168 } 169 }); 170 171 /* == Advanced color picker == */
172 $('[data-adv-color="true"]').spectrum({ 173 showInput: true, 174 showAlpha: true, 175 move: function(color) { 176 var rgba = "transparent"; 177 if (color) { 178 rgba = color.toRgbString(); 179 $(this).children().css('background', rgba); 180 $(this).children('input').val(rgba); 181 } 182 }, 183 }); 184 185 /* == Datepicker == */ 186 $('[data-datepicker]').wDate({ 187 months: config.lang.monthsFull, 188 short_months: config.lang.monthsShort, 189 days_of_week: config.lang.weeksFull, 190 short_days: config.lang.weeksShort, 191 days_min: config.lang.weeksSmall, 192 selected_format: 'DD, mmmm d', 193 month_head_format: 'mmmm yyyy', 194 format: 'mm/dd/yyyy', 195 clearBtn: true, 196 todayBtn: true, 197 cancelBtn: true, 198 clearBtnLabel: config.lang.clear, 199 cancelBtnLabel: config.lang.canBtn, 200 okBtnLabel: config.lang.ok, 201 todayBtnLabel: config.lang.today, 202 }).on('datechanged', function(event) { 203 if ($(this).attr("data-element")) { 204 var element = $(this).data('element'); 205 var parent = $(this).data('parent'); 206 207 var date = new Date(event.date); 208 var day = date.getDate(); 209 var month = config.lang.monthsFull[date.getMonth()]; 210 var year = date.getFullYear(); 211 var formatted = month + ' ' + day + ', ' + year; 212 213 $(parent).html(formatted); 214 if ($(element).is(":input")) { 215 $(element).val(event.date).trigger('change'); 216 } else { 217 $(element).html(formatted); 218 } 219 } 220 }); 221 222 /* == Time Picker == */ 223 $('[data-timepicker]').wTime({ 224 timeFormat: 'hh:mm:ss.000', // format of the time value (data-time attribute) 225 format: 'hh:mm t', // format of the input value 226 is24: true, // format 24 hour header 227 readOnly: true, // determines if input is readonly 228 hourPadding: true, // determines if display value has zero padding for hour value less than 10 (i.e. 05:30 PM); 24-hour format has padding by default 229 btnNow: config.lang.now, 230 btnOk: config.lang.ok, 231 btnCancel: config.lang.canBtn, 232 }); 233 234 //Main menu 235 $('nav.menu > ul > li:has( > ul)').addClass('menu-dropdown-icon'); 236 $('nav.menu > ul > li > ul:not(:has(ul))').addClass('normal-sub'); 237 //$("nav.menu > ul").before("<a href=\"#\" class=\"menu-mobile\"></a>"); 238 $("nav.menu > ul > li").hover(function(e) { 239 if ($(window).width() > 768) { 240 $(this).children("ul").stop(true, false).slideToggle(150); 241 e.preventDefault(); 242 } 243 }); 244 $("nav.menu > ul > li").click(function() { 245 if ($(window).width() <= 768) { 246 $(this).children("ul").fadeToggle(150); 247 } 248 }); 249 $(".menu-mobile").click(function(e) { 250 $("nav.menu > ul").toggleClass('show-on-mobile'); 251 e.preventDefault(); 252 }); 253 254 /* == Input focus == */ 255 $(document).on("focusout", '.wojo.input input, .wojo.input textarea', function() { 256 $('.wojo.input').removeClass('focus'); 257 }); 258 $(document).on("focusin", '.wojo.input input, .wojo.input textarea', function() { 259 $(this).closest('.input').addClass('focus'); 260 }); 261 262 /* == Membership Select == */ 263 $(".add-membership").on("click", function() { 264 $("#membershipSelect .segment").removeClass('active'); 265 $(this).closest('.segment').addClass('active'); 266 var id = $(this).data('id'); 267 $.post(config.url + "/controller.php", { 268 action: "buyMembership", 269 id: id 270 }, function(json) { 271 $("#mResult").html(json.message); 272 $("html,body").animate({ 273 scrollTop: $("#mResult").offset().top 274 }, 1000); 275 }, "json"); 276 }); 277 278 /* == Gateway Select == */ 279 $("#mResult").on("click", ".sGateway", function() { 280 var button = $(this); 281 $("#mResult .sGateway").removeClass('primary'); 282 button.addClass('primary loading'); 283 var id = $(this).data('id'); 284 $.post(config.url + "/controller.php", { 285 action: "selectGateway", 286 id: id 287 }, function(json) { 288 $("#mResult #gdata").html(json.message); 289 $("html,body").animate({ 290 scrollTop: $("#gdata").offset().top - 40 291 }, 500); 292 button.removeClass('loading'); 293 }, "json"); 294 }); 295 296 /* == Coupon Select == */ 297 $("#mResult").on("click", "#cinput", function() { 298 var id = $(this).data('id'); 299 var $this = $(this); 300 var $parent = $(this).parent(); 301 var $input = $("input[name=coupon]"); 302 if (!$input.val()) { 303 $parent.transition('shake'); 304 } else { 305 $parent.addClass('loading'); 306 $.post(config.url + "/controller.php", { 307 action: "getCoupon", 308 id: id, 309 code: $input.val() 310 }, function(json) { 311 if (json.type === "success") { 312 $parent.removeClass('error'); 313 $this.toggleClass('find check'); 314 $parent.prop('disabled', true); 315 $(".totaltax").html(json.tax); 316 $(".totalamt").html(json.gtotal); 317 $(".disc").html(json.disc); 318 $(".disc").parent().addClass('highlite'); 319 if(json.is_full === 100) { 320 $("#activateCoupon").show(); 321 $("#gateList").hide(); 322 } else { 323 $("#activateCoupon").hide(); 324 $("#gateList").show(); 325 } 326 } else { 327 $parent.transition('shake'); 328 } 329 $parent.removeClass('loading'); 330 }, "json"); 331 } 332 }); 333 334 /* == Coupon Select == */ 335 $(document).on("click", ".activateCoupon", function() { 336 var $this = $(this); 337 $this.addClass('loading'); 338 $.post(config.url + "/controller.php", { 339 action: "activateCoupon", 340 }, function(json) { 341 if (json.type === "success") { 342 window.location.href = window.location.href; 343 } 344 $this.removeClass('loading'); 345 }, "json"); 346 }); 347 348 /* == Scrool to element == */ 349 $(document).on('click', '[data-scroll="true"]', function(event) { 350 event.preventDefault(); 351 event.stopPropagation(); 352 var target = $(this).attr('href'); 353 var offset = $(this).attr('data-offset'); 354 355 $("html,body").animate({ 356 scrollTop: $(target).offset().top - parseInt(offset) 357 }, "1000"); 358 return false;
359 }); 360 361 // Scroll to top 362 $(window).scroll(function() { 363 if ($(this).scrollTop() > 100) { 364 $('#back-to-top').stop(true, true).fadeIn(500); 365 } else { 366 $('#back-to-top').stop(true, true).fadeOut(300); 367 } 368 }); 369 370 $('#back-to-top').click(function() { 371 $("html,body").animate({ 372 scrollTop: $("body").offset().top 373 }, "1000"); 374 return false; 375 }); 376 377 /* == Clear Session Debug Queries == */ 378 $("#debug-panel").on('click', 'a.clear_session', function() { 379 $.get(config.url + '/controller.php', { 380 ClearSessionQueries: 1 381 }); 382 $(this).css('color', '#222'); 383 }); 384 385 /* == Master Form == */ 386 $(document).on('click', 'button[name=dosubmit]', function() { 387 var $button = $(this); 388 var action = $(this).data('action'); 389 var $form = $(this).closest("form"); 390 var asseturl = $(this).data('url'); 391 var hide = $(this).data('hide'); 392 393 function showResponse(json) { 394 setTimeout(function() { 395 $($button).removeClass("loading").prop("disabled", false); 396 }, 500); 397 398 if (json.type === "success" && json.redirect) { 399 setTimeout(function() { 400 $('body').transition('scaleOut', { 401 duration: 600, 402 complete: function() { 403 window.location.href = json.redirect; 404 } 405 }); 406 }, 5000); 407 } 408 if (json.type === "success" && hide) { 409 $form.children().transition('fadeOut', { 410 duration: 5000, 411 }); 412 } 413 $.wNotice(json.message, { 414 autoclose: 12000, 415 type: json.type, 416 title: json.title 417 }); 418 } 419 420 function showLoader() { 421 $($button).addClass("loading").prop("disabled", true); 422 } 423 var options = { 424 target: null, 425 beforeSubmit: showLoader, 426 success: showResponse, 427 type: "post", 428 url: asseturl ? config.url + "/" + asseturl + "/controller.php" : config.url + "/controller.php", 429 data: { 430 action: action 431 }, 432 dataType: 'json' 433 }; 434
435 $($form).ajaxForm(options).submit(); 436 }); 437 438 /* == Avatar Upload == */ 439 $('[data-type="image"]').wavatar({ 440 text: config.lang.sel_pic, 441 validators: { 442 maxWidth: 1200, 443 maxHeight: 1200 444 }, 445 reject: function(file, errors) { 446 if (errors.mimeType) { 447 $.wNotice(decodeURIComponent(file.name + ' must be an image.'), { 448 autoclose: 4000, 449 type: "error", 450 title: 'Error' 451 }); 452 } 453 if (errors.maxWidth || errors.maxHeight) { 454 $.wNotice(decodeURIComponent(file.name + ' must be width:1200px, and height:1200px max.'), { 455 autoclose: 4000, 456 type: "error", 457 title: 'Error' 458 }); 459 } 460 }, 461 accept: function() { 462 if ($(this).data('process')) { 463 var action = $(this).data('action'); 464 var data = new FormData(); 465 data.append(action, $(this).prop('files')[0]); 466 data.append("action", "avatar"); 467 468 $.ajax({ 469 type: 'POST', 470 processData: false, 471 contentType: false, 472 data: data, 473 url: config.url + "/controller.php", 474 dataType: 'json', 475 }); 476 } 477 } 478 }); 479 480 /* == Password Reset / Login == */ 481 $("#backToLogin").on('click', function() { 482 $("#loginForm").slideDown(); 483 $("#passForm").slideUp(); 484 }); 485 $("#passreset").on('click', function() { 486 $("#loginForm").slideUp(); 487 $("#passForm").slideDown(); 488 489 }); 490 491 $("#doLogin").on('click', function() { 492 var $btn = $(this); 493 $btn.addClass('loading'); 494 var username = $("input[name=email]").val(); 495 var password = $("input[name=password]").val(); 496 $.ajax({ 497 type: 'post', 498 url: config.url + "/controller.php", 499 data: { 500 'action': 'userLogin', 501 'username': username, 502 'password': password 503 }, 504 dataType: "json", 505 success: function(json) { 506 if (json.type === "error") { 507 $.wNotice(decodeURIComponent(json.message), { 508 autoclose: 6000, 509 type: json.type, 510 title: json.title 511 }); 512 } else { 513 window.location.href = config.surl + "/dashboard/"; 514 } 515 $btn.removeClass('loading'); 516 } 517 }); 518 }); 519 520 $("#doPassword").on('click', function() { 521 var $btn = $(this); 522 $btn.addClass('loading'); 523 var email = $("input[name=pemail]").val(); 524 $.ajax({ 525 type: 'post', 526 url: config.url + "/controller.php", 527 data: { 528 'action': 'uResetPass', 529 'email': email, 530 }, 531 dataType: "json", 532 success: function(json) { 533 $.wNotice(decodeURIComponent(json.message), { 534 autoclose: 6000, 535 type: json.type, 536 title: json.title 537 }); 538 if (json.type === "success") { 539 $btn.prop("disabled", true); 540 } 541 $btn.removeClass('loading'); 542 } 543 }); 544 }); 545 546 /* == Language Switcher == */ 547 $('#dropdown-langChange').on('click', 'a', function() { 548 Cookies.set("LANG_CMSPRO", $(this).data('value'), { 549 expires: 120, 550 path: '/' 551 }); 552 $('body').transition("scaleOut", { 553 duration: 2000,
554 complete: function() { 555 window.location.href = config.surl; 556 } 557 }); 558 return false; 559 }); 560 561 /* == Search == */ 562 $("#searchButton").on('click', function() { 563 var icon = $(this); 564 var input = $("#masterSearch").find("input"); 565 var url = $("#masterSearch").data('url'); 566 567 $("#masterSearch").animate({ 568 "width": "100%", 569 "opacity": 1 570 }, 300, function() { 571 input.focus(); 572 }); 573 icon.css('opacity', 0); 574 575 input.blur(function() { 576 if (!input.val()) { 577 $("#masterSearch").animate({ 578 "width": "0", 579 "opacity": 0 580 }, 200); 581 icon.css('opacity', 1); 582 } 583 }); 584 585 input.keypress(function(e) { 586 var key = e.which; 587 if (key === 13) { 588 var value = $.trim($(this).val()); 589 if (value.length) { 590 window.location.href = url + '?keyword=' + value; 591 } 592 } 593 }); 594 }); 595 596 /* == Ajax Search == */ 597 $(document).on('keyup', '[data-search="true"]', function() { 598 var $input = $(this).parent(); 599 var srch_string = $(this).val(); 600 var url = $(this).data('url'); 601 var $this = $(this); 602 var $search = $input.find('.wojo.ajax.search'); 603 if (srch_string.length > 3) { 604 $search.remove(); 605 $input.addClass('loading'); 606 $.get(url, { 607 action: "search", 608 string: srch_string 609 }, function(json) { 610 $input.append(json.html); 611 $input.removeClass('loading'); 612 $(document).on('click', function(event) { 613 if (!($(event.target).is($this))) { 614 $input.find('.wojo.ajax.search').fadeOut(); 615 } 616 }); 617 }, "json"); 618 } 619 return false; 620 }); 621 622 // convert logo svg to editable 623 $('.logo img').each(function() { 624 var $img = $(this); 625 var imgID = $img.attr('id'); 626 var imgClass = $img.attr('class'); 627 var imgURL = $img.attr('src'); 628 629 $.get(imgURL, function(data) { 630 var $svg = $(data).find('svg'); 631 if (typeof imgID !== 'undefined') { 632 $svg = $svg.attr('id', imgID); 633 } 634 if (typeof imgClass !== 'undefined') { 635 $svg = $svg.attr('class', imgClass + ' replaced-svg'); 636 } 637 $svg = $svg.removeAttr('xmlns:a'); 638 $img.replaceWith($svg); 639 }, 'xml'); 640 641 }); 642 }; 643})(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.