Cookie Clicker clicker

    
      
  • /*
     * @title 自動クッキー叩き
     * @description Cookie Clicker( http://orteil.dashnet.org/cookieclicker/ )にてクッキーを自動でクリックし続ける
     */
    
    (function() {
    
      //// Auto Click the Big Cookie ////
      
      setInterval(function() {
        document.querySelector('#bigCookie').click();
      }, 1000/16); // meijin
    
      //// Auto Click Golden Cookies ////
    
      var isDisplayNone = function(node) {
        return document.defaultView.getComputedStyle(node).getPropertyValue('display') === 'none';
      }
    
      var $q = function(sel) {
        return Array.prototype.slice.call(document.querySelectorAll(sel));
      }
    
      // MutationObserver - Web API interfaces | MDN
      // https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
    
      // select the target node
      var goldenCookie = document.querySelector('#goldenCookie');
    
      // create an observer instance
      var gcObserver = new MutationObserver(function(mutations, observer) {
        mutations.forEach(function(mutation) {
          if (!isDisplayNone(mutation.target)) {
            mutation.target.click();
            var popupTxt = '';
            $q('#particles > div').some(function(p) {
              if (!isDisplayNone(p) && p.textContent !== 'Game saved') {
                popupTxt = p.textContent;
              }
              return popupTxt;
            });
            console.log([
              'clicked Goleden Cookie',
              new Date().toLocaleFormat('%Y-%m-%d %T %Z'),
              popupTxt,
            ].join(', '));
          }
        });
      });
    
      // configuration of the observer:
      var gcConfig = { attributes: true, attributeFilter: ['style'] };
    
      //pass in the target node, as well as the observer options
      gcObserver.observe(goldenCookie, gcConfig);
    
      // later, you can stop observing
      // gcObserver.disconnect();
    
      console.log('loaded 自動クッキー叩き')
    
    })();
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2013/10/03 00:55:59 - 2013-10-03
  2. 2013/10/02 07:54:15 - 2013-10-02
  3. 2013/10/02 07:42:40 - 2013-10-02
  4. 2013/10/02 07:35:39 - 2013-10-02
  5. 2013/10/02 07:33:06 - 2013-10-02
  6. 2013/10/01 18:45:05 - 2013-10-01
  7. 2013/10/01 04:01:47 - 2013-10-01
  8. 2013/10/01 03:59:14 - 2013-10-01
  9. 2013/09/30 05:45:55 - 2013-09-30
  10. 2013/09/30 05:43:33 - 2013-09-30
  11. 2013/09/28 08:38:06 - 2013-09-28
  12. 2013/09/28 08:37:17 - 2013-09-28
  13. 2013/09/28 08:21:31 - 2013-09-28
  14. 2013/09/28 07:11:18 - 2013-09-28