Changeset 7220

Show
Ignore:
Timestamp:
02/28/08 09:54:11 (5 years ago)
Author:
mattn
Message:

lang/javascript/userscripts/googlereaderfullfeed.user.js:
* メッセージ表示に対応
* 本家に合わせ'G'でキャッシュリセットするよう修正

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/userscripts/googlereaderfullfeed.user.js

    r7213 r7220  
    66// @description loading full entry on Google Reader 
    77// @privilege   false 
    8 // @version     0.0.7 
     8// @version     0.0.8 
    99// ==/UserScript== 
    1010// based on LDR Full Feed <http://d.hatena.ne.jp/toshi123> 
     
    415415document.addEventListener('keyup', function(e) { 
    416416  if (e.keyCode == (w.KeyEvent.DOM_VK_G)) { //|| 71)) { 
    417     init(); 
    418     //FullFeed.registerWidgets(); 
     417    if (e.shiftKey) 
     418      FullFeed.resetCache(); 
     419    else 
     420        init(); 
    419421  } 
    420422}, true); 
     
    455457} 
    456458 
     459// copied from FLASH KEY (c) id:brazil 
     460// http://userscripts.org/scripts/show/11996 
     461// slightly modified. 
     462var FlashMessage = new function(){ 
     463  GM_addStyle(<><![CDATA[ 
     464    #FLASH_MESSAGE{ 
     465      position : fixed; 
     466      font-size : 200%; 
     467      z-index : 10000; 
     468       
     469      padding : 20px 50px 20px 50px; 
     470      left : 50%; 
     471      top : 50%; 
     472      margin : -1em; 
     473       
     474      background-color : #444; 
     475      color : #FFF; 
     476      -moz-border-radius: 0.3em; 
     477      min-width : 1em; 
     478      text-align : center; 
     479    } 
     480  ]]></>) 
     481  var opacity = 0.9; 
     482  var flash = document.createElement('div'); 
     483  flash.id = 'FLASH_MESSAGE'; 
     484  hide(flash); 
     485  document.body.appendChild(flash); 
     486  var canceler; 
     487  this.showFlashMessageWindow = function (string, duration) { 
     488    duration = duration || 400; 
     489    canceler && canceler(); 
     490    flash.innerHTML = string; 
     491    flash.style.MozOpacity = opacity; 
     492    show(flash); 
     493    flash.style.marginLeft = (-(flash.offsetWidth/2))+'px'; 
     494 
     495    canceler = callLater(function(){ 
     496      canceler = tween(function(value){ 
     497        flash.style.MozOpacity = opacity * (1-value); 
     498      }, 100, 5); 
     499    }, duration); 
     500  }; 
     501 
     502  // ----[Utility]------------------------------------------------- 
     503  function callLater(callback, interval){ 
     504    var timeoutId = setTimeout(callback, interval); 
     505    return function(){ 
     506      clearTimeout(timeoutId) 
     507    } 
     508  } 
     509  function tween(callback, span, count){ 
     510    count = (count || 20); 
     511    var interval = span / count; 
     512    var value = 0; 
     513    var calls = 0; 
     514    var intervalId = setInterval(function(){ 
     515      callback(calls / count); 
     516 
     517      if(count == calls){ 
     518        canceler(); 
     519        return; 
     520      } 
     521      calls++; 
     522    }, interval); 
     523    var canceler = function(){ 
     524      clearInterval(intervalId) 
     525      hide(flash) 
     526    } 
     527    return canceler; 
     528  } 
     529  function hide(target){ 
     530    target.style.display='none'; 
     531  } 
     532  function show(target, style){ 
     533    target.style.display=(style || ''); 
     534  } 
     535} 
     536 
    457537function message (mes) { 
    458538  //w.message(mes); 
    459   console.log(mes); 
     539  //console.log(mes); 
     540  FlashMessage.showFlashMessageWindow(mes, 1000); 
    460541} 
    461542