コンテンツにスキップ

利用者:タバコはマーダー/AutoNightMode.js

お知らせ: 保存した後、ブラウザのキャッシュをクリアしてページを再読み込みする必要があります。

多くの WindowsLinux のブラウザ

  • Ctrl を押しながら F5 を押す。

Mac における Safari

  • Shift を押しながら、更新ボタン をクリックする。

Mac における ChromeFirefox

  • Cmd Shift を押しながら R を押す。

詳細についてはWikipedia:キャッシュを消すをご覧ください。

AutoNightMode();
function AutoNightMode() {
  if (new Date().getHours() < 7 || 17 <= new Date().getHours());
    addCss ([
      'body { background: #222; color: #eee; }',
      '.mw-body { border-color : #333333; }',
      'a { color: #42a5d6; }',
      'a.external { color: #7a9bd4 !important; }',
      'a.new {color: #dc7b7b; }',
      '#p-personal a.new {color: #dc7b7b; }',
      '.mw-notification, .postedit, .postedit-icon { background: #333; color: #eee; }',
      
      /*記事本文*/
      '#content { background-color: #333; color: #dddddd; }',
      'h1, h2, h3, h4, h5, h6 { color: #ddd; border-bottom-color: #64676b ;} ',
      
      /*上タブ*/
      '#mw-page-base { background: linear-gradient(#333333, #222222); }',
      '.vectorTabs { background: linear-gradient(#000000, #999999); }',
      '.vectorTabs ul li { background: linear-gradient(#686868, #303030); }',
      
      '.vectorTabs li.selected { background: linear-gradient(#686868, #303030); }',
      '.vectorTabs li.selected a { color: #eeeeee; }',
      '.vectorTabs li a { color: #bcd8ec; }',
      '.vectorMenu h3 span { color: #eeeeee; }',
      
      '#simpleSearch { background-color: #333; background-image: none; }',
      '#simpleSearch input { background-color: #333; color: #eeeeee; }',
      
      /*カテゴリ*/
      '.catlinks { border-color: #111; background-color: #111; }',
      
      /*何やった?笑*/
      'left-navigation a { color: #42a5d6; }',
      'kbd {color:#000; filter: invert(100%);}',
      'pre{ filter: invert(100%); }',
      '.ace_editor, .codeEditor-status{ filter: invert(100%); }',
      
      /*左サイドバー*/
      '#mw-panel .portal h3 { color: #d8d2d2; }',
      '#mw-panel li a { color: #d2b783 !important; }',
      '#mw-panel .portal .body { background-image: none; }',
      /*footer*/
      '#footer ul li { color: #f3ecec; }',
      '#footer ul li a { color: #f3ecec !important;; }',
      '#footer-icons img { filter: invert(10%); }',
      
      /* 編集ページ */
      '#wpTextbox1 { background: #333; color: #eeeeee; }',
      '.editOptions { background: #222; color: #eeeeee; }',
      '#wpSummary { background-color: #333; color: #eeeeee; }',
      '#wikiEditor-ui-toolbar, #wpMinoreditWidget, #wpWatchthisWidget { filter: invert(100%); }',
      '#wpPreviewWidget, #wpDiffWidget, #custumReplace { filter: invert(100%); }',
      
      /* watch list */
      '.oo-ui-buttonElement-button {filter: invert(100%);}',
      '.oo-ui-tagMultiselectWidget-handle {filter: invert(100%);}',
      '.mw-changeslist-legend { color: #000; filter: invert(100%); }',
      
      /*目次*/
      'div#toc { background: #222 !important; color: #eee !important; border: 1px solid black;}',
      
      /* thumb  */
      '.thumbinner { background: #222 !important; color: white; border: 1px solid black !important;}',
      '.thumbinner img { border: 1px solid black !important;}',
      '.thumb { background: #222 !important; color: white; border: 1px solid black !important;}',
      
      /*テンプレ系*/
      '.navbar { background: #222 !important; color: #eee !important; }',
      '.navbar span { background: #222 !important; color : #42a5d6 !important ;}',
      '.pathnavbox { background: #2a0138 ; border :none ;}',
      'table, table.wikitable, table.infobox, table.navbox, table.ambox, table.asbox { background: #222 !important; color: #dddddd !important; border-color: black !important;}',
      'table.wikitable th, table.infobox th, table.navbox th { background: #111 !important; color: #dddddd !important; border-color: black ;}',
      'table.wikitable td, table.infobox td,  table.navbox td{ background: #333 !important; color: #dddddd !important;}',
      '.navbox-even { background: #111111 ;}',
      'table img { background: #eeeeee ;}',
      'table a, table.infobox a, table.navbox a, table.ambox a, table.asbox a { color: #3972de; }',
      
      
    ]);

    function addCss(a) {
      var styleTag = document.createElement("style");
      var head = document.getElementsByTagName("head")[0];
      head.appendChild(styleTag);
      var thisSheet = styleTag.sheet ? styleTag.sheet : styleTag.styleSheet;
      if (thisSheet.insertRule)
        for (var i in a)
          thisSheet.insertRule(a[i]);
      else
        for (var i in a) {
          var t = a[i].split("{");
          var cssRule = t[1].slice(0, -1);
          thisSheet.addRule(t[0], cssRule);
        }
    }

}