ãã¤ã¼ã«ã¯ãªãã¯ã§ã¯ãªãããã¼ãã®å 容ãè²¼ãä»ãï¼ç¯å²é¸æãã¦ããå ´åã¯ä¸æ¸ãããï¼
ããã«ãã¦ã¹(middle mouse)ãããã«ã¯ãªãã¯(middle click)ãä¸ã¯ãªãã¯ããã¤ã¼ã«ã¯ãªãã¯(wheel click)ã«é¢ããã¨ã³ããªã¼ã
Firefoxã®æ©è½ã«ããã¤ã¼ã«ã¯ãªãã¯ã§ãã¼ã¹ãããããã便å©ãªã®ã§æè¿ä½¿ãå§ãããabout:configã§middlemouse.pasteãtrueã«ããã¨å©ç¨ã§ãããåèµ·åããªãã¦ãOKã
ã§ãããã®æ©è½ã«ã¯æ¬ ç¹ããããç¯å²é¸æããã¦ãããã¤ã¼ã«ã¯ãªãã¯ããã¦ãä¸æ¸ããããã«æ¿å
¥ããã¦ãã¾ãã
ãããuserChrome.jsãç¨ãã¦ä¿®æ£ããã
ã¶ãã¯ãªç¢ºèªããã¨ããFirefox 3.0.8ã¨3.1 Beta3ã¨Firefox 2ã¯ä¸è¨ã®æ®å¿µãªä»æ§ã
ã½ã¼ã¹ã³ã¼ã
// ==UserScript== // @name middleMousePaste // @namespace http://d.hatena.ne.jp/Cherenkov/ // @description enable overwrite. // @include chrome://browser/content/browser.xul // ==/UserScript== (function(){ if (gPrefService.getBoolPref("middlemouse.paste")) return alert("Please set a value.\nabout:config -> middlemouse.paste -> false"); window.addEventListener("click", function(event) { if (event.button == 1) { var target = event.target; var tagName = target.tagName; if (tagName) tagName = tagName.toLowerCase(); var type = target.type; if (type) type = type.toLowerCase(); if ((tagName == "input" && (type == "" || type == "text" || type == "password")) || tagName == "textarea" || tagName == "textbox" || tagName == "searchbar") { var front = target.value.substr(0,target.selectionStart); var back = target.value.substr(target.selectionEnd); var select = target.value.substring(target.selectionStart, target.selectionEnd); var clipbrd = readFromClipboard(); if(!clipbrd) clipbrd = ""; target.value = front + clipbrd + back; //modify caret position. target.selectionStart = target.selectionEnd = (front.length + clipbrd.length); } } }, true); //stop a scroll event. window.addEventListener("mousedown", function(event) { if (event.button == 1) { var target = event.target; var tagName = target.tagName; if (tagName) tagName = tagName.toLowerCase(); var type = target.type; if (type) type = type.toLowerCase(); if ((tagName == "input" && (type == "" || type == "text" || type == "password")) || tagName == "textarea" || tagName == "textbox") { event.stopPropagation(); } } }, true); })();
解説
- tagNameã¯å°æåã«ããã®ãå®ç³ããããHTMLã®textareaãXULã®textboxä¸ã§ã®ã¿å®è¡ãããããã«ãã¦ããã
- ã¯ãªãããã¼ããç»åãã¼ã¿ã®ã¿ã®å ´åã¯undefinedãè¿ã£ã¦ããã®ã§ç©ºç½ãããããã¨ã«ããã
- ã«ã¼ã½ã«ã®ãã¨ããã£ã¬ããã¨ããããããä¸æ¸ããã¼ã¹ãããã¨ãã£ã¬ãããçµç«¯ã«ç§»åãã¦ãã¾ãã®ãä¿®æ£ããã
- ãã¤ã¼ã«ãã¿ã³ãmousedownããæã«èµ·ããã¹ã¯ãã¼ã«ã¤ãã³ããstopPropagation()ã§åæ¢ãããã
ãã¦ã³ãã¼ã
middleMousePaste.uc.jsãï¼gist:90746ï¼
使ãæ¹
- userChrome.jsãã¤ã³ã¹ãã¼ã«ãâ簡単なインストール方法
- about:configã§middlemouse.pasteãfalseã«ãã¦ããã
- ãµãã¹ã¯ãªãããã¼ãã¼ã使ç¨ãã¦ãããªããmiddleMousePaste.uc.jsããã¦ã³ãã¼ããã¦userChrome.jsã¨åãå ´æã«å ¥ããã ãã
注æç¹
searchbar(Firefoxã¡ãã¥ã¼ - 表示 - ãã¼ã«ãã¼ - ã«ã¹ã¿ãã¤ãº - æ¤ç´¢ã®ãã¤)ã¯ããã®ã¹ã¯ãªãããå©ããä¸æ¸ããã¼ã¹ããã§ããªããæ¿å
¥ã¯å¯è½ã
ææ³
- middle mouseãmousedownããã¨ãã®ã¹ã¯ãã¼ã«ã¤ãã³ããå°å°ããã¨ãã«preventDefault()ã¨preventBubble()ã¯å¹æãç¡ãã£ãã
- ãã®ã¹ã¯ãªããã®å ´åãpreventDefault()ã¨ãremoveEventListenerããå¿ è¦ããï¼
- この人ã«ãä¼ãããã
firefox userChrome.js greasemonkeyï½½ï¾ 5
45 ï¼åç¡ãããï¼ ãè ¹ãã£ã±ããï¼sage ï¼2008/06/21(å) 14:12:42 id:ZwbS2zYX0
ããã¹ãé åã§ããã«ã¯ãªãã¯ããã¨ã, ã¯ãªãããã¼ãã®å 容ãè²¼ãä»ãã
user_pref("middlemouse.paste", true);ã¨ãããã¤ãªãã§ãããç¯å²é¸æãããã¨è²¼ãä»ãã§æ¿å ¥ã§ã¯ãªãä¸æ¸ãã«ãã¦ãããã¹ã¯ãªããã£ã¦ãªãã§ãããï¼
ãããããé¡ããã¾ãã
åèè³æ
- Middlemouse.paste - mozillaZineãabout:configã®middlemouse.pasteã®åºæ¬æ å ±
- middlemouse.pasteãtrueã«ããå ´åこれが動作してるã£ã½ãã