ã¯ãï¼ ããã«ã¡ã¯ããã«ã¡ã¯ï¼ï¼
ãããªããã§AIRã¢ããªã¤ãã£ã¦ã¿ã¾ããï¼
tPod - tumblrã®Dashboardã«æµããç»åãçºããã¬ã¸ã§ãã
ãããªãã¤ã§ãï¼
tumblrã®èªåã®dashboardã®ç»åã次ã
ã«æµãã¦ãã¾ãï¼
ã¡ãã£ã¨ãããããï¼
tumblrãªãã¦ç¥ããªããâ¦ï¼
ãªãã¦äººããã®æ©ä¼ã«ãã¡ãã£ã¨è©¦ãã¦ã¿ããã©ãã§ããããï¼
ãªããæ°ã«å
¥ã£ãç»åãè¨èããã¿ããªã§ã©ãã©ãã¯ãªãã(å¼ç¨)ãã¦ããã ãã®ãµã¼ãã¹ã§æ¥½ãããï¼
http://www.tumblr.com/
ãããããã¡ã¼ã«ã¢ãã¬ã¹å
¥åããã°ãããç»é²ã§ãããï¼
ç»é²ãããé©å½ã«ãã¼ãã¨ã以ä¸ã®ãããªäººãã¡ã Follow ãã¦ããã°ãããã·ã¥ãã¼ãã«ç»åãæµãã¦ããããããªãããªï¼
http://hmcy.tumblr.com/
http://yuiseki.tumblr.com/
http://sui.tumblr.com/
http://acqua.tumblr.com/
http://ot-inc.tumblr.com/
http://onaho.tumblr.com/
http://gokujo.tumblr.com/
tPodã®ã¤ã³ã¹ãã¼ã«
Install Now ãæ¼ãã¦ãï¼
tPodã®ã½ã¼ã¹ã³ã¼ãä¸å¼ (v0.84)
http://hamachiya.com/air/tpod/tpod_src084.zip
é¢é£è¨äº
- JavaScriptã§ããããAIRã¢ããªã«ææ¦
- AIRã¢ããªã±ã¼ã·ã§ã³ãå ¬éããããã®ã¡ã¢
- ã«ããã
ãã¼ã¸ã§ã³ã¢ããå±¥æ´
- v0.84 ... ãã¤ã®ã¾ã«ããã¼ã¹ã¨ã©ã¼ã§åããªããªã£ã¦ã(ç»åã表示ãããªããªã£ã¦ã)ããä¿®æ£
- v0.83 ... ãã¼ã¸ã§ã³ãã§ãã¯ã®å¾ããã®ãã¼ã¸ãéãã¨ãã¯æ¨æºãã©ã¦ã¶ã§éãããã«ãtPodãçµäºãããããã«ãã
- v0.82 ... çªã®ä½ç½®ãå¤å´ã«ããåºãç¶æ ã§çµäºããã¨ã次åããã¡ããã¨èµ·åããªããªã£ã¦ã
- v0.81 ... ãã¼ã¸ã§ã³ãã§ãã¯ã®ã¨ããã«ä½è¨ãªã³ã¼ãããã£ãããããã
- v0.8 ... ç¬èªãã¡ã¤ã³ãè¨å®ãã¦ã人ãdashboardã«ç¾ããã¨æ¢ã¾ã£ã¦ãããã¨èµ·åæã«ãã¼ã¸ã§ã³ãã§ãã¯ããããã«ããã
- v0.7 ... åããã¼ã¸ããããã表示ãã¦ãããã¨reblogedã®é¨åã表示ããã¦ããªãæããã£ã
- v0.6 ... èµ·åãã¦ããã«(tPodã®ãã´ãåºã¦ããæã«)windowã®ãµã¤ãºãå¤ãããã¨ããã¨ãã¿ã³é¡ãè¦ããªããªã£ãããããã°ãä¿®æ£
- v0.5 ... æåã®å ¬éãã¼ã¸ã§ã³
tPodã®JavaScripté¨åã®ã½ã¼ã¹ã³ã¼ã (800è¡ããã)
// v0.84 air.trace('start tPod.'); var tPod = { cfg: { versionCheckPage: 'http://hamachiya.com/air/tpod/version', installPage: 'http://d.hatena.ne.jp/Hamachiya2/20090119/tPod', tumblrRoot: 'http://www.tumblr.com', tumblrSave: 'http://www.tumblr.com/share?v=3', tumblrDashboard: 'http://www.tumblr.com/dashboard', checkLoginInterval: 180000, checkLoginInterval_nologin: 12000, changeInterval: 9200, requestInterval: 240000, page: 4, paddingHeight: 129 // ã¡ã¤ã³è¡¨ç¤ºé¨ä»¥å¤ã«å¿ è¦ãªç¸¦å¹ }, initData: [], initDataList: [], rawPosts: [], posts: [], formKey: null, login: null, elm: {}, settingWindow: null, checkLoginTimer: null, requestTimer: null, changeTimer: null, redrawTimer: null, retryTimer: null, version: new DOMParser().parseFromString(air.NativeApplication.nativeApplication.applicationDescriptor, "text/xml").getElementsByTagName('application')[0].getElementsByTagName("version")[0].firstChild.data }; air.trace(tPod.version); // tpod.iniãã¡ã¤ã«ãèªã¿è¾¼ãã readInitData(); // windowã®ä½ç½®ã¨å¹ ã復å ããã(ãªããã°ããã©ã«ããµã¤ãº) positioning(200, 306); // default size document.observe('dom:loaded', initialize, false); function initialize() { tPod.elm = { loginStatus: $('loginStatus'), viewOuter: $('view'), view: $('main'), postInfo: $('postInfo'), message: $('message'), settingWindow: $('settingWindow'), btMain: $('btMain'), btBack: $('btBack'), btNext: $('btNext') }; // tpod.iniãã¡ã¤ã«ããèªã¿è¾¼ãã è¨å®ãã¼ã¿ãtPod.cfgã«ãããã setConfig(); // ã¡ã¤ã³è¡¨ç¤ºé¨ãæ£æ¹å½¢ã«ããã tPod.elm.viewOuter.style.height = tPod.elm.viewOuter.offsetWidth; // tPodã®ãã´ãããããã ãã new Effect.Appear($('tPodImage'), { from: 0.1, to: 1.0, delay: 1.2, // éå§ã¾ã§ã®ç§æ° fps: 60, duration: 3.2, beforeStartInternal: function(effect) { }, afterFinishInternal: function(effect) { // ä¸æåæ¢ã»åçãã¿ã³ã®ã¤ãã³ã tPod.elm.btMain.addEventListener('click', hPause, false); } }); $('ver').innerHTML = tPod.version; checkVersion(); // ãã¿ã³ã®hoverç»å // cssã§ããã¨ä½ãã©ããã£ã¦ãååã¡ãã¤ããããã£ã¡ã§ããã tPod.elm.btBack.addEventListener('mouseover', function() { tPod.elm.btBack.src = 'img/tri_l_hi.png'; }, false); tPod.elm.btBack.addEventListener('mouseout', function() { tPod.elm.btBack.src = 'img/tri_l.png'; }, false); tPod.elm.btNext.addEventListener('mouseover', function() { tPod.elm.btNext.src = 'img/tri_r_hi.png'; }, false); tPod.elm.btNext.addEventListener('mouseout', function() { tPod.elm.btNext.src = 'img/tri_r.png'; }, false); // ä¸åº¦ãã°ã¤ã³ãã§ãã¯ã«å ¥ãã¨setTimeoutã§ä¸å®ééãã¨ã«ãã§ãã¯ããã checkLogin(); // dashboardã®ä¸èº«ãå®æçã«tPod.cfg.pageåã¨ãã«ããã // ã¨ã£ã¦ãããã¼ã¿(html)ã¯tPod.postsã«æ ¼ç´ããã getDashboard(true); tPod.requestTimer = setInterval(getDashboard, tPod.cfg.requestInterval); // windowããªãµã¤ãºããã¦ãã¡ã¤ã³è¡¨ç¤ºé¨ã¯æ£æ¹å½¢ã«ãªãããã«ããã window.addEventListener('resize', hResize, false); // 次ã ã«ç»åãåãæ¿ãããã¤ã ã tPod.changeTimer = setInterval(changer, tPod.cfg.changeInterval); // çµäºæã«ã¯windowã®ä½ç½®ã¨ããtpod.iniã«æ¸ãåºãã nativeWindow.addEventListener('closing', saveInit, false); // è¨å®ç»é¢ã²ããã㤠$('openSettings').addEventListener('click', function() { openSettings(); tPod.elm.settingWindow.toggle(); }, false); $('cancel').addEventListener('click', function() { tPod.elm.settingWindow.hide(); }, false); $('save').addEventListener('click', function() { tPod.elm.settingWindow.hide(); saveSettings(); }, false); // ãããã°ç¨ã®ãã°ã表示ããããã¤ã ã $('viewLog').addEventListener('click', function() { if ($('log').style.display == 'none') { nativeWindow.height = Number(nativeWindow.height + 94); $('log').show(); } else { nativeWindow.height = Number(nativeWindow.height - 94); $('log').hide(); } }, false); } // èµ·åæã«å¼ã°ãããã tpod.iniãã¡ã¤ã«ãèªã¿è¾¼ã function readInitData() { air.trace('read tpod.ini'); // C:\Users\****\AppData\Roaming\Hamachiya2.tPod\Local Store\tpod.ini var file = new air.File('app-storage:/tpod.ini'); // air.trace(file.nativePath); var fs = new air.FileStream(); var data = ''; try { fs.open(file, air.FileMode.READ); var data = fs.readUTFBytes(fs.bytesAvailable); } catch (e) { } fs.close(); // air.trace(data); var dataRows = data.split('\n'); dataRows.map( function(v) { var temp = v.split('\t'); if (temp[1]) { // tPod.initData[temp[0]] = temp[1]; tPod.initData[temp[0]] = temp[1]; tPod.initDataList.push(temp[0]+'\t'+temp[1]); air.trace(temp[0] + '\t' + temp[1]); } } ); } // tpod.iniãã¡ã¤ã«ããèªã¿è¾¼ãã ãã¼ã¿ãããã°tPod.cfgã«ãããã function setConfig() { if (tPod.initData.changeInterval) { tPod.cfg.changeInterval = tPod.initData.changeInterval; } if (tPod.initData.requestInterval) { tPod.cfg.requestInterval = tPod.initData.requestInterval; } if (tPod.initData.bufferedPages) { tPod.cfg.page = tPod.initData.bufferedPages; } } // èµ·åæã«å¼ã°ããããwindowã®ä½ç½®ãå¹ ã復å function positioning(w, h) { var xx, yy, ww, hh; if (tPod.initData.bounds) { // å¤å´ã«ã¯ã¿ã§ã¦ãæããã¤ãã¹ãå ¥ããã¨ã⦠if (tPod.initData.bounds.match(/x=(-{0,1}[\d\.]+)/)) { xx = RegExp.$1; } if (tPod.initData.bounds.match(/y=(-{0,1}[\d\.]+)/)) { yy = RegExp.$1; } if (tPod.initData.bounds.match(/w=([\d\.]+)/)) { ww = RegExp.$1; } if (tPod.initData.bounds.match(/h=([\d\.]+)/)) { hh = RegExp.$1; } } if (xx && yy && ww && hh) { nativeWindow.bounds = new air.Rectangle(xx, yy, ww, hh); } else { nativeWindow.width = w; nativeWindow.height = h; } // æåã¯tpod.xmlã§é表示(visible:false) ã«ãã¦ãããããããã§åãã¦è¡¨ç¤º nativeWindow.visible = true; } // settingsã®ç»é¢ã®ãã©ã¼ã ã®ããã©ã«ãé¸æç¶æ ãå¤æ´ããã function openSettings() { function setSelector(elm, cfg, sec) { var n = cfg; n = sec ? n / 1000 : n; for (var i=0; i<elm.length; i++) { if (elm[i].value == n) { elm[i].selected = true; break; } } } setSelector($('change'), tPod.cfg.changeInterval, true); setSelector($('request'), tPod.cfg.requestInterval, true); setSelector($('page'), tPod.cfg.page, false); } // settingsã®ç»é¢ã®saveæ¼ãããã㨠function saveSettings() { var fChange = $F($('change')); if (fChange) { tPod.cfg.changeInterval = fChange * 1000; if (tPod.changeTimer) { clearTimeout(tPod.changeTimer); tPod.changeTimer = setInterval(changer, tPod.cfg.changeInterval); } } var fRequest = $F($('request')); if (fRequest) { tPod.cfg.requestInterval = fRequest * 1000; if (tPod.requestTimer) { clearTimeout(tPod.requestTimer); tPod.requestTimer = setInterval(getDashboard, tPod.cfg.requestInterval); } } var fPage = $F($('page')); if (fPage) { tPod.cfg.page = fPage; } saveInit(); } // tpod.iniãã¡ã¤ã«ã«ãwindowã®ä½ç½®ã¨ãè²ã æ¸ãåºãã function saveInit() { air.trace('save tpod.ini'); //air.trace(tPod.initDatalist); //air.trace(tPod.initDataList.length); //air.trace(tPod.initDataList[0]); // AIRã¢ããªã¨åãä½ç½®ã«iniãã¡ã¤ã«ã¤ãããããã©â¦ // var file = air.File.applicationDirectory.resolvePath('tpod.ini'); // ã»ãã¥ãªãã£åé¿ããªãã¨æ¸ããªã // ãããã¢ã³ã¤ã³ã¹ãã¼ã«/åã¤ã³ã¹ãã¼ã«æã«åé¡ãæ®ã // file = new File(file.nativePath); // ããããªãã®ã§ããããããä½ç½®ã« // C:\Users\****\AppData\Roaming\Hamachiya2.tPod\Local Store\tpod.ini var file = new air.File('app-storage:/tpod.ini'); var fs = new air.FileStream(); fs.open(file, air.FileMode.WRITE); fs.writeUTFBytes('bounds\t' + nativeWindow.bounds + '\n'); fs.writeUTFBytes('changeInterval\t' + tPod.cfg.changeInterval + '\n'); fs.writeUTFBytes('requestInterval\t' + tPod.cfg.requestInterval + '\n'); fs.writeUTFBytes('bufferedPages\t' + tPod.cfg.page + '\n'); fs.close(); } // ä¸æåæ¢ã»åçãã¿ã³ã§å¼ã°ããã¨ãã function hPause() { // loadä¸(getDashboard)ãªããªã«ãããªã if (tPod.elm.btMain.className == 'load') { return; } if (tPod.changeTimer) { // ã¿ã¤ãã¼ãããã£ã¦ãã¨ã¯ãä¸æåæ¢ãããããã®ï¼ clearTimeout(tPod.changeTimer); clearTimeout(tPod.requestTimer); tPod.changeTimer = null; message('»Pause', 1.8); tPod.elm.btMain.className = 'play'; } else { // ã¿ã¤ãã¼ããªããªããåçãã¹ãï¼ message('»Play', 1.8); changer(); tPod.requestTimer = setInterval(getDashboard, tPod.cfg.requestInterval); tPod.changeTimer = setInterval(changer, tPod.cfg.changeInterval); tPod.elm.btMain.className = 'pause'; } } // ãã©ããã¿ã³ function hBack() { air.trace('go back'); // ãªããå¢çããããã // air.trace('count:'+tPod.count); // air.trace('length:'+tPod.posts.length); // nullã¨ãã ã£ãã0ã«ããã tPod.count -= 0; // ã¨ãããã2ãããå¼ãã¦ã¿ããåã§ã var c = tPod.count - 2; // air.trace('a' + c); if (c == -1) { c = tPod.posts.length - 1; // air.trace('b' + c); } else if (c == -2) { c = tPod.posts.length - 2; // air.trace('c' + c); } if (c < 0) { c = 0; } tPod.count = c; // air.trace('changed:'+tPod.count); // air.trace(tPod.posts[c].image.src); // trueã«ããã¨ã¨ãã§ã¯ãæ§ãã changer(true); } // ããããã¿ã³ function hNext() { air.trace('go go next'); changer(true); } // windowãªãµã¤ãºæã«viewãæ£æ¹å½¢ã«ãªãããã«èª¿æ´ããã㤠function hResize() { // ç»åã ããã¾ã¾ã ã¨ç»åã®æ¨ªå¹ ããå°ãããªãµã¤ãºããæã«æ¯çãå´©ãã¡ãã var image; if (image = $('mainImage')) { image.style.display = 'none'; resizeWindow(); adjustImage(image); // â»ãªãµã¤ãºçµäºæã«æ®éã«showãã¦ãã¿ã¤ãã³ã°ãåãããã¾ããããªã tPod.redrawTimer = setTimeout(function() { image.style.display = ''; // show }, 30); } else { resizeWindow(); } } function resizeWindow() { var vw = tPod.elm.viewOuter.offsetWidth; tPod.elm.viewOuter.style.height = vw; // windowã®é«ããå¤ãã£ã¦ãpanelã¨ããé ããªãããã«èª¿æ´ããã var h = Number(vw + tPod.cfg.paddingHeight); if (h != nativeWindow.height) { nativeWindow.height = h; } } // ã ãããããã®reblogã¨ãã§ãã¨ã function info(str) { tPod.elm.postInfo.innerHTML = str; } // ã¡ã¤ã³ã®ç»å表示ã®ä¸ã«ãã¶ã㦠Play ã¨ã Pause ã¨ãã ãã function message(str, t) { tPod.elm.message.innerHTML = str; tPod.elm.message.style.opacity = '0.85'; tPod.elm.message.show(); // tããªç§å¾ã«ãããã¨ããã if (t) { new Effect.Appear(tPod.elm.message, { from: 0.85, to: 0.1, delay: t, // éå§ã¾ã§ã®ç§æ° fps: 60, duration: 0.3, beforeStartInternal: function(effect) { }, afterFinishInternal: function(effect) { tPod.elm.message.innerHTML = ''; tPod.elm.message.hide(); } }); } } // dashboardã®ãã¼ã¿åå¾ãã¦tPod.postsã«ã©ãã©ãæ ¼ç´ããã㤠// ãªããé åã¨ãè²ã ã ããå¤ãã¦ããã function getDashboard(noMessage) { // ãã¿ã³ã®ã¨ããããããããããã tPod.elm.btMain.className = 'load'; air.trace('get dashboard ...'); if (tPod.retryTimer) { clearTimeout(tPod.retryTimer); tPod.retryTimer = null; } if (!tPod.login) { tPod.retryTimer = setTimeout(function() { getDashboard(noMessage); },5000); return; } noMessage || message('»Loading', 1); tPod.rawPosts = []; tPod.posts = []; // tPod.images = []; for (var i=0; i<tPod.cfg.page; i++) { (function(page) { air.trace('Request: ' + tPod.cfg.tumblrDashboard + '/' + page); var ajax = new Ajax.Request( tPod.cfg.tumblrDashboard + '/' + page + '?t=' + new Date(), { method: 'get', onComplete: function(xhr) { pageCollector(xhr, page, ajax.url); } } ); })(i+1-0); } } function pageCollector(xhr, page, url) { air.trace('success: ' + url.replace(/t=.+/, '')); /* var srcs = xhr.responseText.match(/src="(http:\/\/data.tumblr.com[^"]+)/g); tPod.images = tPod.images.concat(srcs); tPod.count = 0; */ //var xml = xhr.responseXML; var text = xhr.responseText; // ã&ãã®åºç¾ã«ããXMLãã¼ã¹ã¨ã©ã¼åé¿ // <img src="/images/logo.png?alpha&5" âãªããããã¤ã®ããï¼ // scriptã«ããxmlãã¼ã¹ã¨ã©ã¼åé¿ text = text.replace(/\n/g, ''); text = text.replace(/<script.+?<\/script>/g, ''); //air.trace(text.match(/&[^#]\w*/g)); // ããã¯ä¸å®ã ãããªã³ã¯ã®urlã«ã&ãããã®ã¾ã¾ãã£ãæã¨ã⦠// ããã§ããã¼ã¹ã¨ã©ã¼ã«ãªãããªã¼ãã¾ãããã text = text.replace(/&[^#]\w*/g, ''); // åå¾ããhtmlããã¹ããDOMã«ãã¡ããã var parser = new DOMParser(); var xml = parser.parseFromString(text, 'text/xml'); //air.trace(xml.childNodes.length); //air.trace(xml.childNodes[0].nodeName); //air.trace(xml.getElementsByTagName('html')[0].innerHTML); // tPod.rawPosts[page-1] = tPod.rawPosts.concat($A(xml.getElementsByClassName('post'))); tPod.rawPosts[page-1] = $A(xml.getElementsByClassName('post')) || 1; // å ¨é¨ã®ãã¼ã¸ãåããããã§ã㯠var checkAll = true; for (var i=0; i<tPod.cfg.page; i++) { if (! tPod.rawPosts[i]) { air.trace('check page'+(i+1-0)+': NG'); checkAll = false; // break; } else { air.trace('check page'+(i+1-0)+': OK'); } } // å ¨ãã¼ã¸åãã¦ããããªããããã if (checkAll) { // rawPostã [page][posts] ã£ã¦ãªã£ã¦ããã // rawPosts[posts]ã«ãªãããã«ããã var temp = []; for (var i=0; i<tPod.rawPosts.length; i++) { temp = temp.concat(tPod.rawPosts[i]); } tPod.rawPosts = temp; // rawPosts ã tPod.posts ã«å ¥ããªããã for (var i=0; i<tPod.rawPosts.length; i++) { if (tPod.rawPosts[i] == 1) { continue; } postCollector(i, tPod.rawPosts[i]); } air.trace('Posts: ' + tPod.rawPosts.length); air.trace('Images: ' + tPod.posts.length); message('»Buffer:' + tPod.posts.length, 1); tPod.count = 0; } } function postCollector(no, rawPost) { var image = rawPost.getElementsByClassName('image')[0]; var postInfo = rawPost.getElementsByClassName('post_info')[0]; var postControls = rawPost.getElementsByClassName('post_controls')[0]; var avatar = rawPost.getElementsByClassName('avatar')[0]; if (avatar.innerHTML) { // ***.tumblr.comã®***ããªã³ã¯æåã«ããã if (avatar.href.match(/:\/\/(\w+)\.tumblr/)) { avatar.innerHTML = RegExp.$1; } else if (avatar.title) { // ãã£ãtumblrã£ã¦ç¬èªãã¡ã¤ã³ã使ãããã ã⦠avatar.innerHTML = avatar.title; } else { avatar.innerHTML = ''; } } air.trace('image:' + (image ? 'OK' : 'NG') + ' info:' + (postInfo ? 'OK' : 'NG') + ' ctrl:' + (postControls ? 'OK' : 'NG') +' avatar:' + avatar); if (image) { air.trace('Check post['+(no+1-0)+']: image'); } else { air.trace('Check post'+(no+1-0)+': other'); } // ç»åã®postã ããããã if (image && postControls) { // post_infoã®ãªã³ã¯targetãå¤æ´ããã if (postInfo) { var a = postInfo.getElementsByTagName('a'); for (var x=0; x<a.length; x++) { a[x].target = '_blank'; } } // åãã¦ã¼ã¶ã¼ãé£ç¶ãã¦postãã¦ãæ // postInfoã¯ç©ºã«ãªãããããããã«avatar if (postInfo && postInfo.innerHTML) { postInfo = postInfo.innerHTML; } else if (avatar) { postInfo = '<a href="' + avatar.href + '" target="_blank">' + avatar.innerHTML + '</a>:'; } else { postInfo = ''; } tPod.posts.push({ postInfo: postInfo, image: image, postControls: postControls }); } } // ç»åãã´ãã´ãåãæ¿ããã㤠function changer(noEffect) { tPod.elm.btNext.className = 'busy'; tPod.elm.btNext.removeEventListener('click', hNext, false); tPod.elm.btBack.className = 'busy'; tPod.elm.btBack.removeEventListener('click', hBack, false); air.trace('start image:'+tPod.count + '/' + tPod.posts.length); if (tPod.count >= tPod.posts.length) { tPod.count = 0; } // 表示é¨ãå´©ãã¦æ£æ¹å½¢ãããªããªã£ã¦ãããªãã if (tPod.elm.view.offsetWidth != tPod.elm.view.offsetHeight) { hResize(); } //var src = tPod.images[tPod.count].replace('src="', ''); var src = tPod.posts[tPod.count].image.src; var img = new Image(); img.src = src; img.id = 'mainImage'; img.className = 'mainImage'; // ç»åã®å¹ ãåå¾ãããããonloadã¾ã§å¾ ã¤ã img.addEventListener('load', function() { // imgã®widthã¨ãheight調æ´ããã adjustImage(img); img.style.display = 'none'; var oldImg = tPod.elm.view.getElementsByTagName('img')[0]; // ä½ãã®ééãã§oldImgãç¡ãã£ãæã¯ãã´ã§ãå ¥ãã¨ã if (!oldImg) { oldImg = new Image(); img.src = 'img/tpod.png'; tPod.elm.view.appendChild(oldImg); } if (tPod.elm.btMain.className == 'load') { tPod.elm.btMain.className = 'pause'; } // post_info表示ããã var str = tPod.posts[tPod.count].postInfo || ''; info(str + ' [' + (Number(tPod.count + 1)) + '/' + tPod.posts.length + ']'); air.trace('show image:'+tPod.count); // ç»å表示(åãæ¿ã)ããã new Effect.Appear(oldImg, { from: 0.9, to: 0.1, delay: 0, // éå§ã¾ã§ã®ç§æ° fps: 60, duration: noEffect ? 0.1 : 0.3, beforeStartInternal: function(effect) { }, afterFinishInternal: function(effect) { tPod.elm.view.style.background = '#000'; oldImg.removeEventListener('click', reblog, false); // ããã§ç»åãå·®ãæ¿ãã tPod.elm.view.replaceChild(img, oldImg); new Effect.Appear(img, { from: 0.1, to: 1.0, delay: 0, // éå§ã¾ã§ã®ç§æ° fps: 60, duration: noEffect ? 0.1 : 0.6, beforeStartInternal: function(effect) { }, afterFinishInternal: function(effect) { tPod.elm.btNext.addEventListener('click', hNext, false); tPod.elm.btNext.className = ''; tPod.elm.btBack.addEventListener('click', hBack, false); tPod.elm.btBack.className = ''; img.addEventListener('click', reblog, false); } }); } }); // End of Effect tPod.count++; }, false); // End of img.onload } // ç»é¢ã®å¹ ã«ãããã¦æ¯çãå´©ããªãããã« // imgã®widthã¨ãheight調æ´ããã function adjustImage(img) { // 表示é¨ã®å¹ var vw = tPod.elm.view.offsetWidth; var vh = tPod.elm.view.offsetHeight; // ç»åã®å¹ var iw = img.naturalWidth; var ih = img.naturalHeight; // æçµçã«imgã«ã»ããããwidthã¨height var w = ''; var h = ''; if ( (vw < iw) && (vh < ih) ) { if (iw < ih) { h = vh; } else { w = vw; } } else { if (vw < iw) { w = vw; } else if (vh < ih) { h = vh; } } air.trace('v:' + vw + 'x' + vh + ' i:' + iw + 'x' + ih + ' r:' + (w ? w : '(null)') + 'x' + (h ? h : '(null)')); if (w) { img.width = w-2; } if (h) { img.height = h-2; } } // ãªããã°æ©è½ï¼ è¶ ãã£ãããã¤ã³ã¿ã¼ãã§ã¼ã¹ã§ï¼ ã£ã¦æã£ããã© // ãªããããããã©ããããããªã³ã¯ã²ããã ãã§ããã function reblog() { // ã¯ãªãã¯ã®ã¿ã¤ãã³ã°ã«ãã£ã¦ã¯ãã¾ããããªãããï¼ // requestTimerã§getDashboardåãã¡ãã£ã¦ãtPod.postsã空ã ã¨ãã // air.trace(tPod.posts[tPod.count].postControls); var c = tPod.count - 1; if (c < 0) { c = tPod.count.length - 1; } var a = tPod.posts[c].postControls.getElementsByTagName('a'); var href; for (var i=0; i<a.length; i++) { if (a[i].href.match(/reblog/)) { href = a[i].href; break; } } if (href) { open(tPod.cfg.tumblrRoot + href, null, 'menubar=yes,toolbar=yes,location=yes,resizable=yes,scrollbars=yes'); } } // ãã°ã¤ã³ãã¦ãããã§ãã¯ããã㤠// ä¸å¿postç¨ã®keyãåå¾ãã¦ããã function checkLogin() { tPod.elm.loginStatus.className = ''; air.trace('check login ...'); var temp = tPod.elm.loginStatus.innerHTML; tPod.elm.loginStatus.innerHTML = '<span class="check">[Check login]</span>'; new Ajax.Request( tPod.cfg.tumblrSave, { method: 'get', onComplete: function(xhr) { if (xhr.responseText.match(/name="form_key"[^>]+value="([^"]+)"/i)) { tPod.formKey = RegExp.$1; tPod.login = true; //tPod.elm.loginStatus.style.display = 'none'; //air.trace(tPod.formKey); tPod.elm.loginStatus.innerHTML = '[<a href="http://www.tumblr.com/dashboard" target="_blank">»Dashboard</a>]'; tPod.elm.loginStatus.style.display = 'block'; //debug(xhr.responseText); } else { tPod.login = false; tPod.elm.loginStatus.innerHTML = '[Not logined → <a href="http://www.tumblr.com/login" target="_blank">Login</a>]'; tPod.elm.loginStatus.style.display = 'block'; } }, onFailure: function(xhr) { tPod.elm.loginStatus.innerHTML = temp; } } ); if (tPod.checkLoginTimer) { clearTimeout(tPod.checkLoginTimer); } var t = tPod.login ? tPod.cfg.checkLoginInterval : tPod.cfg.checkLoginInterval_nologin; tPod.checkLoginTimer = setTimeout(checkLogin, t); } // ãã¼ã¸ã§ã³ãã§ã㯠function checkVersion() { air.trace('check version ...'); info('Checking version ...'); new Ajax.Request( tPod.cfg.versionCheckPage, { method: 'get', onComplete: function(xhr) { if (xhr.responseText.match(/^v([0-9a-zA-Z.]+)$/i)) { if (tPod.version < RegExp.$1) { if (confirm('New version v' + RegExp.$1 + ' available. (this version is v' + tPod.version + ')\nDo you want to open download page?')) { // æ¨æºãã©ã¦ã¶ã§ãã¦ã³ãã¼ããã¼ã¸éãã air.navigateToURL(new air.URLRequest(tPod.cfg.installPage), "_blank"); // tPodçµäºããã saveInit(); nativeWindow.close(); } } } info(''); }, onFailure: function(xhr) { info(''); } } ); } // ãããã°ãã° function debug(str) { if (tPod.cfg.debug) { var d = $('log'); d.value = str + '\n' + d.value; } }