Marti Admin

Re: @Zren:

Not sure why it stopped updating when I push to GitHub.

Here and here. You weren't logged in with your GH account in a while. Everyone, including Mods and up are required to do this.

OUJS Admin


Re: @Zren:

Not sure why it stopped automatically updating when I pushed to GitHub.

Here and here. You weren't logged in with your GH account in a while. Everyone, including Mods and up are required to do this.

OUJS Admin



Here is the proper way to remedy item 2:

--- /scripts/kissaa6/[tbpublic]_淘宝天猫购物优惠券_搜券助手_省钱必备工具(直接显示优惠券)(2018-07-24)/source@18.07.24+480a56e
+++ /scripts/kissaa6/[tbpublic]_淘宝天猫购物优惠券_搜券助手_省钱必备工具(直接显示优惠券)(2018-07-24)/source
@@ -3,6 +3,7 @@
 // @name         [tbpublic] 淘宝天猫购物优惠券 搜券助手 省钱必备工具(直接显示优惠券)(2018-07-24)
 // @author       tbpublic
 // @collaborator Calf
+// @copyright    2018, skypesky (https://openuserjs.org/users/skypesky)
 // @copyright    2018, Calf (https://www.tbpublic.com)
 // @version      18.07.24
 // @description  [tbpublic.com]支持手机扫描二维码领取优惠券 淘宝天猫购物优惠券 优惠券 省钱必备工具 最新版(2018-07-24) 

  1. You didn't using "Submit Code as Fork"... this is fixed for the moment.
  2. You stripped a prior Authors @copyright out of the script... see diff below:
--- /scripts/skypesky/(skypesky.cn)_淘宝天猫购物优惠券_搜券助手_省钱必备工具/source@18.07.17+36f6406
+++ /scripts/kissaa6/[tbpublic]_淘宝天猫购物优惠券_搜券助手_省钱必备工具(直接显示优惠券)(2018-07-24)/source@18.07.24+480a56e
@@ -1,37 +1,33 @@
 // ==UserScript==
-// @namespace    https://openuserjs.org/user/skypesky
-// @name         (skypesky.cn) 淘宝天猫购物优惠券 搜券助手 省钱必备工具
-// @author       skypesky
-// @collaborator liang
-// @copyright    2018, skypesky (https://openuserjs.org/users/skypesky)
-// @version      18.07.17
-// @description  [skypesky 出品]支持手机扫描二维码领取优惠券 淘宝天猫购物优惠券 优惠券 省钱必备工具 最新版(2018-07-17) 
+// @namespace    https://www.tbpublic.com
+// @name         [tbpublic] 淘宝天猫购物优惠券 搜券助手 省钱必备工具(直接显示优惠券)(2018-07-24)
+// @author       tbpublic
+// @collaborator Calf
+// @copyright    2018, Calf (https://www.tbpublic.com)
+// @version      18.07.24
+// @description  [tbpublic.com]支持手机扫描二维码领取优惠券 淘宝天猫购物优惠券 优惠券 省钱必备工具 最新版(2018-07-24) 
 
-// @license Apache-2.0
-
 // @connect      *
 // @grant        GM_getResourceText
 // @grant        GM_addStyle
 
-
-// ==========================详情页===========================
+// ==========================搜索页===========================
 // @include      http*://s.taobao.com/search*
+// @include      http*://s.taobao.com/list*
 // @include      http*://list.tmall.com*
 // @include      http*://list.tmall.hk/search_product.htm*
 // @include      http*://www.tmall.com/*
 
-// ==========================搜索页============================
+// ==========================详情页============================
 // @include      http*://item.taobao.com/*
 // @include      http*://detail.tmall.com/*
 // @include      http*://chaoshi.detail.tmall.com/*
 // @include      http*://detail.tmall.hk/*
-// @include      http*://detail.yao.95095.com/item.htm*
 
 // ==========================资源============================
 // @resource     toastr https://cdn.bootcss.com/izitoast/1.3.0/css/iziToast.min.css
 // @resource     contexMenu https://cdn.bootcss.com/jquery-contextmenu/2.6.1/jquery.contextMenu.min.css
 
-
 // ==========================js============================
 // @require      https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js
 // @require      https://cdn.bootcss.com/jquery.qrcode/1.0/jquery.qrcode.min.js
@@ -39,21 +35,18 @@
 // @require      https://cdn.bootcss.com/jquery-contextmenu/2.6.1/jquery.contextMenu.min.js
 // @require      https://cdn.bootcss.com/izitoast/1.3.0/js/iziToast.min.js
 
-
+// @license Apache-2.0
 // ==/UserScript== 
 
-
 const config = {
-    successClassTag: `skypesky-search-success`,
-    errorClassTag: `skypesky-search-error`,
+    successClassTag: `tbpublic-search-success`,
+    errorClassTag: `tbpublic-search-error`,
     requestApi: {
-        url: "https://skypesky.cn/api/search",
+        url: "https://www.tbpublic.com/api/search.php",
         method: "POST"
     }
 };
 
-
-
 (function () {
 
     'use strict';
@@ -227,7 +220,33 @@
             'product': {
                 'selector': 'div.product[data-id]'
             }
-        }
+        },
+		{
+			'webUrl': 'https://s.taobao.com/list*',
+			'testUrl': [
+				'https://s.taobao.com/list?spm=a21bo.2017.201867-links-0.30.18e911d9BJRpZP&cat=16&style=grid&seller_type=taobao&oetag=14897'
+			],
+			'description': '淘宝网类目列表',
+			'rule': /\/\/s.taobao.com\/list/,
+			'id': {
+				'selector': '.title a[data-nid]',
+				'attr': 'data-nid'
+			},
+			'title': {
+				'selector': 'div.title a',
+			},
+			'image': {
+				'selector': '.pic-box-inner'
+			},
+			'url': {
+				'selector': '.title a[href]',
+				'attr': 'href'
+			},
+			'imgurl': {
+				'selector': '.pic a[href]',
+				'attr': 'href'
+			}
+		}
     ];
 
     $(function () {
@@ -288,23 +307,28 @@
             id: id
         },
         success: (res) => {
-            if (res && res.flag) { // 优惠券存在                
+            if (res != null && res.flag) { // 优惠券存在                
                 // 更新discountIcon
-                this.updateDiscountIcon("查找成功! " + res.data.resultInfo.couponInfo);
-                this._discountIcon.attr('onclick', 'window.open("' + res.data.spreadUrl + '")');
+                this.updateDiscountIcon("查找成功! " + res.data.resultInfo.coupon_info);
+                this._discountIcon.attr('onclick', 'window.open("' + res.data.resultInfo.coupon_click_url + '")');
                 // 更新qrcode
-                this.updateQrcode(res.data.spreadUrl);
+                this.updateQrcode(res.data.resultInfo.coupon_click_url);
                 $(this._discountIcon).before(this._qrcode);
             } else { // 优惠券不存在
                 // 更新discountIcon
                 this.updateDiscountIcon('优惠券逃跑了*_*');
-                this._discountIcon.removeAttr('onclick');
+				// 设置跳转的链接
+				this._discountIcon.attr('onclick', 'window.open("' + res.url + '")');
+                //this._discountIcon.removeAttr('onclick');
+				// 更新qrcode
+				this.updateQrcode(res.url);
+				$(this._discountIcon).before(this._qrcode);
             }
         }
     });
 
     // click discountIcon
-    $('#skypesky-discountIcon').bind('click', (event) => {
+    $('#tbpublic-discountIcon').bind('click', (event) => {
         console.log(`再次发起请求`);
         // 验证id,title的合法性
         if (!Validate.checkIdAndTitle(id, title)) {
@@ -322,32 +346,48 @@
             success: (res) => {
                 if (res != null && res.flag) { // 优惠券存在
                     // 更新discountIcon
-                    this.updateDiscountIcon("查找成功! " + res.data.resultInfo.couponInfo);
+                    this.updateDiscountIcon("查找成功! " + res.data.resultInfo.coupon_info);
                     // 设置跳转的链接
-                    this._discountIcon.attr('onclick', 'window.open("' + res.data.spreadUrl + '")');
+                    this._discountIcon.attr('onclick', 'window.open("' + res.data.resultInfo.coupon_click_url + '")');
                     // 更新qrcode
-                    this.updateQrcode(res.data.spreadUrl);
+                    this.updateQrcode(res.data.resultInfo.coupon_click_url);
                     $(this._discountIcon).before(this._qrcode);
                 } else { // 优惠券不存在
                     // 更新discountIcon
                     this.updateDiscountIcon('优惠券逃跑了*_*');
-                    this._discountIcon.removeAttr('onclick');
+					// 设置跳转的链接
+					this._discountIcon.attr('onclick', 'window.open("' + res.url + '")');
+                    //this._discountIcon.removeAttr('onclick');
+					// 更新qrcode
+					this.updateQrcode(res.url);
+					$(this._discountIcon).before(this._qrcode);
                 }
             }
         });
     });
 
+	// on scroll
     $(window).scroll(function () {
         if ($(window).scrollTop() > 1000) {
             // 隐藏优惠券和qrcode
-            $('#skypesky-discountIcon').hide();
-            $('#skypesky-qrcode').hide();
+            $('#tbpublic-discountIcon').show();
+            $('#tbpublic-qrcode').show();
         } else {
-            $('#skypesky-discountIcon').show();
-            $('#skypesky-qrcode').show();
+            $('#tbpublic-discountIcon').show();
+            $('#tbpublic-qrcode').show();
         }
     });
+	
+	// show qrcode
+	$('#tbpublic-discountIcon').bind('mouseenter', function (event) {
+		$('#tbpublic-qrcode').show();
+	});
 
+	// hide qrcode
+	$('#tbpublic-discountIcon').bind('mouseleave', function (event) {
+		$('#tbpublic-qrcode').hide();
+	});
+
 };
 
 /*
@@ -355,10 +395,10 @@
  ** @param: text => 扫描链接
  ** @return: 返回qrcode
  */
-SingleProduct.prototype.createQrcode = function (text = 'http://weixin.qq.com/r/8DqNlTXEc2gMrXH292-i') {
+SingleProduct.prototype.createQrcode = function (text = 'https://u.wechat.com/MP6jvciuHJugDR573isWMDk') {
 
     text = Util.toUtf8(text);
-    let id = 'skypesky-qrcode';
+    let id = 'tbpublic-qrcode';
     // create qrcode element
     this._qrcode = $('<div></div>');
     // set id property
@@ -368,6 +408,7 @@
         'position': 'fixed',
         'left': '5px',
         'bottom': '10rem',
+		'display': 'none',
         'z-index': '666'
     });
     // create qrcode image
@@ -411,7 +452,7 @@
 SingleProduct.prototype.createDiscountIcon = function (text = '点我搜券') {
 
     // 设置id
-    let id = 'skypesky-discountIcon';
+    let id = 'tbpublic-discountIcon';
     // create tag
     this._discountIcon = $('<button></button>').text(text);
     // set id property
@@ -431,8 +472,8 @@
         'font-size': '12px',
         'white-space': 'normal',
         'color': '#fff',
-        'background-color': '#0e90d2',
-        'border-color': '#0e90d2',
+        'background-color': '#b23cef',
+        'border-color': '#b23cef',
         'display': 'inline-block',
         'border-radius': '0',
         'border': '1px solid transparent',
@@ -467,7 +508,7 @@
  ** @return: 返回discountTag
  */
 SearchProduct.prototype.createDiscountTag = function (text) {
-    let id = 'skypesky-discountTag';
+    let id = 'tbpublic-discountTag';
     // create tag
     this._discountTag = $('<span></span>');
     // 设置文本信息
@@ -487,7 +528,7 @@
         'font-size': '14px',
         'white-space': 'normal',
         'color': '#fff',
-        'background-color': '#DC143C',
+        'background-color': '#ff0036',
         'display': 'inline-block',
         'text-align': 'center',
         'z-index': '8'
@@ -580,9 +621,9 @@
                     this._statistic.successCount++;
 
                     // 创建标签显示优惠信息
-                    this.createDiscountTag(res.data.resultInfo.couponInfo);
+                    this.createDiscountTag(res.data.resultInfo.coupon_info);
                     // 设置需要跳转的链接
-                    this._discountTag.attr('onclick', 'window.open("' + res.data.spreadUrl + '")');
+                    this._discountTag.attr('onclick', 'window.open("' + res.data.resultInfo.coupon_click_url + '")');
                     $(imageList[i]).append(this._discountTag);
 
 

You have until I get back to remedy this or your script, and perhaps your account, are eligible for removal.

Thank you for your immediate cooperation,
OUJS Admin



Your library usage here on OUJS uses too vague of a relative url... so most engines will not install this script properly. There is also a mandatory @license issue fixed in this patch:

--- /scripts/motiko/Beautify_Salesforce_Debug_View/source@0.2.9+e856550
+++ /scripts/motiko/Beautify_Salesforce_Debug_View/source
@@ -4,9 +4,10 @@
 // @version      0.2.9
 // @description Beautify Salesforce Debug View
 // @author       motiko
+// @license      MIT
 // @match        https://*.salesforce.com/p/setup/layout/ApexDebugLogDetailEdit/*
-// @require beautify.js
-// @require beautify-html.js
+// @require /src/libs/motiko/beautify.js
+// @require /src/libs/motiko/beautify-html.js
 // @resource debug_css https://raw.githubusercontent.com/motiko/sfdc-debug-logs/master/monkey/debug.css
 // @grant    GM_addStyle
 // @grant    GM_getResourceText

Thanks,
OUJS Admin


Re: @BigTSDMB:

As a general rule, @match is more reliable and performant than using include regex.

This is false. Most engines, and browsers, that support regular expressions (re's) convert patterned globs, such as @match to regular expressions. So reducing an extra set of conversions is an improvement. @match is less "performant" since it has a stricter pattern.

It's less likely to break, seeing as it's a part of the Chrome addon specification (and the newer WebExtensions spefication)

In order of effectiveness... re's, generic globs, and then specific glob matches. So it's a good idea to include all three if one is that paranoid about breakage between the different engines and browsers (including versions).

It's also more widely supported on different UserScript engines.

Untrue with @match throughout the history of Userscripts.

There have even been talks of removing the regex feature of @include.

This part may be true on the Fx side since the Fx development team is getting rather lazy these days.


Re: @3jameo3:

I might try my hand in creating a python code to compare 2 different codes in the future.

Seriously doubt the browser itself can handle this... but I also haven't looked to see if there is a runtime client side. Since this would need to be DOM side it would need to be JavaScript. I seem to remember there's some upcoming compiled language but haven't relooked into it (or remembered it's name too ;).

In short this needs to be pure JavaScript and on the client side... perhaps with some optional workers to utilize more cores. The one I twiddled with did too much. We just need the text and not the prettyfication which is probably what slowed it down to a halt.

Anywho... GH is a better place to discuss this rather than here. ;)


Re: @3jameo3:

Sounds like a good amount of interesting updates to the site will be coming.

Time permitting... just tested the "top" diff type package and it locked up my browser with a and b sources. I have a pretty hefty multi-core machine too so that particular package probably isn't going to happen for everyone.

I look forward to that as I have little to no Linux knowledge.

Hope I've improved it a little bit... see the FAQ section. With Windows it's best to use git-scm. All others like it are getting older, and perhaps a bit overly bulky.

Anyhow... sorry about the intervention... but maintaining integrity of the forums here. You should see what we get to remove sometimes. ;)


Re: @3jameo3:

The prior changes have been diffed as follows:

  • a.user.js is @eileen12 's @version of 3.22+0552534
  • b.user.js is your original full script source diff'ed to what full source was at this comment
  • c.user.js is your original full script source diff'ed from b.user.js to what full source was at this comment

I don't understand the code change part of the FAQ

I will try to update it a little bit for Windows users since it's mainly for git-scm. I diffed the prior comments using Linux diff -u command after downloading all the sources and then diffing a to b, then b to c. As you can see it's intensely clearer. I left your original "this" to "that" change comparisons. I've done this myself.

I also need to find a DOM diff package (or make one) that we can stick next to beautify/wrap of @eileen12 's source code and then you can choose your method of presentation by dropping in your changes without forking (but forking is still the preferred at this time since it makes way shorter discussions and doesn't open up a security issue... you can delete a fork at a later date if @eileen12 adopts the changes). It's on my long list of things to add to the site. :)


Re: @3jameo3:

@3jameeo3

I realize you are trying to help out here but please don't post entire scripts. That is what forking is for. Then you can refer to it on your fork. Just rename the @version to something unique.

If you need to show differences please utilize this FAQ.

Thank you for your cooperation,
OUJS Admin



Should be complete... had to reimport an old script for some reason.


Re: @3jameo3:

TypeError: $(...).ready is not a function

This portion usually refers to jQuery being absent.


Refactoring for non-primary @license now (ex. CC)... please be patient.




Unfortunately that maintainer has gone rogue so this will be delayed again pending a more secured dependency... will try again with at least one PR and if he is a team player he'll do the right thing. :)


Re: @Marti:

Is there some way to specify "GPL-3.0-or-later"

This should be coming soon pending a PR upstream and some final rechecks.

Please reread the prior Re for applicable specifics. I will notify here when things are moving forward.


Re: @gobub:

copy paste didnt work for some reason

That would be user error. Please use a single pair of code back-ticks or a code fence which is three backticks on their own lines (See this FAQ). Your prior posts have been fixed with these. You can always use the Preview button to ensure it is what you want to post.

Thanks,
OUJS Admin



Re: @y-less:

Ahh you must have hit the GH cache limit... if you commit too many at once the raw data isn't updated... it's part of their rate limiting.