CSSを手軽に追加するブックマークレット(IE6対応) edo_m18 Follow 2010-08-14 01:19:34 License: MIT License Fork9 Fav5 View19701 Play Stop Reload Fullscreen Smart Phone Fork tree Readme JavaScript 0 lines HTML 38 lines CSS 2 lines CSSを手軽に追加するブックマークレット(IE6対応) <p>CSSの記法で、ちょっとしたスタイルを見ているサイトに追加するブックマークレット。</p> <p><em>ちょっと内容を変更しました。WebKitでも動きます。</em></p> <p>使い方は通常のブックマークレットと同じで、下のリンクをお気に入りに登録してスタイルを追加したいサイトで実行してください。</p> <p> <a href="javascript:(function(t,b,s,c){if(!window.addCss){window.addCss={};}if(!window.addCss.cnt){window.addCss.css=document.createElement('style');window.addCss.css.type='text/css';document.getElementsByTagName('head')[0].appendChild(window.addCss.css);window.addCss.cnt=document.styleSheets.length-1;}t=document.createElement('textarea');t.setAttribute('style',['width:300px','height:80px','position:fixed','right:0','top:10px','z-index:1000'].join(';'));b=document.createElement('input');b.type='button';b.value='Add';b.setAttribute('style',['position:fixed','right:15px','top:95px','z-index:1000'].join(';'));b.onclick=function(){window.addCss.css.appendChild(document.createTextNode(t.value));document.body.removeChild(t);document.body.removeChild(b);};document.body.appendChild(t);document.body.appendChild(b);})();">Add Style</a> </p> <p>IE用のものも作ってみました</p> <p><a href="javascript:(function(t,b,db){t.style.cssText='width:300px;height:150px;position:absolute;right:0;top:0;z-index:1000;';b.type='button';b.value='Add';b.style.cssText='position:absolute;right:0;top:155px;z-index:1000;';b.onclick=function(){if(t.value){document.createStyleSheet().cssText=t.value;}db.removeChild(t);db.removeChild(b);};db.appendChild(t);db.appendChild(b);})(document.createElement('textarea'),document.createElement('input'),document.body);">Add Style for IE</a></p> <p>ミニファイ前のも置いときます</p> <pre> (function(t,b,s,c){ if(!window.addCss){window.addCss={};} if(!window.addCss.cnt){ window.addCss.css=document.createElement('style'); window.addCss.css.type='text/css'; document.getElementsByTagName('head')[0].appendChild(window.addCss.css); window.addCss.cnt=document.styleSheets.length-1; } t=document.createElement('textarea'); t.setAttribute('style',['width:300px','height:80px','position:fixed','right:0','top:10px','z-index:1000'].join(';')); b=document.createElement('input'); b.type='button'; b.value='Add'; b.setAttribute('style',['position:fixed','right:15px','top:95px','z-index:1000'].join(';')); b.onclick=function(){ window.addCss.css.appendChild(document.createTextNode(t.value)); document.body.removeChild(t); document.body.removeChild(b); } document.body.appendChild(t); document.body.appendChild(b); })(); </pre> CSSを手軽に追加するブックマークレット(IE6対応) body { background-color: #DDDDDD; font: 12px sans-serif; } em { font-style: normal; font-weight: bold;} <p>CSSの記法で、ちょっとしたスタイルを見ているサイトに追加するブックマークレット。</p> <p><em>ちょっと内容を変更しました。WebKitでも動きます。</em></p> <p>使い方は通常のブックマークレットと同じで、下のリンクをお気に入りに登録してスタイルを追加したいサイトで実行してください。</p> <p> <a href="javascript:(function(t,b,s,c){if(!window.addCss){window.addCss={};}if(!window.addCss.cnt){window.addCss.css=document.createElement('style');window.addCss.css.type='text/css';document.getElementsByTagName('head')[0].appendChild(window.addCss.css);window.addCss.cnt=document.styleSheets.length-1;}t=document.createElement('textarea');t.setAttribute('style',['width:300px','height:80px','position:fixed','right:0','top:10px','z-index:1000'].join(';'));b=document.createElement('input');b.type='button';b.value='Add';b.setAttribute('style',['position:fixed','right:15px','top:95px','z-index:1000'].join(';'));b.onclick=function(){window.addCss.css.appendChild(document.createTextNode(t.value));document.body.removeChild(t);document.body.removeChild(b);};document.body.appendChild(t);document.body.appendChild(b);})();">Add Style</a> </p> <p>IE用のものも作ってみました</p> <p><a href="javascript:(function(t,b,db){t.style.cssText='width:300px;height:150px;position:absolute;right:0;top:0;z-index:1000;';b.type='button';b.value='Add';b.style.cssText='position:absolute;right:0;top:155px;z-index:1000;';b.onclick=function(){if(t.value){document.createStyleSheet().cssText=t.value;}db.removeChild(t);db.removeChild(b);};db.appendChild(t);db.appendChild(b);})(document.createElement('textarea'),document.createElement('input'),document.body);">Add Style for IE</a></p> <p>ミニファイ前のも置いときます</p> <pre> (function(t,b,s,c){ if(!window.addCss){window.addCss={};} if(!window.addCss.cnt){ window.addCss.css=document.createElement('style'); window.addCss.css.type='text/css'; document.getElementsByTagName('head')[0].appendChild(window.addCss.css); window.addCss.cnt=document.styleSheets.length-1; } t=document.createElement('textarea'); t.setAttribute('style',['width:300px','height:80px','position:fixed','right:0','top:10px','z-index:1000'].join(';')); b=document.createElement('input'); b.type='button'; b.value='Add'; b.setAttribute('style',['position:fixed','right:15px','top:95px','z-index:1000'].join(';')); b.onclick=function(){ window.addCss.css.appendChild(document.createTextNode(t.value)); document.body.removeChild(t); document.body.removeChild(b); } document.body.appendChild(t); document.body.appendChild(b); })(); </pre> body { background-color: #DDDDDD; font: 12px sans-serif; } em { font-style: normal; font-weight: bold;} use an iframe compat browser, deer Play on jsdo.it games Author Share ブログに埋め込む QR Tag Download Complete! Description What kind of game? Control Device Smartphone Controllerjsdo.it WebSocket Controller» Mouse Keyboard Touch Device Fullscreen Activated Inactivated jsdo.it games から削除する Submit Author edo_m18 URLhttp://css-eblog.com CSS-EBLOGの管理人やってます。 Tweet Default Panel Auto play Screenshot Readme JavaScript HTML CSS Size Width: px Height: px code <script type="text/javascript" src="http://jsdo.it/blogparts/sk05/js"></script> add bookmarklet css Firefox WebKit Discussion Questions on this code? Tags Firefox WebKit add application bookmarklet css debug ie library&test Favorite by sw_lucchini fingaholic kamem kinopyo: iecssdebug nekomeg: bookmarklet Forked sort by latest page views favorite forked forked: CSSを手軽に追加するブックマークレット(I teetteet 00 365 2/38/2 Firefox WebKit add bookmarklet css forked: CSSを手軽に追加するブックマークレット(I kazunoko 10 1045 2/38/2 Firefox WebKit add bookmarklet css forked: CSSを手軽に追加するブックマークレット(I Atsushi.Kinj 00 1058 2/38/2 Firefox WebKit add bookmarklet css forked from: CSSを手軽に追加するブックマーク higaaaaaaaaa 00 971 2/38/2 Firefox WebKit add bookmarklet css 1 2 3NEXT>>