Difference between revisions of "User:Prunc"

From Hinaharap ng sangkatauhan
m
m
Line 1: Line 1:
 
==Fairy Dust==
 
==Fairy Dust==
 +
  
 
<pre>
 
<pre>
 
 
var repeat;
 
var repeat;
 
function testing(){
 
function testing(){
Line 41: Line 41:
  
 
}
 
}
 
 
</pre>
 
</pre>
  
  
 
<pre>
 
<pre>
 
 
//http://theyfly.com/spiritual/rules/rules.htm
 
//http://theyfly.com/spiritual/rules/rules.htm
 
var str = "\n\n\n{|\n\n";
 
var str = "\n\n\n{|\n\n";
Line 62: Line 60:
 
<pre>
 
<pre>
 
//PDF
 
//PDF
var str = "";
+
var repeat;
var n = jQuery("#div2 p").length
+
function testing(){
for (var i=0;i<n;i++) {
+
if (typeof jQuery != 'undefined'){
str += "|-\n";
+
clearInterval(repeat);
str += ( "| " + jQuery("#div1 p").eq(i).text().trim().replace(/\n+/gim,"").replace(/\s+/gim, ' ') + "\n" );
+
afterLoad();
str += ( "| " + jQuery("#div2 p").eq(i).text().trim().replace(/\n+/gim,"").replace(/\s+/gim, ' ') + "\n" );
+
// console.log("jQuery loaded...");
str += "\n";
+
}else{
};  
+
str
+
};
 +
};
 +
if (typeof jQuery == 'undefined') {
 +
var newscript = document.createElement('script');
 +
newscript.type = 'text/javascript';
 +
newscript.async = true;
 +
newscript.src = 'http://code.jquery.com/jquery-2.1.0.min.js';
 +
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(newscript);
 +
repeat = setInterval(testing,250);
 +
} else {
 +
afterLoad();
 +
// console.log("jQuery already present...");
 +
}
 +
function afterLoad(){
 +
 
 +
var str = "\n\n\n{|\n\n";
 +
var n = jQuery("#div2 p").length
 +
for (var i=0;i<n;i++) {
 +
str += "|-\n";
 +
str += ( "| " + jQuery("#div1 p").eq(i).text().trim().replace(/\n+/gim,"").replace(/\s+/gim, ' ') + "\n" );
 +
str += ( "| " + jQuery("#div2 p").eq(i).text().trim().replace(/\n+/gim,"").replace(/\s+/gim, ' ') + "\n" );
 +
str += "\n";
 +
};  
 +
str += "|-\n|}\n";
 +
console.log(str);
 +
 
 +
}
 
</pre>
 
</pre>

Revision as of 22:40, 19 February 2014

Fairy Dust

var repeat;
function testing(){
	if (typeof jQuery != 'undefined'){
		clearInterval(repeat);
		afterLoad();
	//	console.log("jQuery loaded...");
	}else{
		
	};
};
if (typeof jQuery == 'undefined') {
	var newscript = document.createElement('script');
		newscript.type = 'text/javascript';
		newscript.async = true;
		newscript.src = '//code.jquery.com/jquery-2.1.0.min.js';
	(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(newscript);
	repeat = setInterval(testing,250);
} else {
	afterLoad();
//	console.log("jQuery already present...");
}
function afterLoad(){

	jQuery("table tr").each(function(){
	 jQuery(this).find("td").eq(1).prependTo(jQuery(this))
	})

	var str = "\n\n\n{|\n\n";
	jQuery("table tr").each(function(){
	 str += "|-\n";
	 str += ( "| " + jQuery(this).find("td").eq(0).text().trim().replace(/\n+/gim,"").replace(/\s+/gim, ' ') + "\n" );
	 str += ( "| " + jQuery(this).find("td").eq(1).text().trim().replace(/\n+/gim,"").replace(/\s+/gim, ' ') + "\n" );
	 str += "\n";
	});
	str += "|-\n|}\n";
	console.log(str);

}


//http://theyfly.com/spiritual/rules/rules.htm
var str = "\n\n\n{|\n\n";
jQuery("table").each(function(){
	for (var i=0;i<jQuery("table").find("tr").eq(1).find("p").length;i++) {
		str += "|-\n";
		str += ( "| " + jQuery(this).find("tr").eq(1).find("p").eq(i).text().trim().replace(/\n+/gim,"").replace(/\s+/gim, ' ') + "\n" );
		str += ( "| " + jQuery(this).find("td").eq(3).find("p").eq(i).text().trim().replace(/\n+/gim,"").replace(/\s+/gim, ' ') + "\n" );
		str += "\n";
	}
});


//PDF
var repeat;
function testing(){
	if (typeof jQuery != 'undefined'){
		clearInterval(repeat);
		afterLoad();
	//	console.log("jQuery loaded...");
	}else{
		
	};
};
if (typeof jQuery == 'undefined') {
	var newscript = document.createElement('script');
		newscript.type = 'text/javascript';
		newscript.async = true;
		newscript.src = 'http://code.jquery.com/jquery-2.1.0.min.js';
	(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(newscript);
	repeat = setInterval(testing,250);
} else {
	afterLoad();
//	console.log("jQuery already present...");
}
function afterLoad(){

	var str = "\n\n\n{|\n\n";
	var n = jQuery("#div2 p").length
	for (var i=0;i<n;i++) {
			str += "|-\n";
			str += ( "| " + jQuery("#div1 p").eq(i).text().trim().replace(/\n+/gim,"").replace(/\s+/gim, ' ') + "\n" );
			str += ( "| " + jQuery("#div2 p").eq(i).text().trim().replace(/\n+/gim,"").replace(/\s+/gim, ' ') + "\n" );
			str += "\n";
	}; 
	str += "|-\n|}\n";
	console.log(str);

}