Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name prohardver.hu : forum : hotkeys in editor
- // @namespace http://www.prohardver.hu/
- // @include http://www.prohardver.hu/muvelet/*
- // @include http://prohardver.hu/muvelet/*
- // @include http://www.mobilarena.hu/muvelet/*
- // @include http://mobilarena.hu/muvelet/*
- // @include http://www.logout.hu/muvelet/*
- // @include http://logout.hu/muvelet/*
- // @include http://www.itcafe.hu/muvelet/*
- // @include http://itcafe.hu/muvelet/*
- // @include http://www.gamepod.hu/muvelet/*
- // @include http://gamepod.hu/muvelet/*
- // @include http://www.bitmarket.hu/muvelet/*
- // @include http://bitmarket.hu/muvelet/*
- // @include http://www.hardverapro.hu/muvelet/*
- // @include http://hardverapro.hu/muvelet/*
- // @version 1.4
- // ==/UserScript==
- function event_handler()
- {
- var editor = document.evaluate("//textarea[@name=\"content\"]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
- if (editor == null)
- return;
- var buttons = document.evaluate("//input", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
- var is_comment = buttons.snapshotItem(0).type == "radio";
- var n = is_comment ? 2 : 0;
- var hotkeys =
- {
- "ctrl-enter" : buttons.snapshotItem(n++), // send comment
- //"ctrl-s" : ":)",
- //"ctrl-x" : function() { window.alert("pressed"); },
- "ctrl-b" : buttons.snapshotItem(n++), // bold
- "ctrl-i" : buttons.snapshotItem(n++), // italic
- "ctrl-u" : buttons.snapshotItem(n++), // underlined
- "ctrl-s" : buttons.snapshotItem(n++), // strike-through
- "ctrl-o" : buttons.snapshotItem(n++), // off topic
- "ctrl-k" : buttons.snapshotItem(n++), // link
- "ctrl-g" : buttons.snapshotItem(n++), // image
- "ctrl-d" : buttons.snapshotItem(n++), // code
- "ctrl-m" : buttons.snapshotItem(n++), // monospace
- "ctrl-w" : buttons.snapshotItem(n++), // raw
- "ctrl-p" : buttons.snapshotItem(n++), // paragraph
- "ctrl-l" : buttons.snapshotItem(n++), // left-aligned
- "ctrl-r" : buttons.snapshotItem(n++), // right-aligned
- "ctrl-e" : buttons.snapshotItem(n++), // centered
- "ctrl-j" : buttons.snapshotItem(n++) // justified
- };
- if (is_comment)
- {
- hotkeys["ctrl-alt-n"] = buttons.snapshotItem(0); // normal comment
- hotkeys["ctrl-alt-o"] = buttons.snapshotItem(1); // off-topic comment
- }
- keylib_initialize(editor, hotkeys);
- }
- if (document.body)
- event_handler();
- else
- window.addEventListener("load", event_handler, false);
- //////////////////////////////////////////
- // 1.4 keylib
- // 1.3 FF4 kompatibilitás
- // 1.2 Chrome kompatibilitás
- // 1.1 privát írásakor elcsúszott a billentyűkiosztás
- // 1.0 eredeti változat
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement