Greasy Fork

SGW Fixer - Users

Contains user definitions for the SGW Fixer script

目前为 2016-03-31 提交的版本。查看 最新版本

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.greasyfork.icu/scripts/13969/116469/SGW%20Fixer%20-%20Users.js

// ==UserScript==
// @name        SGW Fixer - Users
// @namespace   https://greasyfork.org
// @include     https://sellers.shopgoodwill.com/sellers/newAuctionItem-catsel.asp*
// @include     https://sellers.shopgoodwill.com/sellers/reviewItem-label.asp*
// @include     https://sellers.shopgoodwill.com/sellers/reviewItem-label.asp?state=2
// @include     https://sellers.shopgoodwill.com/sellers/listerpostings.asp*
// @include     http://localhost/sgw.html
// @version     1.3.5.1
// @description Contains user definitions for the SGW Fixer script
// @grant       none
// @require     https://greasyfork.org/scripts/10208-gm-api-script/code/GM%20API%20script.js?version=54964
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js
// ==/UserScript==

this.$ = this.jQuery = jQuery.noConflict(true);

jQuery.fn.filterByText = function(textbox, selectSingleMatch) {
  return this.each(function() {
    var select = this;
    var options = [];
    $(select).find('option').each(function() {
      options.push({value: $(this).val(), text: $(this).text()});
    });
    $(select).data('options', options);
    $(textbox).bind('change keyup', function() {
      var options = $(select).empty().scrollTop(0).data('options');
      var search = $.trim($(this).val());
      var regex = new RegExp(search,'gi');
 
      $.each(options, function(i) {
        var option = options[i];
        if(option.text.match(regex) !== null) {
          $(select).append(
             $('<option>').text(option.text).val(option.value)
          );
        }
      });
      if (selectSingleMatch === true && 
          $(select).children().length === 1) {
        $(select).children().get(0).selected = true;
      }
    });
  });
};

var myPosters = {
    "Ann S" : {
        "name" : "Ann",
        "duration" : 7
    },
    "Jeff H" : {
        "name" : "Jeff",
        "duration" : 7,
        "skip" : "allow",
    },
    "Jacob L" : {
        "name" : "Jacob",
        "duration" : 7,
        "skip" : "allow",
    },
    "Jackie C" : {
        "name" : "Jackie"
    },
    "Jeremy J" : {
        "name" : "Jeremy",
        "skip" : "allow",
    },
    "Kathy O" : {
        "name" : "Kathy",
        "skip" : "allow",
    },
    "Matt R" : {
        "name" : "Matt",
    },
    "Nick Q" : {
        "name" : "Nick"
    },
    "Phalada X" : {
        "name" : "Phalada",
        "duration" : 7,
        "skip" : "allow",
    },
    "Steven R" : {
        "name" : "Steven",
        "skip" : "allow",
    },
    "Tanya K" : {
        "name" : "Tanya"
    },
    "Tom B" : {
        "name" : "Tom",
    },
    "Valerie W" : {
        "name" : "Valerie",
        "duration" : 7,
        "skip" : "allow",
    },
    "Jane F" : {
        "name" : "Jane",
        "duration" : 7,
        "skip" : "allow",
    },
}

serial = JSON.stringify(myPosters);
//$('#posterData').html(serial);

$('body').append("<div id='posterData'>" + serial + "</div>");

/*$('#posterData').data("data", "fooooo");
console.log('foo' + $('#posterData').data("data"));*/