1/* JavaScript Document */ 2 3(function ($) { 4 5 var $common = { 6 7 body: $("body"), 8 checkLen: function (_el) { 9 return (_el.length !== 0) ? true : false; 10 }, 11 setBody: function (_bool, _bodyClass) { 12 13 if (_bool) { 14 this.body.addClass(_bodyClass); 15 return; 16 } 17 18 this.body.removeClass(_bodyClass); 19 return; 20 } 21 }; 22 23 24 /* custom functionality for: RECIPIENT TAB */ 25 var recipientLeftSticky = { 26 27 getRailList: function (_id) { 28 return $("#" + _id).find(".dropListLeftRail").find("li.listLeftRail"); 29 }, 30 31 setLeftFirst: function (_id, _bool) { 32 $("li.listRailFirst").removeClass("listRailFirst"); 33 34 $(this.getRailList(_id).eq(0)).addClass("listRailFirst"); 35 36 if (_bool) { 37 this.setLeftRail(_id, _bool); 38 } 39 }, 40 41 setLeftRail: function (_id, _bool) { 42 43 this.getRailList(_id).map(function (index, item) { 44 var $item = $(item); 45 46 if (_bool) { 47 48 $item.bind("mouseenter", function () { 49 50 $("li.listLeftRail").removeClass("listRailFirst"); 51 52 $item.addClass("listRailFirst"); 53 54 }); 55 } else { 56 $item.unbind("mouseenter"); 57 } 58 }); 59 }, 60 61 initRecipient: function (_id, _bool) { 62 63 this.setLeftFirst(_id, _bool); 64 } 65 }; 66 67 /* 68 *************************** 69 NAVMENU | navMenu 70 plugin requires JQUERY 1.10.2 71 header dropdown functionality 72 73 *************************** 74 TABS ID : "pm_tab_"+ name 75 TABS CLASS: "pm-tab-shadow" 76 *************************** 77 PMALL copyright 2018 78 *************************** 79 */ 80 81 82 var $navMenu = { 83 _hoverstate: false, 84 _selectedType: null 85 }; 86 87 /* start plugin */ 88 $.fn.navMenu = function (_el, _options) { 89 90 var _defaults = { 91 id: "pm_tab_occasion", 92 name: "navMenu", 93 type: "occasion", 94 ticks: 150, 95 hoverstate: false, 96 common: $common 97 }; 98 99 var _self = this; 100 _self.elem = _el; 101 _self.extObj = $.extend({}, _defaults, _options); 102 _self.name = _self.extObj.name; 103 104 if (_self.extObj.id === "pm_tab_recipient") { 105 _self.extObj = $.extend({}, _self.extObj, recipientLeftSticky); 106 } 107 108 var $menuEl = $(_self.elem); 109 110 _self.init = function () { 111 112 if ($menuEl.attr("id") === "pm_tab_sale") { 113 114 var $navLen = $(".pm-tabbar-content-left").find(".pm-tab-item,.pm-tab-seasonal").length; 115 $navLen--; 116 117 if ($("#pm_tab_sale").index() === $navLen) { 118 $("#sale-content").addClass("last-content"); 119 } 120 } 121 122 $menuEl.on("mouseenter mouseover mouseleave", function (e) { 123 124 $navMenu._hoverstate = true; 125 126 _self.extObj.hoverstate = true; 127 _self.resetOtherMenu($(".pm-tab-shadow").not($menuEl)); 128 129 130 if (e.type === "mouseenter" && _self.extObj.id === "pm_tab_recipient") { 131 _self.extObj.setLeftFirst("recipient-content"); 132 } 133 134 /* ==== START MOUSELEAVE ========= */ 135 if (e.type === "mouseleave") { 136 137 $navMenu._hoverstate = false; 138 _self.extObj.hoverstate = false; 139 140 141 setTimeout(function () { 142 if ($navMenu._hoverstate || _self.extObj.hoverstate) { 143 return; 144 } 145 _self.setDropState(_self.extObj.hoverstate); 146 }, parseInt(_self.extObj.ticks * 2)); 147 return; 148 } 149 150 /* ==== START MOUSEENTER | MOUSEOVER ======= */ 151 152 if ($navMenu._selectedType === null || $navMenu._selectedType !== _self.extObj.type) { 153 154 setTimeout(function () { 155 _self.setDropState(_self.extObj.hoverstate); 156 }, _self.extObj.ticks); 157 } 158 159 $navMenu._selectedType = _self.extObj.type; 160 161 return; 162 163 }); 164 }; 165 166 _self.resetOtherMenu = function (_el) { 167 if (_self.extObj.common.checkLen($(".hoverDrop"))) { 168 $(_el).removeClass("hoverDrop"); 169 } 170 return true; 171 }; 172 173 _self.setBodyFade = function (_bool, _bodyClass) { 174 175 if (_bool) { 176 _self.extObj.common.body.addClass(_bodyClass); 177 return; 178 } 179 180 _self.extObj.common.body.removeClass(_bodyClass); 181 return; 182 }; 183 184 _self.setDropState = function (_bool) { 185 186 if ($(".hoverDrop")) { 187 $(".hoverDrop").removeClass("hoverDrop"); 188 } 189 190 if (_bool) { 191 if ($(".dyno-hoverDrop")) { 192 $(".dyno-hoverDrop").removeClass("dyno-hoverDrop"); 193 } 194 195 $.when(_self.setBodyFade(true, "bodyFade")).done(function () { 196 _self.setBodyFade(true, "bodyFadeOn"); 197 $menuEl.addClass("hoverDrop"); 198 }); 199 200 return; 201 } 202 203 //$menuEl.removeClass("hoverDrop"); 204 205 if (_self.extObj.id === "pm_tab_recipient") { 206 recipientLeftSticky.setLeftRail(false); 207 } 208 209 if (_self.extObj.type === $navMenu._selectedType) { 210 $.when(_self.setBodyFade(false, "bodyFadeOn")).done(function () { 211 setTimeout(function () { 212 _self.setBodyFade(false, "bodyFade"); 213 $navMenu._selectedType = null; 214 }, _self.extObj.ticks); 215 }); 216 217 } 218 return; 219 }; 220 221 return _self; 222 }; 223 224 /** end plugin **/ 225 226}(jQuery)); 227 228 229var PmallCategoryApp = function (options) { 230 231 var _self = this; 232 233 this.defaults = { 234 "ready": true, 235 "bindElems": [] 236 }; 237 238 this.settings = $.extend(this.defaults, options); 239 this.app = { 240 init: function () { 241 return 242 this.bindEvents(); 243 244 }, 245 bindEvents: function () { 246 247 if (_self.settings.bindElems.includes("seemore")) { 248 $(".link__seemore").on("click", this.toggleColorSwatches.bind(this)); 249 } 250 }, 251 252 toggleColorSwatches: function (event) { 253 254 var btn = $(event.target); 255 var wrapper = btn.closest(".product-color-choices-circle"); 256 257 wrapper.removeClass("toggle-wrapper"); 258 btn.empty().remove(); 259 } 260 }; 261};
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.