Ken2812221(留言墙 | 貢獻) 小无编辑摘要 标签:sourceedit |
Ken2812221(留言墙 | 貢獻) 小无编辑摘要 标签:sourceedit |
||
(未显示同一用户的28个中间版本) | |||
第1行: | 第1行: | ||
<script> |
<script> |
||
(function Terry2(){ |
(function Terry2(){ |
||
− | if(typeof jQuery == |
+ | if(typeof jQuery == 'undefined') { |
setTimeout(Terry2, 100); |
setTimeout(Terry2, 100); |
||
return; |
return; |
||
第7行: | 第7行: | ||
var questions = $('.question'); |
var questions = $('.question'); |
||
⚫ | |||
var temp = questions.children("center").not(':eq(-1)'); |
var temp = questions.children("center").not(':eq(-1)'); |
||
+ | var picsp = $('.fool_story_progress'); |
||
+ | var pics = picsp.children(); |
||
⚫ | |||
+ | function show(div) { |
||
+ | div.show(); |
||
+ | if(div.data('storyInterval')) { |
||
+ | var imgages = div.children('img'); |
||
+ | var picNum = images.length; |
||
+ | var currentIndex = 0; |
||
+ | |||
+ | function moveNext() { |
||
+ | if(currentIndex >= picNum) { |
||
⚫ | |||
⚫ | |||
+ | return; |
||
+ | } |
||
+ | images.eq(currentIndex).hide(); |
||
+ | |||
+ | currentIndex++; |
||
+ | |||
+ | images.eq(currentIndex).show(); |
||
+ | |||
+ | setTimeout(moveNext, div.data('sotryInterval')); |
||
+ | } |
||
+ | |||
+ | setTimeout(moveNext, div.data('storyInterval')); |
||
+ | } |
||
+ | |||
+ | if(div.data('autoSkip')) { |
||
+ | setTimeout(function() { |
||
⚫ | |||
⚫ | |||
+ | }, parseInt(div.data('autoSkip'))); |
||
+ | } |
||
+ | } |
||
+ | |||
+ | function bind($this, current, next) { |
||
+ | if(current.data('delay')) { |
||
+ | setTimeout(function() { |
||
+ | current.hide(); |
||
+ | show(next); |
||
+ | }, parseInt(current.data('delay'))); |
||
+ | $($this).off('click'); |
||
+ | return; |
||
+ | } |
||
+ | if(current.data('exit')) { |
||
+ | current.find('a:eq(0)').click(function() { |
||
+ | setCookie('fools_played', '1', 1); |
||
+ | }); |
||
+ | } |
||
+ | current.hide(); |
||
+ | show(next); |
||
+ | } |
||
+ | |||
+ | function setCookie(cname, cvalue, exdays) { |
||
+ | var d = new Date(); |
||
+ | d.setTime(d.getTime() + (exdays*24*60*60*1000)); |
||
+ | var expires = "expires="+d.toUTCString(); |
||
+ | document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/"; |
||
+ | } |
||
+ | |||
+ | function getCookie(cname) { |
||
+ | var name = cname + "="; |
||
+ | var ca = document.cookie.split(';'); |
||
+ | for(var i=0; i<ca.length; i++) { |
||
+ | var c = ca[i]; |
||
+ | while (c.charAt(0)==' ') c = c.substring(1); |
||
+ | if (c.indexOf(name) == 0) return c.substring(name.length,c.length); |
||
+ | } |
||
+ | return ""; |
||
+ | } |
||
+ | |||
+ | if(getCookie('fools_played')) { |
||
+ | window.location.href = 'http://zh.tos.wikia.com/wiki/臨時主頁'; |
||
+ | } |
||
+ | |||
temp.children().css('cursor', 'pointer'); |
temp.children().css('cursor', 'pointer'); |
||
temp.find(':first-child').children().click(function() { |
temp.find(':first-child').children().click(function() { |
||
var current = $(this).parents('.question:eq(0)'); |
var current = $(this).parents('.question:eq(0)'); |
||
+ | bind(this, current, questions.eq(parseInt(current.data('yes')) - 1)); |
||
⚫ | |||
⚫ | |||
}); |
}); |
||
− | temp.find(': |
+ | temp.children().not(temp.find(':first-child')).children().click(function() { |
var current = $(this).parents('.question:eq(0)'); |
var current = $(this).parents('.question:eq(0)'); |
||
+ | bind(this, current, questions.eq(parseInt(current.data('no')) - 1)); |
||
⚫ | |||
⚫ | |||
}); |
}); |
||
− | questions.eq(0) |
+ | show(questions.eq(0)); |
− | $('.wikia-logo').attr('href', 'http://zh.tos.wikia.com/wiki/臨時主頁') |
+ | $('.wikia-logo').attr('href', 'http://zh.tos.wikia.com/wiki/臨時主頁').click(function() { |
+ | setCookie('fools_played', '1', 1); |
||
+ | }); |
||
− | $('a[href= |
+ | $('a[href="https:\/\/www.facebook.com/zhtoswikia"]').attr('target', '_blank'); |
+ | |||
+ | pics.hide(); |
||
+ | pics.eq(0).show(); |
||
})(); |
})(); |
||
</script> |
</script> |
2015年4月2日 (四) 04:13的最新版本
<script> (function Terry2(){ if(typeof jQuery == 'undefined') { setTimeout(Terry2, 100); return; }
var questions = $('.question'); var temp = questions.children("center").not(':eq(-1)'); var picsp = $('.fool_story_progress'); var pics = picsp.children();
function show(div) { div.show(); if(div.data('storyInterval')) { var imgages = div.children('img'); var picNum = images.length; var currentIndex = 0;
function moveNext() { if(currentIndex >= picNum) { div.hide(); show(questions.eq(parseInt(div.data('yes')))); return; } images.eq(currentIndex).hide();
currentIndex++;
images.eq(currentIndex).show();
setTimeout(moveNext, div.data('sotryInterval')); }
setTimeout(moveNext, div.data('storyInterval')); }
if(div.data('autoSkip')) { setTimeout(function() { div.hide(); show(questions.eq(parseInt(div.data('yes')) - 1)); }, parseInt(div.data('autoSkip'))); } }
function bind($this, current, next) { if(current.data('delay')) { setTimeout(function() { current.hide(); show(next); }, parseInt(current.data('delay'))); $($this).off('click'); return; } if(current.data('exit')) { current.find('a:eq(0)').click(function() { setCookie('fools_played', '1', 1); }); } current.hide(); show(next); }
function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires="+d.toUTCString(); document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/"; }
function getCookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i<ca.length; i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1); if (c.indexOf(name) == 0) return c.substring(name.length,c.length); } return ""; }
if(getCookie('fools_played')) { window.location.href = 'http://zh.tos.wikia.com/wiki/臨時主頁'; }
temp.children().css('cursor', 'pointer'); temp.find(':first-child').children().click(function() { var current = $(this).parents('.question:eq(0)'); bind(this, current, questions.eq(parseInt(current.data('yes')) - 1)); }); temp.children().not(temp.find(':first-child')).children().click(function() { var current = $(this).parents('.question:eq(0)'); bind(this, current, questions.eq(parseInt(current.data('no')) - 1)); });
show(questions.eq(0));
$('.wikia-logo').attr('href', 'http://zh.tos.wikia.com/wiki/臨時主頁').click(function() { setCookie('fools_played', '1', 1); });
$('a[href="https:\/\/www.facebook.com/zhtoswikia"]').attr('target', '_blank');
pics.hide();
pics.eq(0).show();
})();
</script>