Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Szybka odpowiedź, [manual] - UserJS do Opery, a nuż się komuś przyda ;)
erix
post
Post #1





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




Jeśli kogoś męczy wklepywanie [manual ]funkcja[/manual ], to myślę, że ten skrypt się przyda. (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)

UserJS do Opery, dodaje nową (spartańską ;p) ikonkę do paska szybkiej odpowiedzi, Shift+esc i "1" też dodane, jak coś. Oczywiście, nie będzie pewnie problemu dostosować do Firefoksa, czy też zmienić klawisz. (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)

Kod
/**
* forum.php.pl quick response enhancement;)
* created by eRIZ (erix), http://eriz.pcinside.pl
*/
if( location.hostname.indexOf('forum.php.pl') != -1 ) {
    document.addEventListener('DOMContentLoaded', function(){

        var quickResponse = document.getElementById('fast-reply-controls');
        if(typeof(quickResponse)=='undefined'){
            return false;
        }

        var toolbar = quickResponse.getElementsByTagName('table')[0].getElementsByTagName('table')[0].getElementsByTagName('tr')[0];

        var td = document.createElement('td');
        var div = document.createElement('div');
        div.setAttribute('title', 'funkcja z manuala');
        div.setAttribute('id', 'manualAppend');
        div.onclick = function(e){

            e.preventDefault();

            var func = prompt('funkcja');
            if(func!=null && func!=''){
                var area = document.getElementById('fast-reply_textarea');
                var cS = area.value.substr(0, area.selectionStart);
                var cE = area.value.substr(area.selectionStart);

                area.value = cS+'[manual]'+func+'[/manual]'+cE;
                area.focus();
            }


        }

        var txt = document.createTextNode('manual');
        div.appendChild(txt);

        td.appendChild(div);
        toolbar.appendChild(td);

        return true;

    }, false);

    document.addEventListener('load', function(){
        div = document.getElementById('manualAppend');
        div.setAttribute('accesskey', '1');
    }, false);
}


Instalacja - uaktywniamy UserJS w Operze, kopiujemy sobie powyższy skrypt do pliku. (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 17:01