universal 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/_includes/cssload.html +35 -0
- data/_includes/head.html +8 -8
- data/_layouts/default.html +1 -0
- data/_layouts/prod.html +1 -0
- data/assets/css/animate.css +640 -3157
- data/assets/css/custom.css +17 -84
- data/assets/css/owl.carousel.css +12 -71
- data/assets/css/owl.theme.css +9 -69
- data/assets/css/style.blue.css +735 -3218
- data/assets/img/.DS_Store +0 -0
- data/assets/img/Chewbacca.jpg +0 -0
- data/assets/js/front.js +2 -413
- data/assets/js/jquery.cookie.js +1 -117
- data/assets/js/jquery.counterup.min.js +1 -8
- metadata +2 -3
- data/assets/img/Han_20Solo.jpg +0 -0
- data/assets/img/Luke_20Skywalker.jpg +0 -0
data/assets/img/.DS_Store
CHANGED
Binary file
|
data/assets/img/Chewbacca.jpg
CHANGED
Binary file
|
data/assets/js/front.js
CHANGED
@@ -1,413 +1,2 @@
|
|
1
|
-
if ($.cookie("theme_csspath")) {
|
2
|
-
|
3
|
-
}
|
4
|
-
if ($.cookie("theme_layout")) {
|
5
|
-
$('body').addClass($.cookie("theme_layout"));
|
6
|
-
}
|
7
|
-
|
8
|
-
$(function () {
|
9
|
-
|
10
|
-
sliderHomepage();
|
11
|
-
sliders();
|
12
|
-
fullScreenContainer();
|
13
|
-
productDetailGallery(4000);
|
14
|
-
menuSliding();
|
15
|
-
productDetailSizes();
|
16
|
-
utils();
|
17
|
-
animations();
|
18
|
-
counters();
|
19
|
-
demo();
|
20
|
-
|
21
|
-
});
|
22
|
-
|
23
|
-
/* for demo purpose only - can be deleted */
|
24
|
-
|
25
|
-
function demo() {
|
26
|
-
|
27
|
-
if ($.cookie("theme_csspath")) {
|
28
|
-
$('link#theme-stylesheet').attr("href", $.cookie("theme_csspath"));
|
29
|
-
}
|
30
|
-
|
31
|
-
$("#colour").change(function () {
|
32
|
-
|
33
|
-
if ($(this).val() !== '') {
|
34
|
-
|
35
|
-
var theme_csspath = 'css/style.' + $(this).val() + '.css';
|
36
|
-
|
37
|
-
$('link#theme-stylesheet').attr("href", theme_csspath);
|
38
|
-
|
39
|
-
$.cookie("theme_csspath", theme_csspath, {expires: 365, path: '/'});
|
40
|
-
}
|
41
|
-
|
42
|
-
return false;
|
43
|
-
});
|
44
|
-
|
45
|
-
$("#layout").change(function () {
|
46
|
-
|
47
|
-
if ($(this).val() !== '') {
|
48
|
-
|
49
|
-
var theme_layout = $(this).val();
|
50
|
-
|
51
|
-
$('body').removeClass('wide');
|
52
|
-
$('body').removeClass('boxed');
|
53
|
-
|
54
|
-
$('body').addClass(theme_layout);
|
55
|
-
|
56
|
-
$.cookie("theme_layout", theme_layout, {expires: 365, path: '/'});
|
57
|
-
}
|
58
|
-
|
59
|
-
return false;
|
60
|
-
});
|
61
|
-
}
|
62
|
-
|
63
|
-
/* slider homepage */
|
64
|
-
|
65
|
-
function sliderHomepage() {
|
66
|
-
if ($('#slider').length) {
|
67
|
-
var owl = $("#slider");
|
68
|
-
|
69
|
-
$("#slider").owlCarousel({
|
70
|
-
autoPlay: 3000,
|
71
|
-
items: 4,
|
72
|
-
itemsDesktopSmall: [900, 3],
|
73
|
-
itemsTablet: [600, 3],
|
74
|
-
itemsMobile: [500, 2]
|
75
|
-
});
|
76
|
-
}
|
77
|
-
|
78
|
-
}
|
79
|
-
/* sliders */
|
80
|
-
|
81
|
-
function sliders() {
|
82
|
-
if ($('.owl-carousel').length) {
|
83
|
-
|
84
|
-
$(".customers").owlCarousel({
|
85
|
-
items: 6,
|
86
|
-
itemsDesktopSmall: [990, 4],
|
87
|
-
itemsTablet: [768, 2],
|
88
|
-
itemsMobile: [480, 1]
|
89
|
-
});
|
90
|
-
|
91
|
-
$(".testimonials").owlCarousel({
|
92
|
-
items: 4,
|
93
|
-
itemsDesktopSmall: [990, 3],
|
94
|
-
itemsTablet: [768, 2],
|
95
|
-
itemsMobile: [480, 1]
|
96
|
-
});
|
97
|
-
|
98
|
-
$('.project').owlCarousel({
|
99
|
-
navigation: true, // Show next and prev buttons
|
100
|
-
navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"],
|
101
|
-
slideSpeed: 300,
|
102
|
-
paginationSpeed: 400,
|
103
|
-
autoPlay: true,
|
104
|
-
stopOnHover: true,
|
105
|
-
singleItem: true,
|
106
|
-
afterInit: '',
|
107
|
-
lazyLoad: true
|
108
|
-
});
|
109
|
-
|
110
|
-
$('.homepage').owlCarousel({
|
111
|
-
navigation: false, // Show next and prev buttons
|
112
|
-
navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"],
|
113
|
-
slideSpeed: 2000,
|
114
|
-
paginationSpeed: 1000,
|
115
|
-
autoPlay: true,
|
116
|
-
stopOnHover: true,
|
117
|
-
singleItem: true,
|
118
|
-
lazyLoad: false,
|
119
|
-
addClassActive: true,
|
120
|
-
afterInit: function () {
|
121
|
-
//animationsSlider();
|
122
|
-
console.log('init');
|
123
|
-
},
|
124
|
-
afterMove: function () {
|
125
|
-
//animationsSlider();
|
126
|
-
console.log('move');
|
127
|
-
}
|
128
|
-
});
|
129
|
-
}
|
130
|
-
|
131
|
-
}
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
/* menu sliding */
|
136
|
-
|
137
|
-
function menuSliding() {
|
138
|
-
|
139
|
-
|
140
|
-
$('.dropdown').on('show.bs.dropdown', function (e) {
|
141
|
-
|
142
|
-
if ($(window).width() > 750) {
|
143
|
-
$(this).find('.dropdown-menu').first().stop(true, true).slideDown();
|
144
|
-
|
145
|
-
}
|
146
|
-
else {
|
147
|
-
$(this).find('.dropdown-menu').first().stop(true, true).show();
|
148
|
-
}
|
149
|
-
}
|
150
|
-
|
151
|
-
);
|
152
|
-
$('.dropdown').on('hide.bs.dropdown', function (e) {
|
153
|
-
if ($(window).width() > 750) {
|
154
|
-
$(this).find('.dropdown-menu').first().stop(true, true).slideUp();
|
155
|
-
}
|
156
|
-
else {
|
157
|
-
$(this).find('.dropdown-menu').first().stop(true, true).hide();
|
158
|
-
}
|
159
|
-
});
|
160
|
-
|
161
|
-
}
|
162
|
-
|
163
|
-
/* animations */
|
164
|
-
|
165
|
-
function animations() {
|
166
|
-
delayTime = 0;
|
167
|
-
$('[data-animate]').css({opacity: '0'});
|
168
|
-
$('[data-animate]').waypoint(function (direction) {
|
169
|
-
delayTime += 150;
|
170
|
-
$(this).delay(delayTime).queue(function (next) {
|
171
|
-
$(this).toggleClass('animated');
|
172
|
-
$(this).toggleClass($(this).data('animate'));
|
173
|
-
delayTime = 0;
|
174
|
-
next();
|
175
|
-
//$(this).removeClass('animated');
|
176
|
-
//$(this).toggleClass($(this).data('animate'));
|
177
|
-
});
|
178
|
-
},
|
179
|
-
{
|
180
|
-
offset: '90%',
|
181
|
-
triggerOnce: true
|
182
|
-
});
|
183
|
-
|
184
|
-
$('[data-animate-hover]').hover(function () {
|
185
|
-
$(this).css({opacity: 1});
|
186
|
-
$(this).addClass('animated');
|
187
|
-
$(this).removeClass($(this).data('animate'));
|
188
|
-
$(this).addClass($(this).data('animate-hover'));
|
189
|
-
}, function () {
|
190
|
-
$(this).removeClass('animated');
|
191
|
-
$(this).removeClass($(this).data('animate-hover'));
|
192
|
-
});
|
193
|
-
|
194
|
-
}
|
195
|
-
|
196
|
-
function animationsSlider() {
|
197
|
-
|
198
|
-
var delayTimeSlider = 400;
|
199
|
-
|
200
|
-
$('.owl-item:not(.active) [data-animate-always]').each(function () {
|
201
|
-
|
202
|
-
$(this).removeClass('animated');
|
203
|
-
$(this).removeClass($(this).data('animate-always'));
|
204
|
-
$(this).stop(true, true, true).css({opacity: 0});
|
205
|
-
|
206
|
-
});
|
207
|
-
|
208
|
-
$('.owl-item.active [data-animate-always]').each(function () {
|
209
|
-
delayTimeSlider += 500;
|
210
|
-
|
211
|
-
$(this).delay(delayTimeSlider).queue(function (next) {
|
212
|
-
$(this).addClass('animated');
|
213
|
-
$(this).addClass($(this).data('animate-always'));
|
214
|
-
|
215
|
-
console.log($(this).data('animate-always'));
|
216
|
-
|
217
|
-
});
|
218
|
-
});
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
}
|
223
|
-
|
224
|
-
/* counters */
|
225
|
-
|
226
|
-
function counters() {
|
227
|
-
|
228
|
-
$('.counter').counterUp({
|
229
|
-
delay: 10,
|
230
|
-
time: 1000
|
231
|
-
});
|
232
|
-
|
233
|
-
}
|
234
|
-
|
235
|
-
|
236
|
-
/* picture zoom */
|
237
|
-
|
238
|
-
function pictureZoom() {
|
239
|
-
|
240
|
-
$('.product .image, .post .image, .photostream div').each(function () {
|
241
|
-
var imgHeight = $(this).find('img').height();
|
242
|
-
$(this).height(imgHeight);
|
243
|
-
});
|
244
|
-
}
|
245
|
-
|
246
|
-
/* full screen intro */
|
247
|
-
|
248
|
-
function fullScreenContainer() {
|
249
|
-
|
250
|
-
var screenWidth = $(window).width() + "px";
|
251
|
-
|
252
|
-
if ($(window).height() > 500) {
|
253
|
-
var screenHeight = $(window).height() + "px";
|
254
|
-
}
|
255
|
-
else {
|
256
|
-
var screenHeight = "500px";
|
257
|
-
}
|
258
|
-
|
259
|
-
|
260
|
-
$("#intro, #intro .item").css({
|
261
|
-
width: screenWidth,
|
262
|
-
height: screenHeight
|
263
|
-
});
|
264
|
-
}
|
265
|
-
function utils() {
|
266
|
-
|
267
|
-
/* tooltips */
|
268
|
-
|
269
|
-
$('[data-toggle="tooltip"]').tooltip();
|
270
|
-
|
271
|
-
/* click on the box activates the radio */
|
272
|
-
|
273
|
-
$('#checkout').on('click', '.box.shipping-method, .box.payment-method', function (e) {
|
274
|
-
var radio = $(this).find(':radio');
|
275
|
-
radio.prop('checked', true);
|
276
|
-
});
|
277
|
-
/* click on the box activates the link in it */
|
278
|
-
|
279
|
-
$('.box.clickable').on('click', function (e) {
|
280
|
-
|
281
|
-
window.location = $(this).find('a').attr('href');
|
282
|
-
});
|
283
|
-
/* external links in new window*/
|
284
|
-
|
285
|
-
$('.external').on('click', function (e) {
|
286
|
-
|
287
|
-
e.preventDefault();
|
288
|
-
window.open($(this).attr("href"));
|
289
|
-
});
|
290
|
-
/* animated scrolling */
|
291
|
-
|
292
|
-
$('.scroll-to, .scroll-to-top').click(function (event) {
|
293
|
-
|
294
|
-
var full_url = this.href;
|
295
|
-
var parts = full_url.split("#");
|
296
|
-
if (parts.length > 1) {
|
297
|
-
|
298
|
-
scrollTo(full_url);
|
299
|
-
event.preventDefault();
|
300
|
-
}
|
301
|
-
});
|
302
|
-
function scrollTo(full_url) {
|
303
|
-
var parts = full_url.split("#");
|
304
|
-
var trgt = parts[1];
|
305
|
-
var target_offset = $("#" + trgt).offset();
|
306
|
-
var target_top = target_offset.top - 100;
|
307
|
-
if (target_top < 0) {
|
308
|
-
target_top = 0;
|
309
|
-
}
|
310
|
-
|
311
|
-
$('html, body').animate({
|
312
|
-
scrollTop: target_top
|
313
|
-
}, 1000);
|
314
|
-
}
|
315
|
-
}
|
316
|
-
|
317
|
-
/* product detail gallery */
|
318
|
-
|
319
|
-
function productDetailGallery(confDetailSwitch) {
|
320
|
-
$('.thumb:first').addClass('active');
|
321
|
-
timer = setInterval(autoSwitch, confDetailSwitch);
|
322
|
-
$(".thumb").click(function (e) {
|
323
|
-
|
324
|
-
switchImage($(this));
|
325
|
-
clearInterval(timer);
|
326
|
-
timer = setInterval(autoSwitch, confDetailSwitch);
|
327
|
-
e.preventDefault();
|
328
|
-
}
|
329
|
-
);
|
330
|
-
$('#mainImage').hover(function () {
|
331
|
-
clearInterval(timer);
|
332
|
-
}, function () {
|
333
|
-
timer = setInterval(autoSwitch, confDetailSwitch);
|
334
|
-
});
|
335
|
-
function autoSwitch() {
|
336
|
-
var nextThumb = $('.thumb.active').closest('div').next('div').find('.thumb');
|
337
|
-
if (nextThumb.length == 0) {
|
338
|
-
nextThumb = $('.thumb:first');
|
339
|
-
}
|
340
|
-
switchImage(nextThumb);
|
341
|
-
}
|
342
|
-
|
343
|
-
function switchImage(thumb) {
|
344
|
-
|
345
|
-
$('.thumb').removeClass('active');
|
346
|
-
var bigUrl = thumb.attr('href');
|
347
|
-
thumb.addClass('active');
|
348
|
-
$('#mainImage img').attr('src', bigUrl);
|
349
|
-
}
|
350
|
-
}
|
351
|
-
|
352
|
-
/* product detail sizes */
|
353
|
-
|
354
|
-
function productDetailSizes() {
|
355
|
-
$('.sizes a').click(function (e) {
|
356
|
-
e.preventDefault();
|
357
|
-
$('.sizes a').removeClass('active');
|
358
|
-
$('.size-input').prop('checked', false);
|
359
|
-
$(this).addClass('active');
|
360
|
-
$(this).next('input').prop('checked', true);
|
361
|
-
});
|
362
|
-
}
|
363
|
-
|
364
|
-
|
365
|
-
$.fn.alignElementsSameHeight = function () {
|
366
|
-
$('.same-height-row').each(function () {
|
367
|
-
|
368
|
-
var maxHeight = 0;
|
369
|
-
var children = $(this).find('.same-height');
|
370
|
-
children.height('auto');
|
371
|
-
if ($(window).width() > 768) {
|
372
|
-
children.each(function () {
|
373
|
-
if ($(this).innerHeight() > maxHeight) {
|
374
|
-
maxHeight = $(this).innerHeight();
|
375
|
-
}
|
376
|
-
});
|
377
|
-
children.innerHeight(maxHeight);
|
378
|
-
}
|
379
|
-
|
380
|
-
maxHeight = 0;
|
381
|
-
children = $(this).find('.same-height-always');
|
382
|
-
children.height('auto');
|
383
|
-
children.each(function () {
|
384
|
-
if ($(this).height() > maxHeight) {
|
385
|
-
maxHeight = $(this).innerHeight();
|
386
|
-
}
|
387
|
-
});
|
388
|
-
children.innerHeight(maxHeight);
|
389
|
-
|
390
|
-
});
|
391
|
-
}
|
392
|
-
|
393
|
-
$(window).load(function () {
|
394
|
-
|
395
|
-
windowWidth = $(window).width();
|
396
|
-
|
397
|
-
$(this).alignElementsSameHeight();
|
398
|
-
pictureZoom();
|
399
|
-
});
|
400
|
-
$(window).resize(function () {
|
401
|
-
|
402
|
-
newWindowWidth = $(window).width();
|
403
|
-
|
404
|
-
if (windowWidth !== newWindowWidth) {
|
405
|
-
setTimeout(function () {
|
406
|
-
$(this).alignElementsSameHeight();
|
407
|
-
fullScreenContainer();
|
408
|
-
pictureZoom();
|
409
|
-
}, 205);
|
410
|
-
windowWidth = newWindowWidth;
|
411
|
-
}
|
412
|
-
|
413
|
-
});
|
1
|
+
if($.cookie("theme_csspath")){$('link#theme-stylesheet').attr("href",$.cookie("theme_csspath"));}if($.cookie("theme_layout")){$('body').addClass($.cookie("theme_layout"));}$(function(){sliderHomepage();sliders();fullScreenContainer();productDetailGallery(4000);menuSliding();productDetailSizes();utils();animations();counters();demo();});function demo(){if($.cookie("theme_csspath")){$('link#theme-stylesheet').attr("href",$.cookie("theme_csspath"));}$("#colour").change(function(){if($(this).val()!==''){var theme_csspath='css/style.'+$(this).val()+'.css';$('link#theme-stylesheet').attr("href",theme_csspath);$.cookie("theme_csspath",theme_csspath,{expires:365,path:'/'});}return false;});$("#layout").change(function(){if($(this).val()!==''){var theme_layout=$(this).val();$('body').removeClass('wide');$('body').removeClass('boxed');$('body').addClass(theme_layout);$.cookie("theme_layout",theme_layout,{expires:365,path:'/'});}return false;});}function sliderHomepage(){if($('#slider').length){var owl=$("#slider");$("#slider").owlCarousel({autoPlay:3000,items:4,itemsDesktopSmall:[900,3],itemsTablet:[600,3],itemsMobile:[500,2]});}}function sliders(){if($('.owl-carousel').length){$(".customers").owlCarousel({items:6,itemsDesktopSmall:[990,4],itemsTablet:[768,2],itemsMobile:[480,1]});$(".testimonials").owlCarousel({items:4,itemsDesktopSmall:[990,3],itemsTablet:[768,2],itemsMobile:[480,1]});$('.project').owlCarousel({navigation:true,navigationText:["<i class='fa fa-angle-left'></i>","<i class='fa fa-angle-right'></i>"],slideSpeed:300,paginationSpeed:400,autoPlay:true,stopOnHover:true,singleItem:true,afterInit:'',lazyLoad:true});$('.homepage').owlCarousel({navigation:false,navigationText:["<i class='fa fa-angle-left'></i>","<i class='fa fa-angle-right'></i>"],slideSpeed:2000,paginationSpeed:1000,autoPlay:true,stopOnHover:true,singleItem:true,lazyLoad:false,addClassActive:true,afterInit:function(){console.log('init');},afterMove:function(){console.log('move');}});}}function menuSliding(){$('.dropdown').on('show.bs.dropdown',function(e){if($(window).width()>750){$(this).find('.dropdown-menu').first().stop(true,true).slideDown();}else{$(this).find('.dropdown-menu').first().stop(true,true).show();}});$('.dropdown').on('hide.bs.dropdown',function(e){if($(window).width()>750){$(this).find('.dropdown-menu').first().stop(true,true).slideUp();}else{$(this).find('.dropdown-menu').first().stop(true,true).hide();}});}function animations(){delayTime=0;$('[data-animate]').css({opacity:'0'});$('[data-animate]').waypoint(function(direction){delayTime+=150;$(this).delay(delayTime).queue(function(next){$(this).toggleClass('animated');$(this).toggleClass($(this).data('animate'));delayTime=0;next();});},{offset:'90%',triggerOnce:true});$('[data-animate-hover]').hover(function(){$(this).css({opacity:1});$(this).addClass('animated');$(this).removeClass($(this).data('animate'));$(this).addClass($(this).data('animate-hover'));},function(){$(this).removeClass('animated');$(this).removeClass($(this).data('animate-hover'));});}function animationsSlider(){var delayTimeSlider=400;$('.owl-item:not(.active) [data-animate-always]').each(function(){$(this).removeClass('animated');$(this).removeClass($(this).data('animate-always'));$(this).stop(true,true,true).css({opacity:0});});$('.owl-item.active [data-animate-always]').each(function(){delayTimeSlider+=500;$(this).delay(delayTimeSlider).queue(function(next){$(this).addClass('animated');$(this).addClass($(this).data('animate-always'));console.log($(this).data('animate-always'));});});}function counters(){$('.counter').counterUp({delay:10,time:1000});}function pictureZoom(){$('.product .image, .post .image, .photostream div').each(function(){var imgHeight=$(this).find('img').height();$(this).height(imgHeight);});}function fullScreenContainer(){var screenWidth=$(window).width()+"px";if($(window).height()>500){var screenHeight=$(window).height()+"px";}else{var screenHeight="500px";}$("#intro, #intro .item").css({width:screenWidth,height:screenHeight});}function utils(){$('[data-toggle="tooltip"]').tooltip();$('#checkout').on('click','.box.shipping-method, .box.payment-method',function(e){var radio=$(this).find(':radio');radio.prop('checked',true);});$('.box.clickable').on('click',function(e){window.location=$(this).find('a').attr('href');});$('.external').on('click',function(e){e.preventDefault();window.open($(this).attr("href"));});$('.scroll-to, .scroll-to-top').click(function(event){var full_url=this.href;var parts=full_url.split("#");if(parts.length>1){scrollTo(full_url);event.preventDefault();}});function scrollTo(full_url){var parts=full_url.split("#");var trgt=parts[1];var target_offset=$("#"+trgt).offset();var target_top=target_offset.top-100;if(target_top<0){target_top=0;}$('html, body').animate({scrollTop:target_top},1000);}}function productDetailGallery(confDetailSwitch){$('.thumb:first').addClass('active');timer=setInterval(autoSwitch,confDetailSwitch);$(".thumb").click(function(e){switchImage($(this));clearInterval(timer);timer=setInterval(autoSwitch,confDetailSwitch);e.preventDefault();});$('#mainImage').hover(function(){clearInterval(timer);},function(){timer=setInterval(autoSwitch,confDetailSwitch);});function autoSwitch(){var nextThumb=$('.thumb.active').closest('div').next('div').find('.thumb');if(nextThumb.length==0){nextThumb=$('.thumb:first');}switchImage(nextThumb);}function switchImage(thumb){$('.thumb').removeClass('active');var bigUrl=thumb.attr('href');thumb.addClass('active');$('#mainImage img').attr('src',bigUrl);}}function productDetailSizes(){$('.sizes a').click(function(e){e.preventDefault();$('.sizes a').removeClass('active');$('.size-input').prop('checked',false);$(this).addClass('active');$(this).next('input').prop('checked',true);});}$.fn.alignElementsSameHeight=function(){$('.same-height-row').each(function(){var maxHeight=0;var children=$(this).find('.same-height');children.height('auto');if($(window).width()>768){children.each(function(){if($(this).innerHeight()>maxHeight){maxHeight=$(this).innerHeight();}});children.innerHeight(maxHeight);}maxHeight=0;children=$(this).find('.same-height-always');children.height('auto');children.each(function(){if($(this).height()>maxHeight){maxHeight=$(this).innerHeight();}});children.innerHeight(maxHeight);});}
|
2
|
+
$(window).load(function(){windowWidth=$(window).width();$(this).alignElementsSameHeight();pictureZoom();});$(window).resize(function(){newWindowWidth=$(window).width();if(windowWidth!==newWindowWidth){setTimeout(function(){$(this).alignElementsSameHeight();fullScreenContainer();pictureZoom();},205);windowWidth=newWindowWidth;}});
|
data/assets/js/jquery.cookie.js
CHANGED
@@ -1,117 +1 @@
|
|
1
|
-
|
2
|
-
* jQuery Cookie Plugin v1.4.1
|
3
|
-
* https://github.com/carhartl/jquery-cookie
|
4
|
-
*
|
5
|
-
* Copyright 2013 Klaus Hartl
|
6
|
-
* Released under the MIT license
|
7
|
-
*/
|
8
|
-
(function (factory) {
|
9
|
-
if (typeof define === 'function' && define.amd) {
|
10
|
-
// AMD
|
11
|
-
define(['jquery'], factory);
|
12
|
-
} else if (typeof exports === 'object') {
|
13
|
-
// CommonJS
|
14
|
-
factory(require('jquery'));
|
15
|
-
} else {
|
16
|
-
// Browser globals
|
17
|
-
factory(jQuery);
|
18
|
-
}
|
19
|
-
}(function ($) {
|
20
|
-
|
21
|
-
var pluses = /\+/g;
|
22
|
-
|
23
|
-
function encode(s) {
|
24
|
-
return config.raw ? s : encodeURIComponent(s);
|
25
|
-
}
|
26
|
-
|
27
|
-
function decode(s) {
|
28
|
-
return config.raw ? s : decodeURIComponent(s);
|
29
|
-
}
|
30
|
-
|
31
|
-
function stringifyCookieValue(value) {
|
32
|
-
return encode(config.json ? JSON.stringify(value) : String(value));
|
33
|
-
}
|
34
|
-
|
35
|
-
function parseCookieValue(s) {
|
36
|
-
if (s.indexOf('"') === 0) {
|
37
|
-
// This is a quoted cookie as according to RFC2068, unescape...
|
38
|
-
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
39
|
-
}
|
40
|
-
|
41
|
-
try {
|
42
|
-
// Replace server-side written pluses with spaces.
|
43
|
-
// If we can't decode the cookie, ignore it, it's unusable.
|
44
|
-
// If we can't parse the cookie, ignore it, it's unusable.
|
45
|
-
s = decodeURIComponent(s.replace(pluses, ' '));
|
46
|
-
return config.json ? JSON.parse(s) : s;
|
47
|
-
} catch(e) {}
|
48
|
-
}
|
49
|
-
|
50
|
-
function read(s, converter) {
|
51
|
-
var value = config.raw ? s : parseCookieValue(s);
|
52
|
-
return $.isFunction(converter) ? converter(value) : value;
|
53
|
-
}
|
54
|
-
|
55
|
-
var config = $.cookie = function (key, value, options) {
|
56
|
-
|
57
|
-
// Write
|
58
|
-
|
59
|
-
if (value !== undefined && !$.isFunction(value)) {
|
60
|
-
options = $.extend({}, config.defaults, options);
|
61
|
-
|
62
|
-
if (typeof options.expires === 'number') {
|
63
|
-
var days = options.expires, t = options.expires = new Date();
|
64
|
-
t.setTime(+t + days * 864e+5);
|
65
|
-
}
|
66
|
-
|
67
|
-
return (document.cookie = [
|
68
|
-
encode(key), '=', stringifyCookieValue(value),
|
69
|
-
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
70
|
-
options.path ? '; path=' + options.path : '',
|
71
|
-
options.domain ? '; domain=' + options.domain : '',
|
72
|
-
options.secure ? '; secure' : ''
|
73
|
-
].join(''));
|
74
|
-
}
|
75
|
-
|
76
|
-
// Read
|
77
|
-
|
78
|
-
var result = key ? undefined : {};
|
79
|
-
|
80
|
-
// To prevent the for loop in the first place assign an empty array
|
81
|
-
// in case there are no cookies at all. Also prevents odd result when
|
82
|
-
// calling $.cookie().
|
83
|
-
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
84
|
-
|
85
|
-
for (var i = 0, l = cookies.length; i < l; i++) {
|
86
|
-
var parts = cookies[i].split('=');
|
87
|
-
var name = decode(parts.shift());
|
88
|
-
var cookie = parts.join('=');
|
89
|
-
|
90
|
-
if (key && key === name) {
|
91
|
-
// If second argument (value) is a function it's a converter...
|
92
|
-
result = read(cookie, value);
|
93
|
-
break;
|
94
|
-
}
|
95
|
-
|
96
|
-
// Prevent storing a cookie that we couldn't decode.
|
97
|
-
if (!key && (cookie = read(cookie)) !== undefined) {
|
98
|
-
result[name] = cookie;
|
99
|
-
}
|
100
|
-
}
|
101
|
-
|
102
|
-
return result;
|
103
|
-
};
|
104
|
-
|
105
|
-
config.defaults = {};
|
106
|
-
|
107
|
-
$.removeCookie = function (key, options) {
|
108
|
-
if ($.cookie(key) === undefined) {
|
109
|
-
return false;
|
110
|
-
}
|
111
|
-
|
112
|
-
// Must not alter options, thus extending a fresh object...
|
113
|
-
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
|
114
|
-
return !$.cookie(key);
|
115
|
-
};
|
116
|
-
|
117
|
-
}));
|
1
|
+
(function(factory){if(typeof define==='function'&&define.amd){define(['jquery'],factory);}else if(typeof exports==='object'){factory(require('jquery'));}else{factory(jQuery);}}(function($){var pluses=/\+/g;function encode(s){return config.raw?s:encodeURIComponent(s);}function decode(s){return config.raw?s:decodeURIComponent(s);}function stringifyCookieValue(value){return encode(config.json?JSON.stringify(value):String(value));}function parseCookieValue(s){if(s.indexOf('"')===0){s=s.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,'\\');}try{s=decodeURIComponent(s.replace(pluses,' '));return config.json?JSON.parse(s):s;}catch(e){}}function read(s,converter){var value=config.raw?s:parseCookieValue(s);return $.isFunction(converter)?converter(value):value;}var config=$.cookie=function(key,value,options){if(value!==undefined&&!$.isFunction(value)){options=$.extend({},config.defaults,options);if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setTime(+t+days*864e+5);}return(document.cookie=[encode(key),'=',stringifyCookieValue(value),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''));}var result=key?undefined:{};var cookies=document.cookie?document.cookie.split('; '):[];for(var i=0,l=cookies.length;i<l;i++){var parts=cookies[i].split('=');var name=decode(parts.shift());var cookie=parts.join('=');if(key&&key===name){result=read(cookie,value);break;}if(!key&&(cookie=read(cookie))!==undefined){result[name]=cookie;}}return result;};config.defaults={};$.removeCookie=function(key,options){if($.cookie(key)===undefined){return false;}$.cookie(key,'',$.extend({},options,{expires:-1}));return!$.cookie(key);};}));
|