EnstylerJS

MyDealz Enstyler Frontend and enhanced features

目前為 2016-10-28 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        EnstylerJS
// @namespace   Enstyler
// @description MyDealz Enstyler Frontend and enhanced features
// @include     http://www.mydealz.de/*
// @include     https://www.mydealz.de/*
// @version     2.10.281
// @grant       GM_getValue
// @grant       GM_setValue
// @grant       GM_log
// @require     https://openuserjs.org/src/libs/sizzle/GM_config.js
// ==/UserScript==


// create enstyler "Menu Button"
var input = document.createElement('input');
input.type = 'button';
input.value = 'Enstyler';
input.onclick = showEnstylerConfig;

// add to subnav and format 
input.className = 'box--all-i subNavMenu-link'
input.setAttribute('style', 'font-size: 1.28571em; font-weight: 700; top: 3px; left: -0.7em');
document.getElementById('tour-filter').appendChild(input);

// hide Enstyler2 CSS (c) text
addStyleString('.threadWidget-footer::after {display: none !important};');

// basic config panel formatting, everything else is formatted by enstyler
var enCSS = ['#GM_config { left: 5% !important; top: 5% !important; height: auto !important; min-width: 19em; max-width: 33em !important;}',
             '#GM_config .field_label {  display: inline-block; min-width: 10em; font-weight: unset; margin-left: 1em; margin-right: 0;}',
             '#GM_config input[type=button], #GM_config button { border: 1px solid; margin: 0.5em 0em 0.2em 1em; padding: 0.1em;}',
             '#GM_config .reset { font-size: 9pt; padding-right: 1em; }',
            ].join(" ");
addStyleString(enCSS);


// call back for input.onklick
function showEnstylerConfig() {
    GM_config.open();
}


// define GM_config elements
var fieldDefs = {
    'enstyler': {
      'section': ['additonal features for Enstyler', ''],
      'label': 'Install / Update CSS...', // Appears on the button
      'type': 'button', // Makes this setting a button input
      'click': function() { // Function to call when button is clicked
               showUrl('https://userstyles.org/styles/128262#style-info'); }
    },

    'mobileRedirect': {
      'label': 'Amazon mobile redirect...', // Appears on the button
      'type': 'button', // Makes this setting a button input
      'click': function() { // Function to call when button is clicked
               showUrl('https://greasyfork.org/de/scripts/17013'); }
    },

   'dontCookies': {
      'label': 'Mozilla no cookies...', // Appears on the button
      'type': 'button', // Makes this setting a button input
      'click': function() { // Function to call when button is clicked
               showUrl('https://addons.mozilla.org/de/addon/i-dont-care-about-cookies/'); }
    },

  
  
   'hidden1': {
      'section': ['Configuration', ''],
        'type': 'hidden', // Makes this setting a hidden input
        'value': 'Some hidden value' // Value stored
   },
  
  'enConf_ShowA': {
      'label': 'Nothing to config A', // Appears next to field
      'type': 'checkbox', // Makes this setting a checkbox input
      'default': true // Default value if user doesn't change it
    },
  
   'enConf_ShowB': {
      'label': 'Nothing to config B', // Appears next to field
      'type': 'checkbox', // Makes this setting a checkbox input
      'default': true // Default value if user doesn't change it
    },
  
  
   'copy': {
        'section': ['', '(c) Gnadelwartz - <a target="blank" href="https://www.mydealz.de/diskussion/enstyler2-style-your-mydealz-incl-pepper-sites-736219">Enstyler2 - Style your MyDealz</a>'],
        'type': 'hidden', // Makes this setting a hidden input
        'value': 'Some hidden value' // Value stored
   },
};


// display GM_copnfig as div, so we cam apply CSS!!
var frame = document.createElement('div');
document.body.appendChild(frame);

GM_config.init(
  {
    id: 'GM_config',
    title: 'EnstylerJS - Settings', 
    fields: fieldDefs, 
   'frame': frame // Element used for the panel
  }
);


//=========== Support functions for actual use =======

// display website in external window
function showUrl(str) {
    window.open(str, "Enstyler", "height=800,width=600");
}

// add CSS in to document
function addStyleString(str) {
    var node = document.createElement('style');
    node.innerHTML = str;
    document.body.appendChild(node);
}