ãã®ããã°è¨äºã¯ KMCã¢ããã³ãã«ã¬ã³ãã¼2015 ã®5æ¥ç®ã®è¨äºã§ãã
ã¡ãªã¿ã«æ¨æ¥ã®è¨äºã¯ id:hnagamin ã® 好きなSCP-JPの紹介 - hnagamin ã§ããã
ãµã¼ã¯ã«ã®äººãã¡æè¿ãã£ã¨SCPã®è©±ãã¦ã¦ãscp
ã£ã¦è²ã
ãããã ãªãã¨æã£ã¦ããã®ããå®ã¯ãããã話ã¨ã¯éã£ãã¨ãããã¨ãçºè¦ãã¦è¯ãã£ãã§ãã
ä»ã¾ã§ã®ãã©ã¦ã¶æ¡å¼µã«ã¤ãã¦
ãã©ã¦ã¶æ¡å¼µã¨ããã°çãããä¸åº¦ãããã¯æ¸ãããã¨ããã®ã§ã¯ãªãã§ããããã
ä»ã¾ã§ã¯ãã©ã¦ã¶ã§ããããå®è£ æ¹æ³ã«éãããã£ã¦ãã£ã¨ã¾ã¨ããã¨å¤§ä½ãããªæãã§ãã
- Google Chrome ã Opera
- HTML+JS+CSSã§æ¯è¼çã«ã³ã¿ã³ã«æ¸ããã
- Chrome: http://developer.chrome.com/extensions/
- Opera: https://dev.opera.com/extensions/
- APIã¯ã»ã¼ä¸ç·ã ãå¾®å¦ã«å·®åãããã https://dev.opera.com/extensions/apis/
- Safari
- åããHTML+JS+CSSã ãã©ãBlinkã¨ã¯APIãçµæ§éã
- https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/Introduction/Introduction.html
- Firefox
- XUL + XPCOMãç¨ããéçºã
- Addon-SDKãç¨ããéçºã(crx / jpm)
- éå»ã«ã¹ã©ã¤ããä½ãã¾ããã Firefox Add-on SDK 入門
Mozilla Firefoxã¯æè¿Addon-SDKããªãªã¼ã¹ããXULãªã©ã§ã®éçºããæ§Jetpackãå©ç¨ããéçºã¸ã¨ç§»è¡ãéå§ããFirefox 38ããã¯ãã«ããã¼ã«ç¾¤ãnodeJSã§å®è£ ããããã®ãå©ç¨å¯è½ã«ãªãã¾ããã*1
ãããªãããªã§åä½æãæãã«ãã©ã¦ã¶æ¡å¼µã®å®è£ ãä½ã£ã¦ããããã§ããã
WebExtensionã£ã¦ä½ï¼
- Firefox アドオン開発の未来 | Mozilla Developer Street (modest)
- The Future of Developing Firefox Add-ons | Mozilla Add-ons Blog
- Mozilla、「Firefox」のアドオンを「Google Chrome」互換の“WebExtensions”へ - 窓の杜
ã¨ã¾ãããã¾ã§æ¥ã¦ããããã£ã¦ã¿ãã¨Firefoxã§æä¾ããã¦ããAdd-onã¨åçã®ãã®ãChromeãªã©ã«ãæä¾ããã¦ããä¸ã§ãAdd-onSDKãæ¼ãé²ããã®ã§ã¯ãªãWebExtensionã¨ãã¦å ±éã®APIãå©ç¨ã§ããããã«ãããã¨ã§Blinkåãã«æ¸ããããã©ã¦ã¶æ¡å¼µãFirefoxã§ãç°¡åã«åãããããã«ãããã¨ãã話ã§ããFirefoxçã«ã¯ãã«ãããã»ã¹ã®è©±ã¨ããããã®ã§ãããããã§ã¯ããã¾ã触ããªãã®ã§ä¸è¨ã®ãªã³ã¯å ãèªãã§ä¸ããã
ä»æ§çå®ã¨ããããã¨ãã話ã¯ãªãã¦ãã¨ããããã¯Firefoxå´ã§Chromeã®ããã¥ã¡ã³ããå®è£ ãåèã«åããããªæåãå®è£ ããã¨ãã話ã§ãã
Microsoft Edgeã«ã¤ã³ã¹ãã¼ã«å¯è½ã«ãªãExtensionãChrome Extensionã¨ã»ã¼åããã®ã«ãªãã¨ãã話ãããã®ã§ãä»åã®Chrome Extensionãã¼ã¹ã®WebExtensionãããã¡ã¯ãã¹ã¿ã³ãã¼ãã«ãªãããã§ãã
åãæ®æ®µã¯Chrome Extensionãããæ¸ãã¦ãã¦ã話é¡ã«ä¸ãã£ã¦ããå®æçã«è©±é¡å·¡åããã¦ããã®ã§ãç¶æ³ãç°¡åã«ã¾ã¨ãã¦ã¿ã¾ãã
ææ°æ å ±ãææ¡ããã人åãæ å ±
æ¥æ¬èªã§ã·ã¥ã·ã¥ãã¨é°å²æ°ãæ´ã¿ãã人ã¯ï¼ yoichiroããã®Chrome Extensions ããè¦ã WebExtensionsãã¾ã¨ã¾ã£ã¦ããæããªã®ã§ããããè¦ã¾ãããã
å®è£ ç¶æ³ããã°ãã©ãã¯ã®é°å²æ°ãæ´ã¿ãã人㯠Are we Web Extensions yet?ã¨ãããã¼ã¸ããã£ã¦ä¾¿å©ãªã®ã§ããããã§ããåç §ãã¹ãbugzillaã¸ã®ãªã³ã¯ããChromeããã¥ã¡ã³ãã»MDNã¸ã®ãªã³ã¯ãFirefoxã®å®è£ ã¸ã®ãªã³ã¯ãããã®ã§ãç¶æ³ã俯ç°ãããããã®ã«ã¯è¯ãã¨æãã¾ãã
Mozilla Wikiã«ãã·ã¥ãã¨éçºç¶æ³ãéçºãã¥ã¼ããªã¢ã«ãã¾ã¨ã¾ã£ã¦ãã¾ããã¨ãããããã®ãã¼ã¸ã«ç®ãéãã¨è¯ãã¨æãã¾ãã
https://wiki.mozilla.org/WebExtensions
MDNããã¥ã¡ã³ããæ´åä¸ã§ã¯ããã¾ãããçå®ã«å¢ãã¤ã¤ããã¾ããéçºãã¥ã¼ããªã¢ã«ãªã©ãããã®ã§ãæéããã人ã¯èªãã§ã¿ãã¨è¯ãã§ãããã
ãµãã¼ãå®äºã®APIã®ãªã¹ãã¯ããã«ããã¾ããã¡ã½ãããã¨ã«è¨è¿°ãããã®ã§ãèªèº«ã§å®è£ ãªã©ãããéã¯ãããåç §ãã¦å®è£ æ¸ã¿ã確èªããã¨åã§ãã
ãµã³ãã«ã³ã¼ããèªã¿æ¸ããã¦ã¿ã
æ¢ã«tabs
ãcontextMenus
ãbrowserAction
ãnotifications
ãªã©ã¯ããç¨åº¦ãµãã¼ãããã¦ããã®ã§ããããã®æ©è½ãå©ç¨ããæ¡å¼µæ©è½ãå®éã«éçºãããã¨ãå¯è½ã«ãªã£ã¦ãã¾ãã
ãµã³ãã«ã³ã¼ããGitHubã«å ¬éããã¦ããã®ã§ããããè¦ãã¦ã¿ããã¨ã«ãã¾ãã
0. ç°å¢æºå
WebExtensionã¯https://nightly.mozilla.org/ã¨https://www.mozilla.org/en-US/firefox/channel/#developerã§åãããã¨ãåºæ¥ã¾ãã
çãããã©ã¡ããã¯ã¤ã³ã¹ãã¼ã«ãã¦ããã¨æãã¾ãããã¾ã ã®äººã¯ã¤ã³ã¹ãã¼ã«ãã¦ãã ããã
ã¤ã³ã¹ãã¼ã«ãããèµ·åãã¦ãabout:configã«ç§»åãã¦ãxpinstall.signatures.required
ã®å¤ãfalse
ã«ãã¾ãã
1. ãµã³ãã«ãã¤ã³ã¹ãã¼ã«ãã¦ã¿ã
https://github.com/mdn/webextensions-examples ã®ã³ã¼ããåããã¦ã¿ã¾ãã
$ git clone [email protected]:mdn/webextensions-examples.git
$ cd webextensions-examples
æ¡å¼µæ©è½ã®ããã±ã¼ã¸ã³ã°ã¯zipå§ç¸®ãã¦æ¡å¼µåãxpiã«ããã°OKã§ããä¾ãã°ãnotify-link-clicks
ãã¤ã³ã¹ãã¼ã«ãã¦ã¿ãã¨ãããã¨ã«ãã¾ãã
$ cd notify-link-clicks
$ zip -r ../notify-link-clicks.xpi *
ããã§åºæ¥ãnotify-link-clicks.xpi
ãFirefoxã®about:addons
ã«ãã©ãã°ã¢ã³ããããããã¦install
ãã¿ã³ãã¯ãªãã¯ããã¨ã¤ã³ã¹ãã¼ã«ã§ãã¾ãã
notify-link-clicks
ã§background scriptãcontent scriptãnotificationãåããã¨ã確èªã§ãã¾ããuser-agent-rewriter
((ã¤ã³ã¹ãã¼ã«å¾ã« http://useragentstring.com/ ã«ã¢ã¯ã»ã¹ããã¨webRequest
ãå©ç¨ãã¦ã¦ã¼ã¶ã¼ã¨ã¼ã¸ã§ã³ããæ¸ãæãã£ã¦ããã¨ã確èªã§ãã¾ãããã®ãã¼ã¸ã§ããå¼ã°ããªãã®ã§æ³¨æ))ãªã©ã試ãã¨browser actionãåããã¨ã確èªã§ãã¾ãã
å®éã«ç§»æ¤ãã¦ã¿ã
æå¾ã«Chrome Extensionãå®éã«ç§»æ¤ãã¦ã¿ã¾ãã
Gyazo Extensionã移æ¤ãããã¨ãã£ã¬ã³ã¸ããã®ã§ãããchrome.tabs.captureVisibleTab
ã®ãµãã¼ããç¡ãã¦æ«æãã*2ã®ã§ãèªåã§éå»ã«ä½ã£ãgyoogleã¨ããã®ã移æ¤ãã¦ã¿ããã¨ã«ãã¾ãã
ãã㯠googleã®æ¤ç´¢çµæã表示ããã¨postMessage
ã§background scriptã«éä¿¡ãã¦ãããã§XHRã§Gyazoã®æ¤ç´¢çµæãåå¾ãã¦ãã¡ãã»ã¼ã¸ãcontent scirptã«è¿ãã¦çµæãæ¿å
¥ããã¨ãããã¤ã§ãã
ãã®æ¡å¼µæ©è½ã§ä½¿ã£ã¦ããAPIã¯Firefoxã®WebExtensionã§å®è£
ããã¦ããã®ã§ãmanifest.json
ã«ã¢ããªã±ã¼ã·ã§ã³æ
å ±ãè¨è¿°ããã ãã§OKã§ãã
WebExtensionã®manifest.json
ã¯Blinkã®ãã®ã¨éã£ã¦ãapplications
ãå¿
é ã§ãã
æä½éã®ãã®ã¯ãã®ãããªæãã§ãã
"applications": { "gecko": { "id": "[email protected]" } }
id
ã®ã¿å¿ é ã§ããè¨æ³ã¯ https://developer.mozilla.org/en-US/Add-ons/Install_Manifests#id ãåç §ãã¦ä¸ããã大æµã¯ä¸è¨ã®ããã«[email protected]
ã®å½¢å¼ã«ãªã£ã¦ããã°OKã§ãã- ä»ãå¿
è¦ã«å¿ãã¦
strict_min_version
ãstrict_max_version
ãªã©ãæå®ãããã¨ãåºæ¥ã¾ãã
å°æ¥çã«ã¯ããã§blink
ãã¼ã使ãã¦ãã¼ã¸ã§ã³æå®åºæ¥ãããã«ããã¨ãããã¨ãªã®ã ã¨æãã¾ãããBlinkã¯ãã®ãã¼ã«ç¾ç¶å¯¾å¿ãã¦ããªãã®ã§ããã®ã¾ã¾ã®manifest.jsonã§Chromeã«ã¤ã³ã¹ãã¼ã«ãããã¨ããã¨ããã®ãããªã¨ã©ã¼ãåºã¾ãã
ããã§ãã«ã(zipã«åºãã¦æ¡å¼µåã.xpi
ã«ãã)ãã¦ã¤ã³ã¹ãã¼ã«ããã¨ç¢ºãã«åãã¾ãããã§ããï¼
ä»å¾ã«ã¤ãã¦
- ãã¼ããããã¯ããã«ããã¾ãã2016å¹´ã®ä¸æ¬ãããã¾ã§ã«ã¯WebExtension1.0ã¨ãã¦ãªãªã¼ã¹ãããã¨ãç®æ¨ã¨ããã¦ãã¾ãã
- AMOã§ã®ãµãã¼ããããããã
- ç¾ç¶
chrome.*
ã®namespaceã§æä¾ãã¦ããAPIãbrowser.*
ã«ç§»è¡ãã¦ãæ¡å¼µåãzip
ã使ãããã- ããã¯æ¨æºåã®ããã§ãã
- Chromeãªã©ã«å®è£
ããã¦ããªãããFirefoxã®ããã¾ã§ã®å¯å®¹ãªAPIã§åãã¦ãã便å©ãªã¢ããªã³ã®ããã®APIã®æ¡å¼µãææ¡ã¯ããã¦ãã¾ãã
- https://wiki.mozilla.org/WebExtensions#Additional_APIs
- çµå±ããããã£ã¦ãã¾ãã¨å·®åãåã¾ããªãã®ã§ã¯ã»ã»ã»
- æ¤è¨ããã¦ãããã®
- Sidebaré¢ä¿ (Chromeã§ã¯å®è£ ããã¦ãªãããOperaã§ã¯å®è£ æ¸)
- åªããã·ã§ã¼ãã«ãããã¼ãµãã¼ã (Vimperatorã®ãããªãã®ãå®è£ å¯è½ã«ãããã)
- tabé¢ä¿ã®æä½ (Tab Mix Plus)
- ãã¼ã«ãã¼é¢ä¿ (ä»ã¾ã§ã®å種ãã¼ã«ãã¼ã¢ããªã³ã®ãããªãã®ãå®è£ ã§ããããã«ï¼
ã¾ã¨ã
ä»å®éã«FirefoxãChromeã§æ¡å¼µæ©è½ããªãªã¼ã¹ããå ´åã¯Add-onSDKãå©ç¨ãã¦ãè³ç£ã¯ãã¾ã使ãã¾ãããªãã®ã§ãWebExtensionã®å®è£ ã¯æ©ãé²ãã§æ¬²ããã¨ããæãã§ãããæå¾ã®ã¨ããã«æ¸ããã¦ãããããªæãã®ãå®è£ ãããã¨ãããã¯Blinkç³»ã§ã¯åããªããªã£ã¦ãã¾ãã®ã§ãããã¯ããã§ã©ããªãã ããã¨æãã¾ãããChromeãªã©ã«ããµã¤ããã¼ã¯æ¬²ããã®ã§åä½é å¼µã£ã¦æ¬²ããã§ãã
APIããæºåãããã°ãã»ã¨ãã©æãå ¥ãããã¨ç¡ãChromeæ¡å¼µãFirefoxã§åãããã«åºæ¥ãã®ã§ã¿ãªããã試ãã¦ã¿ã¦ãã ããã
諸ã æ°ã«ãªã人㯠https://wiki.mozilla.org/WebExtensions ãã辿ããå種ãã°ãã©ãã¯ã追ãããã¦ã¿ã¦ãã ããã
- https://bugzilla.mozilla.org/show_bug.cgi?id=1214433
- https://bugzilla.mozilla.org/buglist.cgi?resolution=---&query_format=advanced&component=WebExtensions&product=Toolkit&list_id=12695583
- https://bugzilla.mozilla.org/buglist.cgi?list_id=12592201&o1=anywords&v1=dev-doc-needed&f1=keywords&query_format=advanced&component=WebExtensions&product=Toolkit
ãã®ããã°è¨äºã¯ KMCã¢ããã³ãã«ã¬ã³ãã¼2015 ã®5æ¥ç®ã®è¨äºã§ããã
ææ¥6æ¥ç®ã¯ @dnek_ ããã®ãUnambiSweeperã¨ããandroidã¢ããªä½ã£ãã®ã§ãã®è¾ºã®ä½ããã§ãã
彼㯠マインスイーパー雑感 - KMC活動ブログ ã¨ãã§ããã¤ã³ã¹ã¤ã¼ãã¼ã®è©±ããã¦ããã®ã§ãããã©ãããæè¿Androidã¢ããªã«ç§»æ¤ãããããã®ã§ããããæãã®è©±ãåºã¦ããã£ã½ãã§ããä¹ããæå¾ ï¼
KMCM
京大ãã¤ã³ã³ã¯ã©ãã§ã¯ãã©ã¦ã¶æ¡å¼µã«èå³ãããæ°å ¥é¨å¡ãåéãã¦ãã¾ããå¹´é½¢ãæå±ãå½ç±ãå®æãã®ä»è«¸ã ã«é¢ããå¶ç´ã¯ããã¾ããããã¤ã§ãä¾ä¼ã«éã³ã«æ¥ã¦ã¿ã¦ãã ããã詳ããã¯å ¥é¨æ¡å ãè¦ã¦ä¸ããã
*1:ãã®è¾ºã®jpmã®è©±ã¯KMCã®é¨èªã«æ¸ããã®ã§ãã³ãã±ãªã©ã§è²·ã£ã¦ä¸ããï¼ https://www.kmc.gr.jp/events/c88/
*2:https://github.com/pastak/gyazo-chrome-extension/tree/firefox-webextension