Changeset 31076

Show
Ignore:
Timestamp:
03/12/09 01:47:40 (4 years ago)
Author:
drry
Message:
  • @include を修正しました。
  • ほか。
Files:
1 modified

Legend:

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

    r31075 r31076  
    33// @namespace      http://mirupreza.tumblr.com/ 
    44// @description    Usage: Ctrl + Shift + Enter -> "Browsing: ****" on Twitter! 
    5 // @include        * 
    6 // @version        0.0.1 
     5// @include        http://* 
     6// @include        https://* 
     7// @version        0.0.2 
    78// ==/UserScript== 
    89// 
    9 // last modified: 2009/03/11 01:20 
    10 //  
     10// last modified: 2009/03/12 01:20 
     11// 
    1112 
    1213 
    13 (function (){ 
     14(function() { 
    1415 
    1516  // --- user customize start --- 
    1617 
    17   var useTinyURL = true 
     18  var useIsgd    = true 
    1819  var useAlert   = false 
    19   var defaultTag = "\u898B\u3066\u308B:" 
     20  var defaultTag = '\u898B\u3066\u308B:' 
    2021  var replaceTag = true 
    2122 
     
    2526  var w = window 
    2627  if (typeof unsafeWindow != 'undefined') { w = unsafeWindow } 
    27   function debug(arguments) { try{ w.console.log(arguments)   } catch(e) {} } 
    28   function error(arguments) { try{ w.console.error(arguments) } catch(e) {} } 
     28  function debug(arguments) { try { w.console.log(arguments)   } catch (e) {} } 
     29  function error(arguments) { try { w.console.error(arguments) } catch (e) {} } 
    2930 
    3031  var Browsing = function() { this.init.apply(this, arguments) } 
     
    3435    init : function(url) { 
    3536      var m = defaultTag + ' "' + document.title + '" ' 
    36       var m = prompt(m,'') 
     37      m = prompt(m, '') 
    3738      if (m == null) return 
    3839      if (m == '') m = defaultTag 
     
    7879  } 
    7980 
    80   addEventListener('keypress', function(e){ 
    81     var c = (e.ctrlKey) 
    82     var s = (e.shiftKey) 
     81  addEventListener('keypress', function(e) { 
     82    var c = e.ctrlKey 
     83    var s = e.shiftKey 
    8384    var v = (e.keyCode == 13) 
    8485    if (c && s && v) { 
    85       if (useTinyURL) { 
     86      if (useIsgd) { 
    8687        createTinyURL(document.location.href, function(url) { 
    8788          new Browsing(url) 
     
    8990      } 
    9091      else { 
    91         new Browsing(document.location.href); 
     92        new Browsing(document.location.href) 
    9293      } 
    9394    } 
    9495  }, true) 
    9596 
    96     function createTinyURL(url,callback,error) { 
    97         GM_xmlhttpRequest({ 
    98             method : 'post', 
    99             url    : 'http://is.gd/api.php?longurl=' + encodeURIComponent(url), 
    100             headers:{"Content-type":"application/x-www-form-urlencoded"}, 
    101             onload : function(res) { 
    102                 if (res.responseText != 'Error') callback(res.responseText) 
    103                 else if (typeof error == 'function') error(res) 
    104             }, 
    105             onerror: error, 
    106         }) 
    107     } 
     97  function createTinyURL(url, callback, error) { 
     98    GM_xmlhttpRequest({ 
     99      method : 'post', 
     100      url    : 'http://is.gd/api.php?longurl=' + encodeURIComponent(url), 
     101      headers: { 'Content-type': 'application/x-www-form-urlencoded' }, 
     102      onload : function(res) { 
     103        if (res.responseText != 'Error') callback(res.responseText) 
     104        else if (typeof error == 'function') error(res) 
     105      }, 
     106      onerror: error, 
     107    }) 
     108  } 
    108109 
    109110  function tinyURLError(res) { 
    110     if (useAlert) alert('tinyurl failed!') 
    111     error('TinyURL Failed - ' + res.status + ': ' + res.statusText) 
     111    if (useAlert) alert('is.gd failed!') 
     112    error('is.gd Failed - ' + res.status + ': ' + res.statusText) 
    112113  } 
    113114