👹dpz Fork

    @@ -1,11 +1,17 @@ /* * @title 👹dpz - * @description X-platform Daily Portal Z Eternity in Hell -- Mugen Jigoku; Avici hell + * @description X-platform Daily Portal Z Eternity in Hell -- Mugen Jigoku; Avici Hell * @include http://portal.nifty.com/* * @license MIT License https://opensource.org/licenses/MIT * @javascript_url */ + /* mobile + javascript:(function(){'use strict';'portal.nifty.com'!==location.hostname&&(location.href='http://portal.nifty.com');var a=new AbortController,b=a.signal,c=5000;b.onabort=function(){window.alert('\uD83D\uDCE1timeout: '+c+' sec elapsed')};var d=setTimeout(function(){return a.abort()},c);fetch('http://portal.nifty.com/cs/catalog/portal_headline/random/1.htm',{signal:b,credentials:'same-origin',referrer:'no-referrer'}).then(function(f){return f.ok&&200===f.status?f.url:Promise.reject(new Error(f))}).then(function(f){location.href=f}).catch(function(f){window.alert('\u26A0\uFE0F'+f)}).finally(function(){return clearTimeout(d)})})(); + */ + // minified w/ Babili c.f. + // https://babeljs.io/repl/ + // TODO handle https (() => { 'use strict';
    @@ -17,13 +23,13 @@ // timeout // https://gist.github.com/noromanba/7e76cd75d15e27b102007298a8156d8f // TBD Promise based functionize - // Chrome 66+ / Firefox 57+ / Safari 11.1+ c.f. + // `AbortController` required Chrome 66+ / Firefox 57+ / Safari 11.1+ c.f. // https://developer.mozilla.org/en-US/docs/Web/API/AbortController const controller = new AbortController(); const signal = controller.signal; const TIMEOUT = 1000 * 5; signal.onabort = () => { - window.alert`timeout: ${TIMEOUT} sec elapsed`; + window.alert('📡timeout: ' + TIMEOUT + ' sec elapsed'); }; const timer = setTimeout(() => controller.abort(), TIMEOUT);
  • /*
     * @title 👹dpz
     * @description X-platform Daily Portal Z Eternity in Hell -- Mugen Jigoku; Avici Hell
     * @include http://portal.nifty.com/*
     * @license MIT License https://opensource.org/licenses/MIT
     * @javascript_url
     */
    
    /* mobile
    javascript:(function(){'use strict';'portal.nifty.com'!==location.hostname&&(location.href='http://portal.nifty.com');var a=new AbortController,b=a.signal,c=5000;b.onabort=function(){window.alert('\uD83D\uDCE1timeout: '+c+' sec elapsed')};var d=setTimeout(function(){return a.abort()},c);fetch('http://portal.nifty.com/cs/catalog/portal_headline/random/1.htm',{signal:b,credentials:'same-origin',referrer:'no-referrer'}).then(function(f){return f.ok&&200===f.status?f.url:Promise.reject(new Error(f))}).then(function(f){location.href=f}).catch(function(f){window.alert('\u26A0\uFE0F'+f)}).finally(function(){return clearTimeout(d)})})();
    */
    // minified w/ Babili c.f.
    // https://babeljs.io/repl/
    
    // TODO handle https
    (() => {
      'use strict';
    
      if (location.hostname !== 'portal.nifty.com') {
        location.href = 'http://portal.nifty.com';
      }
    
      // timeout
      // https://gist.github.com/noromanba/7e76cd75d15e27b102007298a8156d8f
      // TBD Promise based functionize
      // `AbortController` required Chrome 66+ / Firefox 57+ / Safari 11.1+ c.f.
      // https://developer.mozilla.org/en-US/docs/Web/API/AbortController
      const controller = new AbortController();
      const signal = controller.signal;
      const TIMEOUT = 1000 * 5;
      signal.onabort = () => {
        window.alert('📡timeout: ' + TIMEOUT + ' sec elapsed');
      };
      const timer = setTimeout(() => controller.abort(), TIMEOUT);
    
      // XXX you can connect https but not set CORS, so request was blocked
      //     if you want to avoid CORS/Mixed-Content, use CORS-proxy c.f.
      //     http://let.hatelabo.jp/noromanba/let/hJmc7rWIvsJj
      // from pop-up
      // http://portal.nifty.com/component/jigoku_pop.htm
      const RANDOM_API = 'http://portal.nifty.com/cs/catalog/portal_headline/random/1.htm';
    
      fetch(RANDOM_API, {
        signal,
        credentials: 'same-origin', // dpz members
        referrer: 'no-referrer',
      }).then(res => {
        if (!res.ok || res.status !== 200) {
          return Promise.reject(new Error(res));
        }
        return res.url;
      }).then(url => {
        location.href = url;
      }).catch(err => {
        window.alert('⚠️' + err);
      }).finally(() => clearTimeout(timer));
    })();
    
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。