👹dpz Fork

    @@ -1,15 +1,19 @@ /* * @title 👹dpz * @description X-platform Daily Portal Z Eternity in Hell -- Mugen Jigoku; Avici hell - * @include http://* - * @include https://* + * @include http://portal.nifty.com/* * @license MIT License https://opensource.org/licenses/MIT * @javascript_url */ + // 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
    @@ -25,7 +29,7 @@ // if you want to avoid CORS/Mixed-Content, use CORS-proxy c.f. // http://let.hatelabo.jp/noromanba/let/hJmc7rWIvsJj // from pop-up - // https://portal.nifty.com/component/jigoku_pop.htm + // 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, {
    @@ -40,7 +44,7 @@ }).then(url => { location.href = url; }).catch(err => { - window.alert('⚠️', err); - }); + window.alert('⚠️' + err); + }).finally(() => clearTimeout(timer)); })();
  • /*
     * @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
     */
    
    // 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
      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 です。