<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; JS+bookmarklet: Не получается внедрить код букмарклета в страницу.]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=6121&amp;type=atom" />
	<updated>2011-08-25T04:47:50Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=6121</id>
		<entry>
			<title type="html"><![CDATA[Re: JS+bookmarklet: Не получается внедрить код букмарклета в страницу.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50863#p50863" />
			<content type="html"><![CDATA[<p>Если вдруг кому то будет интересно.</p><p>Не стал заниматься модификацией кода, а просто сделал &quot;универсальный&quot; код, который мне подошел больше:<br /></p><div class="codebox"><pre><code>code = &#039;Код букмарклета&#039;
location.replace(code);</code></pre></div>]]></content>
			<author>
				<name><![CDATA[DnsIs]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26282</uri>
			</author>
			<updated>2011-08-25T04:47:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50863#p50863</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: JS+bookmarklet: Не получается внедрить код букмарклета в страницу.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50668#p50668" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Rumata пишет:</cite><blockquote><p>Код неполный. Проверьте на <a href="http://www.jsbeautifier.org/">http://www.jsbeautifier.org/</a> завершенность кода.</p></blockquote></div><p>Вот это дааа, вот это ссылку вы подкинули. Я даже и не подозревал что есть такая великолепная вещь. Благодарствую. Поклон вам. А код действительно не полный, скопировал с помощью IE, он порезал все.<br />Вот полный код, уже обработанный.<br /></p><div class="codebox"><pre><code>javascript: (function () {
    var isIe = false; /*@cc_on isIe=true; @*/


    function fe(a, fn) {
        var i, l = a.length;
        for (i = 0; i &lt; l; i) {
            fn(a[i]);
        }
    };

    function ae(el, n, fn, ix) {
        function wfn(ev) {
            var el = (isIe ? window.event.srcElement : ev.target);
            if (ix || !el.xmt) fn(el);
        }
        if (isIe) {
            n = &#039;on&#039;
            n;
            el.attachEvent(n, wfn);
        } else {
            el.addEventListener(n, wfn, false);
        }
        if (!el.es) el.es = [];
        el.es.push(function () {
            if (isIe) {
                el.detachEvent(n, wfn);
            } else {
                el.removeEventListener(n, wfn, false);
            }
        });
        el.re = function () {
            fe(el.es, function (f) {
                f()
            });
        };
    }
    function sce(el) {
        var oldclick = el.onclick,
            oldmu = el.onmouseup,
            oldmd = el.onmousedown;
        el.onclick = function () {
            return false;
        };
        el.onmouseup = function () {
            return false;
        };
        el.onmousedown = function () {
            return false;
        };
        el.rce = function () {
            el.onclick = oldclick;
            el.onmouseup = oldmu;
            el.onmousedown = oldmd;
        };
    }
    if (!window.r_) window.r_ = [];
    var r = window.r_;
    var D = document;
    ae(D.body, &#039;mouseover&#039;, function (el) {
        el.style.backgroundColor = &#039;#ffff99&#039;;
        sce(el)
    });
    ae(D.body, &#039;mouseout&#039;, function (el) {
        el.style.backgroundColor = &#039;&#039;;
        if (el.rce) el.rce();
    });
    ae(D.body, &#039;click&#039;, function (el) {
        el.style.display = &#039;none&#039;;
        r.push(el);
    });

    function ac(p, tn, ih) {
        var e = D.createElement(tn);
        if (ih) e.innerHTML = ih;
        p.appendChild(e);
        return e;
    }
    var p = 0;
    var bx = ac(D.body, &#039;div&#039;);
    bx.style.cssText = &#039;position:&#039; (isIe ? &#039;absolute&#039; : &#039;fixed&#039;)&#039;;padding:2px;background-color:#99FF99;border:1px solid green;z-index:9999;font-family:sans-serif;font-size:10px&#039;;

    function sp() {
        bx.style.top = (p &amp; 2) ? &#039;&#039; : &#039;10px&#039;;
        bx.style.bottom = (p &amp; 2) ? &#039;10px&#039; : &#039;&#039;;
        bx.style.left = (p &amp; 1) ? &#039;&#039; : &#039;10px&#039;;
        bx.style.right = (p &amp; 1) ? &#039;10px&#039; : &#039;&#039;;
    }
    sp();
    var ul = ac(bx, &#039;a&#039;, &#039; Undo |&#039;);
    ae(ul, &#039;click&#039;, function () {
        var e = r.pop();
        if (e) e.style.display = &#039;&#039;;
    }, true);
    var ual = ac(bx, &#039;a&#039;, &#039; Undo All |&#039;);
    ae(ual, &#039;click&#039;, function () {
        var e;
        while (e = r.pop()) e.style.display = &#039;&#039;;
    }, true);
    var ml = ac(bx, &#039;a&#039;, &#039; Move |&#039;);
    ae(ml, &#039;click&#039;, function () {
        p;
        sp();
    }, true);
    var xl = ac(bx, &#039;a&#039;, &#039; Exit &#039;);
    ae(xl, &#039;click&#039;, function () {
        D.body.re();
        bx.parentNode.removeChild(bx);
    }, true);
    fe([bx, ul, ml, xl, ual], function (e) {
        e.style.cursor = &#039;pointer&#039;;
        e.xmt = 1;
    });
})()</code></pre></div><p>Пойду экспериментировать.</p>]]></content>
			<author>
				<name><![CDATA[DnsIs]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26282</uri>
			</author>
			<updated>2011-08-15T16:45:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50668#p50668</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: JS+bookmarklet: Не получается внедрить код букмарклета в страницу.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50652#p50652" />
			<content type="html"><![CDATA[<p>Код неполный. Проверьте на <a href="http://www.jsbeautifier.org/">http://www.jsbeautifier.org/</a> завершенность кода.</p>]]></content>
			<author>
				<name><![CDATA[Rumata]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24846</uri>
			</author>
			<updated>2011-08-15T11:41:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50652#p50652</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[JS+bookmarklet: Не получается внедрить код букмарклета в страницу.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50651#p50651" />
			<content type="html"><![CDATA[<p>Доброго дня.<br />Такая вот проблема. Есть букмарклет готовый:</p><div class="codebox"><pre><code>javascript:(function(){var%20isIe=false;/*@cc_on%20isIe=true;%20@*/function%20fe(a,fn){var%20i,l=a.length;for(i=0;i&lt;l;i++){fn(a[i]);}};function%20ae(el,n,fn,ix){function%20wfn(ev){var%20el=(isIe?window.event.srcElement:ev.target);if(ix%20||%20!el.xmt)%20fn(el);}if%20(isIe){n=&#039;on&#039;%20+%20n;el.attachEvent(n,%20wfn);}%20else%20{el.addEventListener(n,%20wfn,%20false);}if(!el.es)el.es=[];el.es.push(function(){if(isIe){el.detachEvent(n,wfn);}%20else%20{el.removeEventListener(n,%20wfn,%20false);}});el.re=function(){fe(el.es,function(f){f()});};}function%20sce(el){var%20oldclick=el.onclick,oldmu=el.onmouseup,oldmd=el.onmousedown;el.onclick=function(){return%20false;};el.onmouseup=function(){return%20false;};el.onmousedown=function(){return%20false;};el.rce=function(){el.onclick=oldclick;el.onmouseup=oldmu;el.onmousedown=oldmd;};}if%20(!window.r_)window.r_=[];var%20r=window.r_;var%20D=document;ae(D.body,&#039;mouseover&#039;,%20function(el){el.style.backgroundColor=&#039;#ffff99&#039;;%20sce(el)});ae(D.body,&#039;mouseout&#039;,%20%20function(el){el.style.backgroundColor=&#039;&#039;;if(el.rce)el.rce();});ae(D.body,&#039;click&#039;,%20%20%20%20%20function(el){el.style.display=&#039;none&#039;;%20r.push(el);});function%20ac(p,tn,ih){var%20e=D.createElement(tn);if(ih)e.innerHTML=ih;p.appendChild(e);return%20e;}var%20p=0;var%20bx=ac(D.body,&#039;div&#039;);bx.style.cssText=&#039;position:&#039;+(isIe?&#039;absolute&#039;:&#039;fixed&#039;)+&#039;;padding:2px;background-color:#99FF99;border:1px%20solid%20green;z-index:9999;font-family:sans-serif;font-size:10px&#039;;function%20sp(){bx.style.top=(p&amp;2)?&#039;&#039;:&#039;10px&#039;;bx.style.bottom=(p&amp;2)?&#039;10px&#039;:&#039;&#039;;bx.style.left=(p&amp;1)?&#039;&#039;:&#039;10px&#039;;bx.style.right=(p&amp;1)?&#039;10px&#039;:&#039;&#039;;}sp();var%20ul=ac(bx,&#039;a&#039;,&#039;%20Undo%20|&#039;);ae(ul,&#039;click&#039;,function(){var%20e=r.pop();%20if(e)e.style.display=&#039;&#039;;},%20true);var%20ual=ac(bx,&#039;a&#039;,&#039;%20Undo%20All%20|&#039;);ae(ual,&#039;click&#039;,function(){var%20e;while(e=r.pop())e.style.display=&#039;&#039;;},%20true);var%20ml=ac(bx,&#039;a&#039;,&#039;%20Move%20|&#039;);ae(ml,&#039;click&#039;,function(){p++;sp();},%20true);var%20xl=ac(bx,&#039;a&#039;,&#039;%20Exit%20&#039;);ae(xl,&#039;click&#039;,function(){D.body.re();bx.parentNode.removeChild(bx);},%20true);fe([bx,ul,ml,xl,ual],function(e){e.style.curs</code></pre></div><p>Хочу его вставить в свой скрипт. Как сделать сие действо? Видится мне, что что работает этот шайтан-код при нажатии хоткея.<br />Помогите пожалуйста.</p>]]></content>
			<author>
				<name><![CDATA[DnsIs]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26282</uri>
			</author>
			<updated>2011-08-15T10:52:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50651#p50651</id>
		</entry>
</feed>
