pagehack.js

  ブックマークレットよりロードされる .js ファイル



本体画面をペースに window.open されたウインドウに対して、スクリプトエレメントを document.write する事によって、開かれたウインドウに .js ファイルをロードしています。

内部から画面部分は document.write で作成します。

//document.charset = 'shift_jis';

document.getElementById("area").style.fontFamily = 'MS ゴシック';
document.getElementById("area").style.fontSize = '12px';
//document.getElementById("area").value = opener.document.body.innerHTML;

style = document.styleSheets;
if (window.navigator.userAgent.toLowerCase().indexOf("msie") > -1) {
	document.styleSheets[0].addRule("H1", "font-family:'MS Pゴシック';font-size: 12px;border-style: solid;border-width: 1px;border-color: #9192A3;padding: 7px 0px 8px 13px;background: url( http://winofsql.jp/image/h1.png ) repeat-x 0px 0px;");
	document.styleSheets[0].addRule("BODY", "background-color:#C5D1A5;");
}
else {
	document.styleSheets[0].insertRule("H1 {font-family:'MS Pゴシック';font-size: 12px;border-style: solid;border-width: 1px;border-color: #9192A3;padding: 7px 0px 8px 13px;background: url( http://winofsql.jp/image/h1.png ) repeat-x 0px 0px;}",0);
	document.styleSheets[0].insertRule("BODY {background-color:#C5D1A5;}",0);
}



html="<H1>Page Hacker (&#87;&#69;&#66;&#12506;&#12540;&#12472;&#35519;&#26619;&#25903;&#25588;)</H1>";
html+="<table><tr>";
html+="<td><input type=button value='body' style='vertical-align:middle;width:70px;' onClick='dispBody();'> / ";
html+="<input type=button value='head' style='vertical-align:middle;width:50px;' onClick='dispHead();'>";
html+="<input type=button value='css' style='vertical-align:middle;width:50px;' onClick='dispCss();'> / ";
html+="<input type=button value='A' style='vertical-align:middle;width:20px;' onClick='dispA();'> / ";
html+="<input type=button value='A+text' style='vertical-align:middle;width:50px;' onClick='dispA2();'> / ";
html+="<input type=button value='&#12362;&#27671;&#12395;&#20837;&#12426;&#12395;&#30331;&#37682;&#12377;&#12427;&#12467;&#12540;&#12489;' style='vertical-align:middle;width:180px;' onClick='dispFav();'>";
if (window.navigator.userAgent.toLowerCase().indexOf("firefox") <= -1) {
	html+="<input type=button value='&#70;&#105;&#114;&#101;&#98;&#117;&#103;&#32;&#76;&#105;&#116;&#101;&#12434;&#38283;&#12367;' style='vertical-align:middle;width:130px;' onClick='dispFirebug();'>";
}
html+="</td></tr><tr><td>";
html+="<input type=button value='&#8595;&#12463;&#12522;&#12483;&#12503;&#12508;&#12540;&#12489;&#12408;&#12467;&#12500;&#12540;' style='vertical-align:middle;width:150px;' onClick='CopyClip();'> / ";
html+="<input type=button value='&#12479;&#12452;&#12488;&#12523;&#12467;&#12500;&#12540;' style='vertical-align:middle;width:150px;' onClick='copyTitle();'> / ";
html+="</td></tr></table>";
if (window.navigator.userAgent.toLowerCase().indexOf("msie") <= -1) {
	html+="<OBJECT \n";
	html+="	id=\"flash1\" \n";
	html+="	classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" \n";
	html+="	width=0 \n";
	html+="	height=0 \n";
	html+="> \n";
	html+="	<PARAM name=\"movie\" value=\"http://homepage2.nifty.com/lightbox/setClipboard.swf\"> \n";
	html+="	<PARAM name=\"allowScriptAccess\" value=\"always\"> \n";
	html+=" \n";
	html+="	<EMBED \n";
	html+="		id=\"flash2\" \n";
	html+="		name=\"utilWeblog\" \n";
	html+="		swliveconnect=\"true\" \n";
	html+="		src=\"http://homepage2.nifty.com/lightbox/setClipboard.swf\" \n";
	html+="		allowScriptAccess=\"always\" \n";
	html+="		width=0 \n";
	html+="		height=0 \n";
	html+="		type=\"application/x-shockwave-flash\" \n";
	html+="	> \n";
	html+="</OBJECT> \n";
	html+=" ";
}

document.getElementById("cont").innerHTML = html;

function dispHead() {
	document.getElementById("area").value = opener.document.getElementsByTagName("HEAD")[0].innerHTML;
}
function dispBody() {
	document.getElementById("area").value = opener.document.body.innerHTML;
}
function dispFav() {
	document.getElementById("area").value = "javascript: var wnd=window.open('','_blank','width=700,height=600,location=0,resizable=1,menubar=0,scrollbars=0,status=1');wnd.document.write('<style>body{ margin:0; }</style><div id=cont style=\"height:100px;\"></div><textarea readonly id=area style=\"width:100%;height:300px;\"></textarea><script src=\"http://winofsql.jp/pagehack.js\"></script>');wnd.document.close();";
}
function dispFirebug() {
	console.open();
}
function copyTitle() {
   var str = "%E3%82%BF%E3%82%A4%E3%83%88%E3%83%AB%E3%82%92%E3%82%AF%E3%83%AA%E3%83%83%E3%83%97%E3%83%9C%E3%83%BC%E3%83%89%E3%81%B8%E3%82%B3%E3%83%94%E3%83%BC%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F";
   if (window.navigator.userAgent.toLowerCase().indexOf("msie") > -1) {
	window.clipboardData.setData(
		 "Text", opener.document.title
	);
	alert( decodeURIComponent(str) );
   }
   else {
	try {
		setClipboard( opener.document.getElementsByTagName("TITLE")[0].text );
		alert( decodeURIComponent(str) );
	}
	catch(e) {
	}
   }
}

function dispA() {
	__target = null;
	str = "";
	__target = opener.document.getElementsByTagName("A");
	len = __target.length;
	for (j = 0; j < len; j++) {
	    str += __target[j] + "\n";
	}
	document.getElementById("area").value = str;
}
function dispA2() {
	__target = null;
	str = "";
	__target = opener.document.getElementsByTagName("A");
	len = __target.length;
	for (j = 0; j < len; j++) {
	    str += __target[j].innerHTML + "\t\n";
	    str += __target[j] + "\n";
	}
	document.getElementById("area").value = str;
}

function dispCss() {
	style = null;
	rule = null;
	len = 0;
	str = "";
	work = null;
	style = opener.document.styleSheets;
	for (j = 0; j < style.length; j++) {
		if (window.navigator.userAgent.toLowerCase().indexOf("msie") > -1) {
		    rule = style[j].rules;
		}
		else {
			rule = style[j].cssRules
		}
	    len = rule.length;
	    for (i = 0; i < len; i++) {
	        str += rule[i].selectorText + "\n--------------------\n";
			try {
		        work = (rule[i].style.cssText).split(";");
		        for (k = 0; k < work.length; k++) {
		            str += (work[k] + ";\n");
		        }
		        str += "--------------------\n";
			}
			catch(e) {
			}
	    }
	}
	document.getElementById("area").value = str;
//	window.clipboardData.setData("Text", str);
//	alert("↓cssの一覧をコピーしました   %5Cn%5Cn" + str);
}
function CopyClip( ) {

	if (window.navigator.userAgent.toLowerCase().indexOf("msie") > -1) {
		window.clipboardData.setData(
			 "Text", document.getElementById("area").value
		);
	}
	else {
		setClipboard( document.getElementById("area").value );
	}

	alert( decodeURIComponent("%E3%82%AF%E3%83%AA%E3%83%83%E3%83%97%E3%83%9C%E3%83%BC%E3%83%89%E3%81%B8%E3%82%B3%E3%83%94%E3%83%BC%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F") );

}
function setClipboard( strValue ) {

	var obj;

	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		obj = document.getElementById("flash1");
	}
	else {
		obj = document.getElementById("flash2");
	}

	obj.setClipboard(strValue);

}


obj = document.createElement("script");
obj.setAttribute("type", "text/javascript");
obj.src = "http://homepage2.nifty.com/lightbox/firebug_hack/firebug.js"
document.getElementsByTagName("HEAD")[0].appendChild(obj);

if (window.navigator.userAgent.toLowerCase().indexOf("firefox") > -1) {
	alert(decodeURIComponent("firefox%E3%81%A7%E8%B5%B7%E5%8B%95%E3%81%97%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99%E3%81%AE%E3%81%A7firebug%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E8%A6%AA%E3%82%A6%E3%82%A4%E3%83%B3%E3%83%89%E3%82%A6%E3%82%92%E5%8F%82%E7%85%A7%E3%81%97%E3%81%A6%E4%B8%8B%E3%81%95%E3%81%84\n%E3%81%9D%E3%81%AE%E5%A0%B4%E5%90%88%E3%80%81opener%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B%E3%81%A8%E5%8F%82%E7%85%A7%E3%81%A7%E3%81%8D%E3%81%BE%E3%81%99"))
}











  infoboard   管理者用   
このエントリーをはてなブックマークに追加





フリーフォントWEBサービス
SQLの窓WEBサービス

SQLの窓フリーソフト

素材

一般WEBツールリンク

SQLの窓

フリーソフト

JSライブラリ