Changeset 7993
- Timestamp:
- 03/16/08 15:08:56 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/userscripts/openfl.syncratewithldr.user.js
r7508 r7993 7 7 // ==/UserScript== 8 8 // OpenFL の set_rate をフックし、LDR にレート変更を反映させます。 9 // 10 // LDR にログインしていない場合 (ApiKey の取得に失敗した場合): 11 // 1. GM_getValue をループさせ ApiKey がセットされるのを待つ 12 // 2. Livedoor のログイン画面を別ウィンドウで表示させる 13 // 3. ログインできると http://www.livedoor.com/close に飛される。 14 // 4. /close にフックして ApiKey を再度取得し、GM_setValue 15 // 5. ログインウィンドウを閉じる 16 // 6. OpenFL 側の GM に制御が戻り、継続が実行される 9 17 10 18 (function () { with (D()) { 11 12 if (location.href == "http://www.livedoor.com/close") {13 window.close();14 return;15 }16 19 17 20 function getApiKey () { … … 24 27 return api_key; 25 28 } else { 29 GM_setValue("ApiKey", ""); 26 30 callee._cache = null; 27 31 if (callee._cache === null) { 28 32 window.open("http://member.livedoor.com/login/?.next="+encodeURIComponent("http://www.livedoor.com/close")); 29 33 } 30 throw "Getting ApiKey failed"; 34 unsafeWindow.message("Getting ApiKey failed... Waiting for logging-in.."); 35 return next(function () { 36 var api_key = GM_getValue("ApiKey"); 37 if (api_key) { 38 GM_setValue("ApiKey", ""); 39 return api_key; 40 } else { 41 return wait(1).next(arguments.callee); 42 } 43 }); 31 44 } 32 45 }); … … 65 78 }); 66 79 }; 80 81 // ApiKey の取得に失敗し、ログイン画面を表示したあととばされる先 82 // ApiKey をセットして制御を OpenFL 側にかえす 83 if (location.href == "http://www.livedoor.com/close") { 84 getApiKey().next(function (api_key) { 85 GM_setValue("ApiKey", api_key); 86 window.close(); 87 }); 88 return; 89 } 67 90 68 91
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)