From Design pattern
Revision as of 17:28, 30 May 2014 by Sungikim (Talk | contribs)

Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Clear the cache in Tools → Preferences
$("#mw-content-text h3").each(function(){

$(this).wrap("<div class=example></div>");
var ex_div=$(this).closest("DIV");
//ex_div.css("border","1px solid red");
//console.log(ex_div);
while(ex_div.next().length && !ex_div.next().prop("tagName").match(/h3|h2|div/i)){
	nextobj=ex_div.next();
	//console.log(nextobj.prop("tagName"));
ex_div.append(nextobj);
}

});

$("div.example").each(function(){

var video=$("iframe,object",this);
if(video.length){
	//console.log(video.eq(0),video.eq(0).prop("clientWidth"));
if(video.eq(0).prop("clientWidth")<=300){
	video.insertAfter($("h3",this));
	$(this).css("width",300).css("float","left").css("margin","0 30px 0 0");

	//console.log($(this).next().prop("className"));
	if($(this).next().prop("className")!="example") $(this).after("<br clear=both>");
}else {
$(this).before("<br clear=both>");

}
}

});