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