Created
September 19, 2011 02:12
-
-
Save esehara/1225869 to your computer and use it in GitHub Desktop.
Nise Hack!!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var image_word = { | |
elem : "h1,h2,h3,h4,h5,h6,span,li,ul,img".split(","), | |
count : 0, | |
} | |
var tag_p_and_a = { | |
p : [], | |
p_count : 0, | |
a : [], | |
a_count : 0 | |
} | |
tag_p_and_a.next_p = function(){ | |
this.p_count ++; | |
return this.p[this.p_count - 1]; | |
} | |
tag_p_and_a.next_a = function(){ | |
this.a_count ++; | |
return this.a[this.a_count - 1]; | |
} | |
var moji_iterate = function(word){ | |
this.word = word; | |
this.counter = 0; | |
}; | |
moji_iterate.prototype.next = function(){ | |
if(this.word.length > this.counter){ | |
this.counter ++; | |
return this.word.charAt(this.counter - 1); | |
} | |
return null; | |
}; | |
moji_iterate.prototype.init = function(word){ | |
this.word = word; | |
this.counter = 0; | |
} | |
function main(){ | |
initialize(); | |
start(); | |
} | |
function initialize(){ | |
//Background color -> Black | |
//FontColor -> Green | |
var bgc_nodes = "blockquote,div,h1,h2,h3,h4,h5,h6,span,a:link,a:visited,a:hover,a:active".split(","); | |
var bgc_nodes_length = bgc_nodes.length; | |
//Body is spacialize | |
$('body').css('background-color','#000'); | |
$('body').css('background-image','none'); | |
$('body').css('color','#0F0'); | |
for (var i = 0; i < bgc_nodes_length ; i++){ | |
var target = bgc_nodes[i]; | |
$(target).css('background-color','#333'); | |
$(target).css('background-image','none'); | |
$(target).css('color','#0F0'); | |
} | |
//div is none' | |
$('div').css('display','none'); | |
//Image & Word -> Don't show | |
var image_word_length = image_word.elem.length; | |
for (var i = 0;i < image_word_length;i++){ | |
var target = image_word.elem[i]; | |
$(target).css('display','none'); | |
} | |
//<p> effect. | |
var p_length = $('p').length; | |
for (var i = 0;i < p_length;i++){ | |
tag_p_and_a.p.push(new moji_iterate($('p').eq(i).text())); | |
} | |
$("p").text(""); | |
} | |
var divnumber = $('div').length; | |
var count = 0; | |
var Interval_check = { | |
show_wold_end:null, | |
show_div_end:null | |
} | |
var showword = function(){ | |
if (count >= tag_p_and_a.p.length){ | |
console.log("end"); | |
clearInterval(Interval_check.show_word_end); | |
window.setInterval(function(){ | |
return; | |
},1000); | |
return; | |
} | |
var next_word = tag_p_and_a.p[count].next(); | |
if (next_word != null){ | |
var get_word = $("p").eq(count).text(); | |
$("p").eq(count).text(get_word + next_word); | |
}else{ | |
count ++; | |
} | |
} | |
var showdiv = function(){ | |
if (divnumber < count) { | |
divnumber = $(image_word.elem[image_word.count]).length; | |
count = 0; | |
showdiv = function(){ | |
$(image_word.elem[image_word.count]).eq(count).fadeIn("slow"); | |
count ++; | |
if (divnumber < count){ | |
image_word.count ++; | |
if (image_word.count > image_word.elem.length){ | |
count = 0; | |
clearInterval(Interval_check.show_div_end); | |
Interval_check.show_word_end = setInterval(function(){ | |
showword(); | |
},15); | |
return; | |
} | |
divnumber = $(image_word.elem[image_word.count]).length; | |
count = 0; | |
} | |
} | |
} | |
$('div').eq(count).fadeIn("slow"); | |
count ++; | |
} | |
function start(){ | |
Interval_check.show_div_end = setInterval(function(){ | |
showdiv(); | |
},30); | |
} | |
if(!window.noMain){ | |
main(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment