Show
Ignore:
Timestamp:
09/05/08 02:05:59 (3 months ago)
Author:
drry
Message:
  • added an URL to the @include.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/userscripts/customPalletForHaiku/trunk/customPalletForHaiku.user.js

    r15669 r18866  
    33// @namespace      http://kojiran.googlepages.com/ 
    44// @include        http://h.hatena.ne.jp/* 
     5// @include        http://h.hatena.com/* 
    56// @version        0.22 
    67// 
     
    1314// ==/UserScript== 
    1415 
    15 (function(){ 
     16(function() { 
    1617 
    1718  if ( !(unsafeWindow && unsafeWindow.Hatena && unsafeWindow.Hatena.Star) ) 
     
    3334 
    3435  // 
    35   var Wedata = (function(){ 
    36  
    37     function getHatenaID (){ 
     36  var Wedata = (function() { 
     37 
     38    function getHatenaID () { 
    3839      return unsafeWindow.Hatena.Visitor.name; 
    3940    } 
     
    5051 
    5152    return { 
    52       fetch: function(){ 
     53      fetch: function() { 
    5354        GM_xmlhttpRequest({ 
    5455          method: 'GET', 
    55           url:     WEDATA_FETCH, 
     56          url:    WEDATA_FETCH, 
    5657          onload: function(res) { 
    57             if ( res.status != 200 ){ 
     58            if ( res.status != 200 ) { 
    5859              alert('something wrong...' + 
    5960                    res.status + 
     
    6768              if (!( items instanceof Array )) throw new Error; 
    6869              var dic = {}; 
    69               items.forEach( function(item){ 
     70              items.forEach( function(item) { 
    7071                dic[item.name] = item.data.colors.split(/\s+/); 
    7172              }); 
     
    8485      }, 
    8586 
    86       fix: function( name, pallet ){ 
    87         if( !confirm('really ??') ) return; 
     87      fix: function( name, pallet ) { 
     88        if ( !confirm('really ??') ) return; 
    8889        var data = { name: name , data: { colors: pallet } }; 
    8990        if ( unsafeWindow.CustomPalletForHaikuPallets[name] instanceof Array ) { 
     
    9899  function getCookie(key) { 
    99100    var re = new RegExp(key + "=([^;]+)", "i"); 
    100     document.cookie.match(re); 
    101  
    102     return(RegExp.$1 ? unescape(RegExp.$1) : ""); 
     101 
     102    return(re.test(document.cookie) ? unescape(RegExp.$1) : ""); 
    103103  } 
    104104 
     
    109109  // But work with real window object. 
    110110  location.href = 'javascript:(' + function() { 
    111     (function (w) { 
     111    (function(w) { 
    112112 
    113113      function log () { 
     
    118118      } 
    119119 
    120       function delayUntill( cond, action , max ){ 
    121         setTimeout( function(){ 
     120      function delayUntill( cond, action , max ) { 
     121        setTimeout( function() { 
    122122          if ( cond() ) { 
    123123            action(); 
    124           } else if ( max > 0 ){ 
     124          } else if ( max > 0 ) { 
    125125            delayUntill( cond , action , max - 1 ); 
    126126          } 
     
    129129 
    130130      // initialize ... 
    131       function initSelector(){ 
     131      function initSelector() { 
    132132        var entryForm     = $X('.//form[@class="entry-form"]')[0]; 
    133133        var textContainer = $X('div[@class="text-container"]', entryForm)[0]; 
    134         var colors = $N('span', {style: ["margin: 5px 5px"].join(';'), 
     134        var colors = $N('span', {style: "margin: 5px", 
    135135          id: 'pallet-colors'}); 
    136         var changer = function () { 
     136        var changer = function() { 
    137137          for (var i = 0, l = colors.childNodes.length; i < l; i++) { 
    138138            colors.removeChild(colors.firstChild); 
    139139          } 
    140           CustomPalletForHaikuPallets[select.value].forEach(function (color) { 
     140          CustomPalletForHaikuPallets[select.value].forEach(function(color) { 
    141141            var cell = $N('span', {style: [ 
    142142              "background: #" + color, 
     
    163163        var $E = Ten.DOM.getElementsByTagAndClassName; 
    164164        var textSelector = $E('img', 'input-selector-text')[0]; 
    165         new Ten.Observer(textSelector, 'onclick', function () { 
     165        new Ten.Observer(textSelector, 'onclick', function() { 
    166166          select.style.display = 'inline'; 
    167167          colors.style.display = 'inline'; 
    168168        }); 
    169169        var drawSelector = $E('img', 'input-selector-draw')[0]; 
    170         new Ten.Observer(drawSelector, 'onclick', function () { 
     170        new Ten.Observer(drawSelector, 'onclick', function() { 
    171171          select.style.display = 'none'; 
    172172          colors.style.display = 'none'; 
    173173        }); 
    174174        var webcamSelector = $E('img', 'input-selector-webcam')[0]; 
    175         new Ten.Observer(webcamSelector, 'onclick', function () { 
     175        new Ten.Observer(webcamSelector, 'onclick', function() { 
    176176          select.style.display = 'none'; 
    177177          colors.style.display = 'none'; 
     
    185185        SWFObject.prototype = deconcept.SWFObject.prototype; 
    186186 
    187         (function(orig){ 
    188           Hatena.Haiku.EntryForm.prototype.writeDrawForm = function(){ 
    189             if ( this.canvas ){ 
     187        (function(orig) { 
     188          Hatena.Haiku.EntryForm.prototype.writeDrawForm = function() { 
     189            if ( this.canvas ) { 
    190190              var canvas = this.canvas; 
    191191              var swf = canvas.getSWF(); 
     
    204204      } 
    205205 
    206       delayUntill( function(){ return CustomPalletForHaikuPallets } , 
     206      delayUntill( function() { return CustomPalletForHaikuPallets } , 
    207207                   initSelector, 100 ); 
    208208 
     
    217217          else ret.setAttribute(k, v); 
    218218        } 
    219         switch(typeof childs){ 
     219        switch (typeof childs) { 
    220220        case "string": 
    221221          ret.appendChild(document.createTextNode(childs)); 
     
    246246        var type, namespace={}; 
    247247        // console.log(String(exp)); 
    248         if(typeof context == "function"){ 
     248        if (typeof context == "function") { 
    249249          type = context; 
    250250          context = null; 
    251         }else if(typeof context != "undefined" && !context['nodeType']){ 
     251        } else if (typeof context != "undefined" && !context['nodeType']) { 
    252252          type = context['type']; 
    253253          namespace = context['namespace'] || context['ns']; 
     
    256256 
    257257        if (!context) context = document; 
    258         var exp = (context.ownerDocument || context).createExpression(exp, function (prefix) { 
     258        var exp = (context.ownerDocument || context).createExpression(exp, function(prefix) { 
    259259          return namespace[prefix] || 
    260260            document.createNSResolver((context.ownerDocument == null ? context : context.ownerDocument)