// ==UserScript== // @name:zh-CN 淘宝搜索PLUS // @name:zh-TW 淘寶搜索PLUS // @name taobao search plus // @description:zh-CN 淘宝搜索页面自动加载店铺评分,无需鼠标悬停查看!快速查看店铺评分以及同行对比! | 搜索页面自定义排序方式与显示方式 // @description:zh-TW 淘寶搜索頁面自動加載店鋪評分,無需鼠標懸停查看!快速查看店鋪評分以及同行對比! | 搜索頁面自定義排序方式與顯示方式 // @description Auto load shop information, customize the default sort order and ui style(gird or list). // @icon https://www.taobao.com/favicon.ico // @version 1.1.0 // @author olOwOlo // @namespace https://olowolo.com // @homepage https://github.com/olOwOlo/script/tree/master/taobao-search-plus // @supportURL https://github.com/olOwOlo/script // @license MIT // @match https://s.taobao.com/search?* // @run-at document-start // @grant GM_setValue // @grant GM_getValue // @grant GM_addStyle // @grant GM_registerMenuCommand // @downloadURL none // ==/UserScript== // /* * Copyright (c) 2017 olOwOlo * Released under the MIT License. */ 'use strict'; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } (function () { 'use strict'; var DEBUG = false; function myLog(str) { if (DEBUG) console.log(str); } (function () { var globalSort = typeof GM_getValue('sort') === 'undefined' ? 'default' : GM_getValue('sort'); var globalStyle = typeof GM_getValue('style') === 'undefined' ? 'grid' : GM_getValue('style'); myLog('[sort = ' + GM_getValue('sort') + ', style = ' + GM_getValue('style') + ']'); function parseArgument() { var argvMap = new Map(); var argvArray = window.location.search.substr(1).split('&'); var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = argvArray[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var string = _step.value; argvMap.set.apply(argvMap, _toConsumableArray(string.split('='))); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return argvMap; } var argv = parseArgument(); var href = window.location.href; if (globalSort !== 'default' && typeof argv.get('sort') === 'undefined') { href += '&sort=' + globalSort; } if (globalStyle !== 'grid' && typeof argv.get('style') === 'undefined') { href += '&style=' + globalStyle; } if (href !== window.location.href) { myLog('redirect... Old href = [' + window.location.href + ']'); window.location.href = href; } var sortOption = ['default', 'renqi-desc', 'sale-desc', 'credit-desc', 'price-asc', 'price-desc', 'total-asc', 'total-desc']; var styleOption = ['grid', 'list']; var Setting = function () { // 传入数据{sort: sort, style: style}为有效值 function Setting(setting) { _classCallCheck(this, Setting); this.sort = setting.sort; this.style = setting.style; } _createClass(Setting, [{ key: 'toString', value: function toString() { return '[sort = ' + this.sort + ', style = ' + this.style + ']'; } }, { key: 'createUI', value: function createUI() { var _this = this; var userInterface = document.createElement('div'); userInterface.innerHTML = '