diff --git a/.eslintignore [DEPRECATED] b/.eslintignore [DEPRECATED] new file mode 100644 index 0000000..db181dd --- /dev/null +++ b/.eslintignore [DEPRECATED] @@ -0,0 +1 @@ +**/*.min.js diff --git a/.eslintrc.js [DEPRECATED] b/.eslintrc.js [DEPRECATED] new file mode 100644 index 0000000..8ebc3c0 --- /dev/null +++ b/.eslintrc.js [DEPRECATED] @@ -0,0 +1,88 @@ +/* eslint-disable quotes */ + +module.exports = { + "root": true, + + "env": { + "browser": true, + "es6": true, + "greasemonkey": true, + "jquery": true, + // "node": true + }, + + "parserOptions": { + // "ecmaVersion": 12, + "ecmaVersion": "latest", + "sourceType": "script", + "ecmaFeatures": { + "globalReturn ": true, + "impliedStrict": true, + // "jsx": true, + }, + }, + + // "extends": "eslint:all", + // "extends": "eslint:recommended", + "extends": [ + "eslint:recommended", + // "eslint:all", + "plugin:css/recommended", + "plugin:jsonc/recommended-with-json", + // "plugin:no-jquery/recommended", + "plugin:no-jquery/deprecated", + // "plugin:no-jquery/slim", + // "plugin:no-jquery/all", + // "plugin:clean-regex/recommended" + "plugin:regexp/recommended", + // "plugin:regexp/all", + ], + + "plugins": [ + "css", + "jsonc", + // "clean-regex", + "no-jquery", + "regexp", + ], + + "rules": { + "complexity": ["warn", 20], + "eqeqeq": "warn", + "func-style": "off", + // "indent": ["warn","tab" ], + // "indent": ["warn","tab", { "SwitchCase": 1 } ], + // "indent": ["warn","tab", { "ignoreComments": true, "SwitchCase": 1 } ], + "indent": ["warn","tab", { "ignoreComments": false, "SwitchCase": 1 } ], + "linebreak-style": ["warn","unix"], + "max-len": "off", + "max-statements-per-line": "off", + "new-cap": "off", + "no-alert": "warn", + "no-console": "warn", + "no-dupe-keys": "warn", + "no-extra-semi": "warn", + "no-inline-comments": "off", + "no-magic-numbers": "off", + "no-misleading-character-class": "warn", + "no-mixed-spaces-and-tabs": "warn", + // "no-var": "off", + "no-multiple-empty-lines": "off", + "no-tabs": "off", + "no-unused-labels": "warn", + "no-unused-vars": ["warn", {"vars": "all", "args": "after-used"}], + "no-useless-escape": "warn", + "padded-blocks": "off", + "quotes": ["warn", "single", { "allowTemplateLiterals": true }] , + "require-jsdoc": "off", + "require-unicode-regexp": "off", + "semi": ["warn","always"], + // "strict": ["error", "global"], + "space-before-function-paren": "off", + // "space-in-parens": ["warn", "always"], + "unicode-bom": ["warn", "never"], + }, + + "reportUnusedDisableDirectives": true + +}; diff --git a/.eslintrc.json [DEPRECATED] b/.eslintrc.json [DEPRECATED] new file mode 100644 index 0000000..a34a4d6 --- /dev/null +++ b/.eslintrc.json [DEPRECATED] @@ -0,0 +1,61 @@ +{ + "root": true, + "env": { + "browser": true, + "es6": true, + "greasemonkey": true, + "jquery": true + }, + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "script", + "ecmaFeatures": { + "globalReturn ": true, + "impliedStrict": true + } + }, + "extends": [ + "eslint:recommended", + "plugin:css/recommended", + "plugin:jsonc/recommended-with-json", + "plugin:no-jquery/deprecated", + "plugin:regexp/recommended" + ], + "plugins": [ + "css", + "jsonc", + "no-jquery", + "regexp" + ], + "rules": { + "complexity": ["warn", 20], + "eqeqeq": "warn", + "func-style": "off", + "indent": ["warn","tab", { "ignoreComments": false, "SwitchCase": 1 } ], + "linebreak-style": ["warn","unix"], + "max-len": "off", + "max-statements-per-line": "off", + "new-cap": "off", + "no-alert": "warn", + "no-console": "warn", + "no-dupe-keys": "warn", + "no-extra-semi": "warn", + "no-inline-comments": "off", + "no-magic-numbers": "off", + "no-misleading-character-class": "warn", + "no-mixed-spaces-and-tabs": "warn", + "no-multiple-empty-lines": "off", + "no-tabs": "off", + "no-unused-labels": "warn", + "no-unused-vars": ["warn", {"vars": "all", "args": "after-used"}], + "no-useless-escape": "warn", + "padded-blocks": "off", + "quotes": ["warn", "single", { "allowTemplateLiterals": true }] , + "require-jsdoc": "off", + "require-unicode-regexp": "off", + "semi": ["warn","always"], + "space-before-function-paren": "off", + "unicode-bom": ["warn", "never"] + }, + "reportUnusedDisableDirectives": true +} diff --git a/.gitattributes b/.gitattributes index bdb0cab..1e78b8c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,5 @@ # Auto detect text files and perform LF normalization -* text=auto +* text=auto eol=lf # Custom for Visual Studio *.cs diff=csharp diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..eaba567 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,58 @@ +name: 🐛 Report a bug +description: File a bug report +title: "[script title] " +labels: bug +body: + - type: markdown + attributes: + value: | + # Thanks for reporting a bug! ⛰ + + Help us replicate the issue by filling in this form. + - type: checkboxes + id: terms + attributes: + label: "Please ensure:" + options: + - label: "I included in the issue title the script name I'm referring to." + required: true + - label: I performed a search of the [issue tracker](https://github.com/darkred/Userscripts/issues) and in the relevant Greasyfork [feedback page](https://greasyfork.org/en/users/2160-darkred?sort=updated) to avoid opening a duplicate issue. + required: true + - label: The bug is caused by the script itself. It doesn't happen if I disable the script, or in a fresh browser profile. + required: true + - type: checkboxes + attributes: + label: 'Include in this issue:' + options: + - label: Screenshots/video/gif demonstrating the bug, if it’s visual + - label: Console errors, if any + - type: textarea + id: the-problem + attributes: + label: Describe the problem and how to replicate it + validations: + required: true + - type: input + id: example-url + attributes: + label: Example URL + description: A REAL URL where the bug appears. + placeholder: https://example.com/page1.htm + validations: + required: true + - type: input + id: script-manager + attributes: + label: Script Manager + description: (Tampermonkey and Violentmonkey are supported - Greasemonkey is NOT supported) + placeholder: e.g. Tampermonkey 4.14 + validations: + required: true + - type: input + id: browsers + attributes: + label: Browser(s) used + description: (make sure it is the latest version - old versions are NOT supported) + placeholder: e.g. Chrome 92 + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..3ba13e0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.md.old b/.github/ISSUE_TEMPLATE/feature_request.md.old new file mode 100644 index 0000000..f8b7ea6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md.old @@ -0,0 +1,16 @@ +--- +name: 🆕 Suggest an improvement or new feature +about: ——— +title: '' +labels: enhancement, under discussion +assignees: '' + +--- + + diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..45791c0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,32 @@ +name: 🆕 Suggest an improvement or new feature +description: ——— +title: "[script title] " +labels: enhancement, under discussion +body: + - type: checkboxes + id: terms + attributes: + label: "Please ensure:" + options: + - label: "I included in the issue title the script name I'm referring to." + required: true + - label: "Before you request from me to write a new script for you, check in https://greasyfork.org/en/scripts and https://openuserjs.org/ : what you ask might be there already." + required: false + - type: textarea + attributes: + label: Description + description: "Try to be as specific as possible, don't make me have to guess what your suggested improvement or feature is." + validations: + required: true + - type: textarea + attributes: + label: Screenshot + description: You can provide screenshots/mockups to better visualize your idea. Files can be dropped in this field + - type: input + attributes: + label: Example URL + description: Include a REAL URL where the feature should appear. Paste a link here + placeholder: https://example.com/index.html + value: https:// + validations: + required: true diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..75d11ec --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "npm" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" # Check for updates to GitHub Actions every week diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 0000000..b9d6d20 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,14 @@ +name: 'Dependency Review' +on: [pull_request] + +permissions: + contents: read + +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: 'Checkout Repository' + uses: actions/checkout@v4 + - name: 'Dependency Review' + uses: actions/dependency-review-action@v4 diff --git a/.github/workflows/evergreen.yml b/.github/workflows/evergreen.yml new file mode 100644 index 0000000..57eb768 --- /dev/null +++ b/.github/workflows/evergreen.yml @@ -0,0 +1,22 @@ +name: Weekly dependabot checks + +on: + workflow_dispatch: + schedule: + - cron: '3 2 1 * *' + +permissions: + issues: write + pull-requests: write + +jobs: + evergreen: + name: evergreen + runs-on: ubuntu-latest + + steps: + - name: Run evergreen action + uses: github/evergreen@v1 + env: + GH_TOKEN: ${{ secrets.EVERGREEN_ACTION }} + REPOSITORY: darkred diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..f2415f5 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,31 @@ +# from https://github.com/tophf/mpiv/blob/master/.github/workflows/lint.yml +# and https://github.com/stefanoeb/eslint-action/blob/master/README.md + +name: ESLint + +on: + push: + branches: [ master ] + paths-ignore: + - '.github/**' # this yml is also excluded so you need to re-run it explicitly if necessary + - .editorconfig + - LICENSE + - README.md + pull_request: + branches: [ master ] + paths-ignore: + - '.github/**' # this yml is also excluded so you need to re-run it explicitly if necessary + - .editorconfig + - LICENSE + - README.md + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install modules + run: npm install + - name: Run ESLint + run: npx eslint . --ext .user.js diff --git a/.gitignore b/.gitignore index cd2946a..fe04e22 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,9 @@ $RECYCLE.BIN/ Network Trash Folder Temporary Items .apdisk + + +node_modules/ + +# lockfiles +package-lock.json diff --git a/1337X_-_convert_torrent_timestamps_to_relative_format/1337X_-_convert_torrent_timestamps_to_relative_format.user.js b/1337X_-_convert_torrent_timestamps_to_relative_format/1337X_-_convert_torrent_timestamps_to_relative_format.user.js new file mode 100644 index 0000000..5eee4ab --- /dev/null +++ b/1337X_-_convert_torrent_timestamps_to_relative_format/1337X_-_convert_torrent_timestamps_to_relative_format.user.js @@ -0,0 +1,110 @@ +// ==UserScript== +// @name 1337X - convert torrent timestamps to relative format +// @namespace darkred +// @version 2021.7.14.1 +// @description Converts torrent upload timestamps to relative format +// @author darkred +// @license MIT +// @include /^https:\/\/(www\.)?1337x\.(to|st|ws|eu|se|is|gd|unblocked\.dk)((?!\/torrent)).*$/ +// @grant none +// @require https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js +// @require https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.31/moment-timezone-with-data-10-year-range.min.js +// @supportURL https://github.com/darkred/Userscripts/issues +// ==/UserScript== + +// Official mirrors list: https://1337x.to/about + +'use strict'; +/* global moment */ + + + + + +// 11:59am ---> h:hha +// 10am Oct. 30th ---> haA MMM. Do +// 11pm Nov. 4th +// Oct. 31st '20 + + + +// Based on the timestamp on the footer of each RARBG page --> "Sat, 01 May 2020 20:14:56 +0200", +// the script takes that the server time is GMT+2 and that it doesn't take DST. +// Also, the script uses the 'moment-timezone' library as it takes DST offsets into account when converting the timestamps to user/local timezone. + +// This is no typo: +// const serverTimezone = 'Etc/GMT+2'; // -02:00 -02:00 (=no DST) +// const serverTimezone = 'Etc/GMT-2'; // +02:00 +02:00 (=no DST) +const serverTimezone = 'Etc/GMT-1'; // +01:00 +01:00 (=no DST) + +// const serverTimezone = 'Etc/GMT-1'; + +const localTimezone = moment.tz.guess(); // In my case ----> +02:00 +03:00 (DST) + +// const format = 'MM/DD/YYYY HH:mm:ss'; +// const format = 'YYYY-MM-DD HH:mm:ss'; +moment.locale('en'); +const format = ['h:mma', 'ha MMM. Do', 'MMM. Do \'YY']; +const formatTooltip1 = 'h:mma'; // the 1st element of the above array. +const formatTooltip2 = 'ha MMM. Do'; // the 2st element of the array (there can be no 3rd format, e.g. Oct. 31st '20 is only date, not time ). + +// Customize the strings in the locale to display "1 minute ago" instead of "a minute ago" (https://github.com/moment/moment/issues/3764#issuecomment-279928245) +moment.updateLocale('en', { + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'seconds', + m: '1 minute', + mm: '%d minutes', + h: '1 hour', + hh: '%d hours', + d: '1 day', + dd: '%d days', + M: '1 month', + MM: '%d months', + y: '1 year', + yy: '%d years' + } +}); + + +function convertToLocalTimezone(timestamps) { + for (let i = 0; i < timestamps.length; i++) { + let initialTimestamp = timestamps[i].textContent; + if (moment(initialTimestamp, format, true).isValid()) { // As of moment.js v2.3.0, you may specify a boolean for the last argument to make Moment use strict parsing. Strict parsing requires that the format and input match exactly, including delimeters. + let convertedToLocalTimezone = moment.tz(initialTimestamp, format, serverTimezone).tz(localTimezone); + timestamps[i].textContent = convertedToLocalTimezone.fromNow(); + + // timestamps[i].title = initialTimestamp; + if (moment(initialTimestamp, formatTooltip1, true).isValid()) { + timestamps[i].title = convertedToLocalTimezone.format(formatTooltip1); + } else if (moment(initialTimestamp, formatTooltip2, true).isValid()) { + timestamps[i].title = convertedToLocalTimezone.format(formatTooltip2); + // timestamps[i].title = convertedToLocalTimezone.toISOString(); // Display timestamps in tooltips in ISO 8601 format, combining date and time (https://stackoverflow.com/questions/25725019/how-do-i-format-a-date-as-iso-8601-in-moment-js/) + } + } + } + + + // recalculate the relative dates every 1 min + (function(){ + for (let i = 0; i < timestamps.length; i++) { + // timestamps[i].textContent = moment(timestamps[i].title).fromNow(); + + if (timestamps[i].title !== '') { + let tooltipValue = timestamps[i].title; + let convertedToLocalTimezone = moment(tooltipValue, format); // no need to reconvert, it's already in local timezone + timestamps[i].textContent = convertedToLocalTimezone.fromNow(); + } + + } + // setTimeout(arguments.callee, 10 * 1000); // 10 * 1000 msec = 10 sec = 1/6 min + setTimeout(arguments.callee, 60 * 1000); // 60 * 1000 msec = 1 min + })(); + + +} + +// const timestamps = document.querySelectorAll('tr.lista2 td:nth-child(3)'); +const timestamps = document.querySelectorAll('tbody .coll-date'); +convertToLocalTimezone(timestamps); diff --git a/1337X_-_convert_torrent_timestamps_to_relative_format/README.md b/1337X_-_convert_torrent_timestamps_to_relative_format/README.md new file mode 100644 index 0000000..abc5eb9 --- /dev/null +++ b/1337X_-_convert_torrent_timestamps_to_relative_format/README.md @@ -0,0 +1,13 @@ +This script applies to 1337X torrent lists. +- it converts torrent timestamps to relative format in local timezone. Also, it recalculates them every 1 min. +- The initial timestamps are still available as tooltips (on mouse hover), also converted to local timezone. + +It uses [moment.js](http://momentjs.com/) and [moment-timezone.js](http://momentjs.com/timezone/). + +Screenshot comparison: +Initial: +![](https://i.imgur.com/ZcEdXNI.jpg) +With the script: +![](https://i.imgur.com/1I027xL.jpg) + +[Hosted in GitHub](https://github.com/darkred/Userscripts) diff --git a/1337X_-_convert_torrent_timestamps_to_relative_format/moment-timezone-with-data-10-year-range.min.js b/1337X_-_convert_torrent_timestamps_to_relative_format/moment-timezone-with-data-10-year-range.min.js new file mode 100644 index 0000000..5173d52 --- /dev/null +++ b/1337X_-_convert_torrent_timestamps_to_relative_format/moment-timezone-with-data-10-year-range.min.js @@ -0,0 +1 @@ +!function(a,i){"use strict";"object"==typeof module&&module.exports?module.exports=i(require("moment")):"function"==typeof define&&define.amd?define(["moment"],i):i(a.moment)}(this,function(c){"use strict";void 0===c.version&&c.default&&(c=c.default);var i,A={},n={},t={},s={},u={};c&&"string"==typeof c.version||O("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");var a=c.version.split("."),e=+a[0],r=+a[1];function m(a){return 96= 2.6.0. You are using Moment.js "+c.version+". See momentjs.com"),M.prototype={_set:function(a){this.name=a.name,this.abbrs=a.abbrs,this.untils=a.untils,this.offsets=a.offsets,this.population=a.population},_index:function(a){var i,e=+a,r=this.untils;for(i=0;i= 2.9.0. You are using Moment.js "+c.version+"."),c.defaultZone=a?_(a):null,c};var G=c.momentProperties;return"[object Array]"===Object.prototype.toString.call(G)?(G.push("_z"),G.push("_a")):G&&(G._z=null),B({version:"2020a",zones:["Africa/Abidjan|GMT|0|0||48e5","Africa/Nairobi|EAT|-30|0||47e5","Africa/Algiers|CET|-10|0||26e5","Africa/Lagos|WAT|-10|0||17e6","Africa/Maputo|CAT|-20|0||26e5","Africa/Cairo|EET|-20|0||15e6","Africa/Casablanca|+00 +01|0 -10|010101010101010101010101010101|1O9e0 uM0 e00 Dc0 11A0 s00 e00 IM0 WM0 mo0 gM0 LA0 WM0 jA0 e00 28M0 e00 2600 gM0 2600 e00 2600 gM0 2600 e00 28M0 e00 2600 gM0|32e5","Europe/Paris|CET CEST|-10 -20|01010101010101010101010|1O9d0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|11e6","Africa/Johannesburg|SAST|-20|0||84e5","Africa/Khartoum|EAT CAT|-30 -20|01|1Usl0|51e5","Africa/Sao_Tome|GMT WAT|0 -10|010|1UQN0 2q00|","Africa/Windhoek|CAT WAT|-20 -10|0101010|1Oc00 11B0 1nX0 11B0 1nX0 11B0|32e4","America/Adak|HST HDT|a0 90|01010101010101010101010|1O100 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|326","America/Anchorage|AKST AKDT|90 80|01010101010101010101010|1O0X0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|30e4","America/Santo_Domingo|AST|40|0||29e5","America/Fortaleza|-03|30|0||34e5","America/Asuncion|-03 -04|30 40|01010101010101010101010|1O6r0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1fB0 19X0 1ip0 17b0 1ip0|28e5","America/Panama|EST|50|0||15e5","America/Mexico_City|CST CDT|60 50|01010101010101010101010|1Oc80 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0|20e6","America/Managua|CST|60|0||22e5","America/La_Paz|-04|40|0||19e5","America/Lima|-05|50|0||11e6","America/Denver|MST MDT|70 60|01010101010101010101010|1O0V0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|26e5","America/Campo_Grande|-03 -04|30 40|0101010101|1NTf0 1zd0 On0 1zd0 On0 1zd0 On0 1HB0 FX0|77e4","America/Cancun|CST EST|60 50|01|1NKU0|63e4","America/Caracas|-0430 -04|4u 40|01|1QMT0|29e5","America/Chicago|CST CDT|60 50|01010101010101010101010|1O0U0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|92e5","America/Chihuahua|MST MDT|70 60|01010101010101010101010|1Oc90 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0|81e4","America/Phoenix|MST|70|0||42e5","America/Whitehorse|PST PDT MST|80 70 70|010101010102|1O0W0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0|23e3","America/New_York|EST EDT|50 40|01010101010101010101010|1O0T0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|21e6","America/Los_Angeles|PST PDT|80 70|01010101010101010101010|1O0W0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|15e6","America/Fort_Nelson|PST MST|80 70|01|1O0W0|39e2","America/Halifax|AST ADT|40 30|01010101010101010101010|1O0S0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|39e4","America/Godthab|-03 -02|30 20|01010101010101010101010|1O9d0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|17e3","America/Grand_Turk|EST EDT AST|50 40 40|0121010101010101010|1O0T0 1zb0 5Ip0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|37e2","America/Havana|CST CDT|50 40|01010101010101010101010|1O0R0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0|21e5","America/Metlakatla|PST AKST AKDT|80 90 80|01212120121212121212121|1PAa0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 uM0 jB0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|14e2","America/Miquelon|-03 -02|30 20|01010101010101010101010|1O0R0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|61e2","America/Montevideo|-02 -03|20 30|01|1O0Q0|17e5","America/Noronha|-02|20|0||30e2","America/Port-au-Prince|EST EDT|50 40|010101010101010101010|1O0T0 1zb0 3iN0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|23e5","Antarctica/Palmer|-03 -04|30 40|010|1QSr0 Ap0|40","America/Santiago|-03 -04|30 40|010101010101010101010|1QSr0 Ap0 1Nb0 Ap0 1Nb0 Ap0 1zb0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 11B0 1nX0 11B0|62e5","America/Sao_Paulo|-02 -03|20 30|0101010101|1NTe0 1zd0 On0 1zd0 On0 1zd0 On0 1HB0 FX0|20e6","Atlantic/Azores|-01 +00|10 0|01010101010101010101010|1O9d0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|25e4","America/St_Johns|NST NDT|3u 2u|01010101010101010101010|1O0Ru 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|11e4","Antarctica/Casey|+08 +11|-80 -b0|010|1RWg0 3m10|10","Asia/Bangkok|+07|-70|0||15e6","Asia/Vladivostok|+10|-a0|0||60e4","Pacific/Bougainville|+11|-b0|0||18e4","Asia/Tashkent|+05|-50|0||23e5","Pacific/Auckland|NZDT NZST|-d0 -c0|01010101010101010101010|1ObO0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1io0 1a00 1fA0 1a00|14e5","Asia/Baghdad|+03|-30|0||66e5","Antarctica/Troll|+00 +02|0 -20|01010101010101010101010|1O9d0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|40","Asia/Dhaka|+06|-60|0||16e6","Asia/Amman|EET EEST|-20 -30|01010101010101010101010|1O8m0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0|25e5","Asia/Kamchatka|+12|-c0|0||18e4","Asia/Baku|+04 +05|-40 -50|010|1O9c0 1o00|27e5","Asia/Barnaul|+06 +07|-60 -70|01|1QyI0|","Asia/Beirut|EET EEST|-20 -30|01010101010101010101010|1O9a0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0|22e5","Asia/Kuala_Lumpur|+08|-80|0||71e5","Asia/Kolkata|IST|-5u|0||15e6","Asia/Chita|+08 +09|-80 -90|01|1QyG0|33e4","Asia/Ulaanbaatar|+08 +09|-80 -90|01010|1O8G0 1cJ0 1cP0 1cJ0|12e5","Asia/Shanghai|CST|-80|0||23e6","Asia/Colombo|+0530|-5u|0||22e5","Asia/Damascus|EET EEST|-20 -30|01010101010101010101010|1O8m0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0|26e5","Asia/Yakutsk|+09|-90|0||28e4","Asia/Dubai|+04|-40|0||39e5","Asia/Famagusta|EET EEST +03|-20 -30 -30|0101201010101010101010|1O9d0 1o00 11A0 15U0 2Ks0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|","Asia/Gaza|EET EEST|-20 -30|01010101010101010101010|1O8K0 1nz0 1220 1qL0 WN0 1qL0 WN0 1qL0 11c0 1oo0 11c0 1rc0 Wo0 1rc0 Wo0 1rc0 11c0 1oo0 11c0 1oo0 11c0 1oo0|18e5","Asia/Hong_Kong|HKT|-80|0||73e5","Asia/Hovd|+07 +08|-70 -80|01010|1O8H0 1cJ0 1cP0 1cJ0|81e3","Europe/Istanbul|EET EEST +03|-20 -30 -30|01012|1O9d0 1tA0 U00 15w0|13e6","Asia/Jakarta|WIB|-70|0||31e6","Asia/Jayapura|WIT|-90|0||26e4","Asia/Jerusalem|IST IDT|-20 -30|01010101010101010101010|1O8o0 1oL0 10N0 1rz0 W10 1rz0 W10 1rz0 10N0 1oL0 10N0 1oL0 10N0 1rz0 W10 1rz0 W10 1rz0 10N0 1oL0 10N0 1oL0|81e4","Asia/Kabul|+0430|-4u|0||46e5","Asia/Karachi|PKT|-50|0||24e6","Asia/Kathmandu|+0545|-5J|0||12e5","Asia/Magadan|+10 +11|-a0 -b0|01|1QJQ0|95e3","Asia/Makassar|WITA|-80|0||15e5","Asia/Manila|PST|-80|0||24e6","Europe/Athens|EET EEST|-20 -30|01010101010101010101010|1O9d0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|35e5","Asia/Novosibirsk|+06 +07|-60 -70|01|1Rmk0|15e5","Asia/Pyongyang|KST KST|-90 -8u|010|1P4D0 6BA0|29e5","Asia/Qyzylorda|+06 +05|-60 -50|01|1Xei0|73e4","Asia/Rangoon|+0630|-6u|0||48e5","Asia/Sakhalin|+10 +11|-a0 -b0|01|1QyE0|58e4","Asia/Seoul|KST|-90|0||23e6","Asia/Tehran|+0330 +0430|-3u -4u|01010101010101010101010|1O6ku 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0|14e6","Asia/Tokyo|JST|-90|0||38e6","Asia/Tomsk|+06 +07|-60 -70|01|1QXU0|10e5","Europe/Lisbon|WET WEST|0 -10|01010101010101010101010|1O9d0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|27e5","Atlantic/Cape_Verde|-01|10|0||50e4","Australia/Sydney|AEDT AEST|-b0 -a0|01010101010101010101010|1ObQ0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0|40e5","Australia/Adelaide|ACDT ACST|-au -9u|01010101010101010101010|1ObQu 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0|11e5","Australia/Brisbane|AEST|-a0|0||20e5","Australia/Darwin|ACST|-9u|0||12e4","Australia/Eucla|+0845|-8J|0||368","Australia/Lord_Howe|+11 +1030|-b0 -au|01010101010101010101010|1ObP0 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1fAu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1fzu 1cMu 1cLu 1cMu|347","Australia/Perth|AWST|-80|0||18e5","Pacific/Easter|-05 -06|50 60|010101010101010101010|1QSr0 Ap0 1Nb0 Ap0 1Nb0 Ap0 1zb0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 11B0 1nX0 11B0|30e2","Europe/Dublin|GMT IST|0 -10|01010101010101010101010|1O9d0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|12e5","Etc/GMT-1|+01|-10|0||","Pacific/Fakaofo|+13|-d0|0||483","Pacific/Kiritimati|+14|-e0|0||51e2","Etc/GMT-2|+02|-20|0||","Pacific/Tahiti|-10|a0|0||18e4","Pacific/Niue|-11|b0|0||12e2","Etc/GMT+12|-12|c0|0||","Pacific/Galapagos|-06|60|0||25e3","Etc/GMT+7|-07|70|0||","Pacific/Pitcairn|-08|80|0||56","Pacific/Gambier|-09|90|0||125","Etc/UTC|UTC|0|0||","Europe/Ulyanovsk|+03 +04|-30 -40|01|1QyL0|13e5","Europe/London|GMT BST|0 -10|01010101010101010101010|1O9d0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|10e6","Europe/Chisinau|EET EEST|-20 -30|01010101010101010101010|1O9c0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|67e4","Europe/Moscow|MSK|-30|0||16e6","Europe/Saratov|+03 +04|-30 -40|01|1Sfz0|","Europe/Volgograd|+03 +04|-30 -40|01|1WQL0|10e5","Pacific/Honolulu|HST|a0|0||37e4","MET|MET MEST|-10 -20|01010101010101010101010|1O9d0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|","Pacific/Chatham|+1345 +1245|-dJ -cJ|01010101010101010101010|1ObO0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1io0 1a00 1fA0 1a00|600","Pacific/Apia|+14 +13|-e0 -d0|01010101010101010101010|1ObO0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1io0 1a00 1fA0 1a00|37e3","Pacific/Fiji|+13 +12|-d0 -c0|01010101010101010101010|1NF20 1SM0 uM0 1VA0 s00 1VA0 s00 1VA0 s00 20o0 pc0 20o0 s00 20o0 pc0 20o0 pc0 20o0 pc0 20o0 pc0 20o0|88e4","Pacific/Guam|ChST|-a0|0||17e4","Pacific/Marquesas|-0930|9u|0||86e2","Pacific/Pago_Pago|SST|b0|0||37e2","Pacific/Norfolk|+1130 +11 +12|-bu -b0 -c0|012121212121212|1PoCu 9Jcu 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0|25e4","Pacific/Tongatapu|+13 +14|-d0 -e0|010|1S4d0 s00|75e3"],links:["Africa/Abidjan|Africa/Accra","Africa/Abidjan|Africa/Bamako","Africa/Abidjan|Africa/Banjul","Africa/Abidjan|Africa/Bissau","Africa/Abidjan|Africa/Conakry","Africa/Abidjan|Africa/Dakar","Africa/Abidjan|Africa/Freetown","Africa/Abidjan|Africa/Lome","Africa/Abidjan|Africa/Monrovia","Africa/Abidjan|Africa/Nouakchott","Africa/Abidjan|Africa/Ouagadougou","Africa/Abidjan|Africa/Timbuktu","Africa/Abidjan|America/Danmarkshavn","Africa/Abidjan|Atlantic/Reykjavik","Africa/Abidjan|Atlantic/St_Helena","Africa/Abidjan|Etc/GMT","Africa/Abidjan|Etc/GMT+0","Africa/Abidjan|Etc/GMT-0","Africa/Abidjan|Etc/GMT0","Africa/Abidjan|Etc/Greenwich","Africa/Abidjan|GMT","Africa/Abidjan|GMT+0","Africa/Abidjan|GMT-0","Africa/Abidjan|GMT0","Africa/Abidjan|Greenwich","Africa/Abidjan|Iceland","Africa/Algiers|Africa/Tunis","Africa/Cairo|Africa/Tripoli","Africa/Cairo|Egypt","Africa/Cairo|Europe/Kaliningrad","Africa/Cairo|Libya","Africa/Casablanca|Africa/El_Aaiun","Africa/Johannesburg|Africa/Maseru","Africa/Johannesburg|Africa/Mbabane","Africa/Lagos|Africa/Bangui","Africa/Lagos|Africa/Brazzaville","Africa/Lagos|Africa/Douala","Africa/Lagos|Africa/Kinshasa","Africa/Lagos|Africa/Libreville","Africa/Lagos|Africa/Luanda","Africa/Lagos|Africa/Malabo","Africa/Lagos|Africa/Ndjamena","Africa/Lagos|Africa/Niamey","Africa/Lagos|Africa/Porto-Novo","Africa/Maputo|Africa/Blantyre","Africa/Maputo|Africa/Bujumbura","Africa/Maputo|Africa/Gaborone","Africa/Maputo|Africa/Harare","Africa/Maputo|Africa/Kigali","Africa/Maputo|Africa/Lubumbashi","Africa/Maputo|Africa/Lusaka","Africa/Nairobi|Africa/Addis_Ababa","Africa/Nairobi|Africa/Asmara","Africa/Nairobi|Africa/Asmera","Africa/Nairobi|Africa/Dar_es_Salaam","Africa/Nairobi|Africa/Djibouti","Africa/Nairobi|Africa/Juba","Africa/Nairobi|Africa/Kampala","Africa/Nairobi|Africa/Mogadishu","Africa/Nairobi|Indian/Antananarivo","Africa/Nairobi|Indian/Comoro","Africa/Nairobi|Indian/Mayotte","America/Adak|America/Atka","America/Adak|US/Aleutian","America/Anchorage|America/Juneau","America/Anchorage|America/Nome","America/Anchorage|America/Sitka","America/Anchorage|America/Yakutat","America/Anchorage|US/Alaska","America/Campo_Grande|America/Cuiaba","America/Chicago|America/Indiana/Knox","America/Chicago|America/Indiana/Tell_City","America/Chicago|America/Knox_IN","America/Chicago|America/Matamoros","America/Chicago|America/Menominee","America/Chicago|America/North_Dakota/Beulah","America/Chicago|America/North_Dakota/Center","America/Chicago|America/North_Dakota/New_Salem","America/Chicago|America/Rainy_River","America/Chicago|America/Rankin_Inlet","America/Chicago|America/Resolute","America/Chicago|America/Winnipeg","America/Chicago|CST6CDT","America/Chicago|Canada/Central","America/Chicago|US/Central","America/Chicago|US/Indiana-Starke","America/Chihuahua|America/Mazatlan","America/Chihuahua|Mexico/BajaSur","America/Denver|America/Boise","America/Denver|America/Cambridge_Bay","America/Denver|America/Edmonton","America/Denver|America/Inuvik","America/Denver|America/Ojinaga","America/Denver|America/Shiprock","America/Denver|America/Yellowknife","America/Denver|Canada/Mountain","America/Denver|MST7MDT","America/Denver|Navajo","America/Denver|US/Mountain","America/Fortaleza|America/Araguaina","America/Fortaleza|America/Argentina/Buenos_Aires","America/Fortaleza|America/Argentina/Catamarca","America/Fortaleza|America/Argentina/ComodRivadavia","America/Fortaleza|America/Argentina/Cordoba","America/Fortaleza|America/Argentina/Jujuy","America/Fortaleza|America/Argentina/La_Rioja","America/Fortaleza|America/Argentina/Mendoza","America/Fortaleza|America/Argentina/Rio_Gallegos","America/Fortaleza|America/Argentina/Salta","America/Fortaleza|America/Argentina/San_Juan","America/Fortaleza|America/Argentina/San_Luis","America/Fortaleza|America/Argentina/Tucuman","America/Fortaleza|America/Argentina/Ushuaia","America/Fortaleza|America/Bahia","America/Fortaleza|America/Belem","America/Fortaleza|America/Buenos_Aires","America/Fortaleza|America/Catamarca","America/Fortaleza|America/Cayenne","America/Fortaleza|America/Cordoba","America/Fortaleza|America/Jujuy","America/Fortaleza|America/Maceio","America/Fortaleza|America/Mendoza","America/Fortaleza|America/Paramaribo","America/Fortaleza|America/Recife","America/Fortaleza|America/Rosario","America/Fortaleza|America/Santarem","America/Fortaleza|Antarctica/Rothera","America/Fortaleza|Atlantic/Stanley","America/Fortaleza|Etc/GMT+3","America/Godthab|America/Nuuk","America/Halifax|America/Glace_Bay","America/Halifax|America/Goose_Bay","America/Halifax|America/Moncton","America/Halifax|America/Thule","America/Halifax|Atlantic/Bermuda","America/Halifax|Canada/Atlantic","America/Havana|Cuba","America/La_Paz|America/Boa_Vista","America/La_Paz|America/Guyana","America/La_Paz|America/Manaus","America/La_Paz|America/Porto_Velho","America/La_Paz|Brazil/West","America/La_Paz|Etc/GMT+4","America/Lima|America/Bogota","America/Lima|America/Eirunepe","America/Lima|America/Guayaquil","America/Lima|America/Porto_Acre","America/Lima|America/Rio_Branco","America/Lima|Brazil/Acre","America/Lima|Etc/GMT+5","America/Los_Angeles|America/Ensenada","America/Los_Angeles|America/Santa_Isabel","America/Los_Angeles|America/Tijuana","America/Los_Angeles|America/Vancouver","America/Los_Angeles|Canada/Pacific","America/Los_Angeles|Mexico/BajaNorte","America/Los_Angeles|PST8PDT","America/Los_Angeles|US/Pacific","America/Los_Angeles|US/Pacific-New","America/Managua|America/Belize","America/Managua|America/Costa_Rica","America/Managua|America/El_Salvador","America/Managua|America/Guatemala","America/Managua|America/Regina","America/Managua|America/Swift_Current","America/Managua|America/Tegucigalpa","America/Managua|Canada/Saskatchewan","America/Mexico_City|America/Bahia_Banderas","America/Mexico_City|America/Merida","America/Mexico_City|America/Monterrey","America/Mexico_City|Mexico/General","America/New_York|America/Detroit","America/New_York|America/Fort_Wayne","America/New_York|America/Indiana/Indianapolis","America/New_York|America/Indiana/Marengo","America/New_York|America/Indiana/Petersburg","America/New_York|America/Indiana/Vevay","America/New_York|America/Indiana/Vincennes","America/New_York|America/Indiana/Winamac","America/New_York|America/Indianapolis","America/New_York|America/Iqaluit","America/New_York|America/Kentucky/Louisville","America/New_York|America/Kentucky/Monticello","America/New_York|America/Louisville","America/New_York|America/Montreal","America/New_York|America/Nassau","America/New_York|America/Nipigon","America/New_York|America/Pangnirtung","America/New_York|America/Thunder_Bay","America/New_York|America/Toronto","America/New_York|Canada/Eastern","America/New_York|EST5EDT","America/New_York|US/East-Indiana","America/New_York|US/Eastern","America/New_York|US/Michigan","America/Noronha|Atlantic/South_Georgia","America/Noronha|Brazil/DeNoronha","America/Noronha|Etc/GMT+2","America/Panama|America/Atikokan","America/Panama|America/Cayman","America/Panama|America/Coral_Harbour","America/Panama|America/Jamaica","America/Panama|EST","America/Panama|Jamaica","America/Phoenix|America/Creston","America/Phoenix|America/Dawson_Creek","America/Phoenix|America/Hermosillo","America/Phoenix|MST","America/Phoenix|US/Arizona","America/Santiago|Chile/Continental","America/Santo_Domingo|America/Anguilla","America/Santo_Domingo|America/Antigua","America/Santo_Domingo|America/Aruba","America/Santo_Domingo|America/Barbados","America/Santo_Domingo|America/Blanc-Sablon","America/Santo_Domingo|America/Curacao","America/Santo_Domingo|America/Dominica","America/Santo_Domingo|America/Grenada","America/Santo_Domingo|America/Guadeloupe","America/Santo_Domingo|America/Kralendijk","America/Santo_Domingo|America/Lower_Princes","America/Santo_Domingo|America/Marigot","America/Santo_Domingo|America/Martinique","America/Santo_Domingo|America/Montserrat","America/Santo_Domingo|America/Port_of_Spain","America/Santo_Domingo|America/Puerto_Rico","America/Santo_Domingo|America/St_Barthelemy","America/Santo_Domingo|America/St_Kitts","America/Santo_Domingo|America/St_Lucia","America/Santo_Domingo|America/St_Thomas","America/Santo_Domingo|America/St_Vincent","America/Santo_Domingo|America/Tortola","America/Santo_Domingo|America/Virgin","America/Sao_Paulo|Brazil/East","America/St_Johns|Canada/Newfoundland","America/Whitehorse|America/Dawson","America/Whitehorse|Canada/Yukon","Antarctica/Palmer|America/Punta_Arenas","Asia/Baghdad|Antarctica/Syowa","Asia/Baghdad|Asia/Aden","Asia/Baghdad|Asia/Bahrain","Asia/Baghdad|Asia/Kuwait","Asia/Baghdad|Asia/Qatar","Asia/Baghdad|Asia/Riyadh","Asia/Baghdad|Etc/GMT-3","Asia/Baghdad|Europe/Kirov","Asia/Baghdad|Europe/Minsk","Asia/Bangkok|Antarctica/Davis","Asia/Bangkok|Asia/Ho_Chi_Minh","Asia/Bangkok|Asia/Krasnoyarsk","Asia/Bangkok|Asia/Novokuznetsk","Asia/Bangkok|Asia/Phnom_Penh","Asia/Bangkok|Asia/Saigon","Asia/Bangkok|Asia/Vientiane","Asia/Bangkok|Etc/GMT-7","Asia/Bangkok|Indian/Christmas","Asia/Dhaka|Antarctica/Vostok","Asia/Dhaka|Asia/Almaty","Asia/Dhaka|Asia/Bishkek","Asia/Dhaka|Asia/Dacca","Asia/Dhaka|Asia/Kashgar","Asia/Dhaka|Asia/Omsk","Asia/Dhaka|Asia/Qostanay","Asia/Dhaka|Asia/Thimbu","Asia/Dhaka|Asia/Thimphu","Asia/Dhaka|Asia/Urumqi","Asia/Dhaka|Etc/GMT-6","Asia/Dhaka|Indian/Chagos","Asia/Dubai|Asia/Muscat","Asia/Dubai|Asia/Tbilisi","Asia/Dubai|Asia/Yerevan","Asia/Dubai|Etc/GMT-4","Asia/Dubai|Europe/Samara","Asia/Dubai|Indian/Mahe","Asia/Dubai|Indian/Mauritius","Asia/Dubai|Indian/Reunion","Asia/Gaza|Asia/Hebron","Asia/Hong_Kong|Hongkong","Asia/Jakarta|Asia/Pontianak","Asia/Jerusalem|Asia/Tel_Aviv","Asia/Jerusalem|Israel","Asia/Kamchatka|Asia/Anadyr","Asia/Kamchatka|Etc/GMT-12","Asia/Kamchatka|Kwajalein","Asia/Kamchatka|Pacific/Funafuti","Asia/Kamchatka|Pacific/Kwajalein","Asia/Kamchatka|Pacific/Majuro","Asia/Kamchatka|Pacific/Nauru","Asia/Kamchatka|Pacific/Tarawa","Asia/Kamchatka|Pacific/Wake","Asia/Kamchatka|Pacific/Wallis","Asia/Kathmandu|Asia/Katmandu","Asia/Kolkata|Asia/Calcutta","Asia/Kuala_Lumpur|Asia/Brunei","Asia/Kuala_Lumpur|Asia/Irkutsk","Asia/Kuala_Lumpur|Asia/Kuching","Asia/Kuala_Lumpur|Asia/Singapore","Asia/Kuala_Lumpur|Etc/GMT-8","Asia/Kuala_Lumpur|Singapore","Asia/Makassar|Asia/Ujung_Pandang","Asia/Rangoon|Asia/Yangon","Asia/Rangoon|Indian/Cocos","Asia/Seoul|ROK","Asia/Shanghai|Asia/Chongqing","Asia/Shanghai|Asia/Chungking","Asia/Shanghai|Asia/Harbin","Asia/Shanghai|Asia/Macao","Asia/Shanghai|Asia/Macau","Asia/Shanghai|Asia/Taipei","Asia/Shanghai|PRC","Asia/Shanghai|ROC","Asia/Tashkent|Antarctica/Mawson","Asia/Tashkent|Asia/Aqtau","Asia/Tashkent|Asia/Aqtobe","Asia/Tashkent|Asia/Ashgabat","Asia/Tashkent|Asia/Ashkhabad","Asia/Tashkent|Asia/Atyrau","Asia/Tashkent|Asia/Dushanbe","Asia/Tashkent|Asia/Oral","Asia/Tashkent|Asia/Samarkand","Asia/Tashkent|Asia/Yekaterinburg","Asia/Tashkent|Etc/GMT-5","Asia/Tashkent|Indian/Kerguelen","Asia/Tashkent|Indian/Maldives","Asia/Tehran|Iran","Asia/Tokyo|Japan","Asia/Ulaanbaatar|Asia/Choibalsan","Asia/Ulaanbaatar|Asia/Ulan_Bator","Asia/Vladivostok|Antarctica/DumontDUrville","Asia/Vladivostok|Asia/Ust-Nera","Asia/Vladivostok|Etc/GMT-10","Asia/Vladivostok|Pacific/Chuuk","Asia/Vladivostok|Pacific/Port_Moresby","Asia/Vladivostok|Pacific/Truk","Asia/Vladivostok|Pacific/Yap","Asia/Yakutsk|Asia/Dili","Asia/Yakutsk|Asia/Khandyga","Asia/Yakutsk|Etc/GMT-9","Asia/Yakutsk|Pacific/Palau","Atlantic/Azores|America/Scoresbysund","Atlantic/Cape_Verde|Etc/GMT+1","Australia/Adelaide|Australia/Broken_Hill","Australia/Adelaide|Australia/South","Australia/Adelaide|Australia/Yancowinna","Australia/Brisbane|Australia/Lindeman","Australia/Brisbane|Australia/Queensland","Australia/Darwin|Australia/North","Australia/Lord_Howe|Australia/LHI","Australia/Perth|Australia/West","Australia/Sydney|Australia/ACT","Australia/Sydney|Australia/Canberra","Australia/Sydney|Australia/Currie","Australia/Sydney|Australia/Hobart","Australia/Sydney|Australia/Melbourne","Australia/Sydney|Australia/NSW","Australia/Sydney|Australia/Tasmania","Australia/Sydney|Australia/Victoria","Etc/UTC|Etc/UCT","Etc/UTC|Etc/Universal","Etc/UTC|Etc/Zulu","Etc/UTC|UCT","Etc/UTC|UTC","Etc/UTC|Universal","Etc/UTC|Zulu","Europe/Athens|Asia/Nicosia","Europe/Athens|EET","Europe/Athens|Europe/Bucharest","Europe/Athens|Europe/Helsinki","Europe/Athens|Europe/Kiev","Europe/Athens|Europe/Mariehamn","Europe/Athens|Europe/Nicosia","Europe/Athens|Europe/Riga","Europe/Athens|Europe/Sofia","Europe/Athens|Europe/Tallinn","Europe/Athens|Europe/Uzhgorod","Europe/Athens|Europe/Vilnius","Europe/Athens|Europe/Zaporozhye","Europe/Chisinau|Europe/Tiraspol","Europe/Dublin|Eire","Europe/Istanbul|Asia/Istanbul","Europe/Istanbul|Turkey","Europe/Lisbon|Atlantic/Canary","Europe/Lisbon|Atlantic/Faeroe","Europe/Lisbon|Atlantic/Faroe","Europe/Lisbon|Atlantic/Madeira","Europe/Lisbon|Portugal","Europe/Lisbon|WET","Europe/London|Europe/Belfast","Europe/London|Europe/Guernsey","Europe/London|Europe/Isle_of_Man","Europe/London|Europe/Jersey","Europe/London|GB","Europe/London|GB-Eire","Europe/Moscow|Europe/Simferopol","Europe/Moscow|W-SU","Europe/Paris|Africa/Ceuta","Europe/Paris|Arctic/Longyearbyen","Europe/Paris|Atlantic/Jan_Mayen","Europe/Paris|CET","Europe/Paris|Europe/Amsterdam","Europe/Paris|Europe/Andorra","Europe/Paris|Europe/Belgrade","Europe/Paris|Europe/Berlin","Europe/Paris|Europe/Bratislava","Europe/Paris|Europe/Brussels","Europe/Paris|Europe/Budapest","Europe/Paris|Europe/Busingen","Europe/Paris|Europe/Copenhagen","Europe/Paris|Europe/Gibraltar","Europe/Paris|Europe/Ljubljana","Europe/Paris|Europe/Luxembourg","Europe/Paris|Europe/Madrid","Europe/Paris|Europe/Malta","Europe/Paris|Europe/Monaco","Europe/Paris|Europe/Oslo","Europe/Paris|Europe/Podgorica","Europe/Paris|Europe/Prague","Europe/Paris|Europe/Rome","Europe/Paris|Europe/San_Marino","Europe/Paris|Europe/Sarajevo","Europe/Paris|Europe/Skopje","Europe/Paris|Europe/Stockholm","Europe/Paris|Europe/Tirane","Europe/Paris|Europe/Vaduz","Europe/Paris|Europe/Vatican","Europe/Paris|Europe/Vienna","Europe/Paris|Europe/Warsaw","Europe/Paris|Europe/Zagreb","Europe/Paris|Europe/Zurich","Europe/Paris|Poland","Europe/Ulyanovsk|Europe/Astrakhan","Pacific/Auckland|Antarctica/McMurdo","Pacific/Auckland|Antarctica/South_Pole","Pacific/Auckland|NZ","Pacific/Bougainville|Antarctica/Macquarie","Pacific/Bougainville|Asia/Srednekolymsk","Pacific/Bougainville|Etc/GMT-11","Pacific/Bougainville|Pacific/Efate","Pacific/Bougainville|Pacific/Guadalcanal","Pacific/Bougainville|Pacific/Kosrae","Pacific/Bougainville|Pacific/Noumea","Pacific/Bougainville|Pacific/Pohnpei","Pacific/Bougainville|Pacific/Ponape","Pacific/Chatham|NZ-CHAT","Pacific/Easter|Chile/EasterIsland","Pacific/Fakaofo|Etc/GMT-13","Pacific/Fakaofo|Pacific/Enderbury","Pacific/Galapagos|Etc/GMT+6","Pacific/Gambier|Etc/GMT+9","Pacific/Guam|Pacific/Saipan","Pacific/Honolulu|HST","Pacific/Honolulu|Pacific/Johnston","Pacific/Honolulu|US/Hawaii","Pacific/Kiritimati|Etc/GMT-14","Pacific/Niue|Etc/GMT+11","Pacific/Pago_Pago|Pacific/Midway","Pacific/Pago_Pago|Pacific/Samoa","Pacific/Pago_Pago|US/Samoa","Pacific/Pitcairn|Etc/GMT+8","Pacific/Tahiti|Etc/GMT+10","Pacific/Tahiti|Pacific/Rarotonga"],countries:["AD|Europe/Andorra","AE|Asia/Dubai","AF|Asia/Kabul","AG|America/Port_of_Spain America/Antigua","AI|America/Port_of_Spain America/Anguilla","AL|Europe/Tirane","AM|Asia/Yerevan","AO|Africa/Lagos Africa/Luanda","AQ|Antarctica/Casey Antarctica/Davis Antarctica/DumontDUrville Antarctica/Mawson Antarctica/Palmer Antarctica/Rothera Antarctica/Syowa Antarctica/Troll Antarctica/Vostok Pacific/Auckland Antarctica/McMurdo","AR|America/Argentina/Buenos_Aires America/Argentina/Cordoba America/Argentina/Salta America/Argentina/Jujuy America/Argentina/Tucuman America/Argentina/Catamarca America/Argentina/La_Rioja America/Argentina/San_Juan America/Argentina/Mendoza America/Argentina/San_Luis America/Argentina/Rio_Gallegos America/Argentina/Ushuaia","AS|Pacific/Pago_Pago","AT|Europe/Vienna","AU|Australia/Lord_Howe Antarctica/Macquarie Australia/Hobart Australia/Currie Australia/Melbourne Australia/Sydney Australia/Broken_Hill Australia/Brisbane Australia/Lindeman Australia/Adelaide Australia/Darwin Australia/Perth Australia/Eucla","AW|America/Curacao America/Aruba","AX|Europe/Helsinki Europe/Mariehamn","AZ|Asia/Baku","BA|Europe/Belgrade Europe/Sarajevo","BB|America/Barbados","BD|Asia/Dhaka","BE|Europe/Brussels","BF|Africa/Abidjan Africa/Ouagadougou","BG|Europe/Sofia","BH|Asia/Qatar Asia/Bahrain","BI|Africa/Maputo Africa/Bujumbura","BJ|Africa/Lagos Africa/Porto-Novo","BL|America/Port_of_Spain America/St_Barthelemy","BM|Atlantic/Bermuda","BN|Asia/Brunei","BO|America/La_Paz","BQ|America/Curacao America/Kralendijk","BR|America/Noronha America/Belem America/Fortaleza America/Recife America/Araguaina America/Maceio America/Bahia America/Sao_Paulo America/Campo_Grande America/Cuiaba America/Santarem America/Porto_Velho America/Boa_Vista America/Manaus America/Eirunepe America/Rio_Branco","BS|America/Nassau","BT|Asia/Thimphu","BW|Africa/Maputo Africa/Gaborone","BY|Europe/Minsk","BZ|America/Belize","CA|America/St_Johns America/Halifax America/Glace_Bay America/Moncton America/Goose_Bay America/Blanc-Sablon America/Toronto America/Nipigon America/Thunder_Bay America/Iqaluit America/Pangnirtung America/Atikokan America/Winnipeg America/Rainy_River America/Resolute America/Rankin_Inlet America/Regina America/Swift_Current America/Edmonton America/Cambridge_Bay America/Yellowknife America/Inuvik America/Creston America/Dawson_Creek America/Fort_Nelson America/Vancouver America/Whitehorse America/Dawson","CC|Indian/Cocos","CD|Africa/Maputo Africa/Lagos Africa/Kinshasa Africa/Lubumbashi","CF|Africa/Lagos Africa/Bangui","CG|Africa/Lagos Africa/Brazzaville","CH|Europe/Zurich","CI|Africa/Abidjan","CK|Pacific/Rarotonga","CL|America/Santiago America/Punta_Arenas Pacific/Easter","CM|Africa/Lagos Africa/Douala","CN|Asia/Shanghai Asia/Urumqi","CO|America/Bogota","CR|America/Costa_Rica","CU|America/Havana","CV|Atlantic/Cape_Verde","CW|America/Curacao","CX|Indian/Christmas","CY|Asia/Nicosia Asia/Famagusta","CZ|Europe/Prague","DE|Europe/Zurich Europe/Berlin Europe/Busingen","DJ|Africa/Nairobi Africa/Djibouti","DK|Europe/Copenhagen","DM|America/Port_of_Spain America/Dominica","DO|America/Santo_Domingo","DZ|Africa/Algiers","EC|America/Guayaquil Pacific/Galapagos","EE|Europe/Tallinn","EG|Africa/Cairo","EH|Africa/El_Aaiun","ER|Africa/Nairobi Africa/Asmara","ES|Europe/Madrid Africa/Ceuta Atlantic/Canary","ET|Africa/Nairobi Africa/Addis_Ababa","FI|Europe/Helsinki","FJ|Pacific/Fiji","FK|Atlantic/Stanley","FM|Pacific/Chuuk Pacific/Pohnpei Pacific/Kosrae","FO|Atlantic/Faroe","FR|Europe/Paris","GA|Africa/Lagos Africa/Libreville","GB|Europe/London","GD|America/Port_of_Spain America/Grenada","GE|Asia/Tbilisi","GF|America/Cayenne","GG|Europe/London Europe/Guernsey","GH|Africa/Accra","GI|Europe/Gibraltar","GL|America/Godthab America/Danmarkshavn America/Scoresbysund America/Thule","GM|Africa/Abidjan Africa/Banjul","GN|Africa/Abidjan Africa/Conakry","GP|America/Port_of_Spain America/Guadeloupe","GQ|Africa/Lagos Africa/Malabo","GR|Europe/Athens","GS|Atlantic/South_Georgia","GT|America/Guatemala","GU|Pacific/Guam","GW|Africa/Bissau","GY|America/Guyana","HK|Asia/Hong_Kong","HN|America/Tegucigalpa","HR|Europe/Belgrade Europe/Zagreb","HT|America/Port-au-Prince","HU|Europe/Budapest","ID|Asia/Jakarta Asia/Pontianak Asia/Makassar Asia/Jayapura","IE|Europe/Dublin","IL|Asia/Jerusalem","IM|Europe/London Europe/Isle_of_Man","IN|Asia/Kolkata","IO|Indian/Chagos","IQ|Asia/Baghdad","IR|Asia/Tehran","IS|Atlantic/Reykjavik","IT|Europe/Rome","JE|Europe/London Europe/Jersey","JM|America/Jamaica","JO|Asia/Amman","JP|Asia/Tokyo","KE|Africa/Nairobi","KG|Asia/Bishkek","KH|Asia/Bangkok Asia/Phnom_Penh","KI|Pacific/Tarawa Pacific/Enderbury Pacific/Kiritimati","KM|Africa/Nairobi Indian/Comoro","KN|America/Port_of_Spain America/St_Kitts","KP|Asia/Pyongyang","KR|Asia/Seoul","KW|Asia/Riyadh Asia/Kuwait","KY|America/Panama America/Cayman","KZ|Asia/Almaty Asia/Qyzylorda Asia/Qostanay Asia/Aqtobe Asia/Aqtau Asia/Atyrau Asia/Oral","LA|Asia/Bangkok Asia/Vientiane","LB|Asia/Beirut","LC|America/Port_of_Spain America/St_Lucia","LI|Europe/Zurich Europe/Vaduz","LK|Asia/Colombo","LR|Africa/Monrovia","LS|Africa/Johannesburg Africa/Maseru","LT|Europe/Vilnius","LU|Europe/Luxembourg","LV|Europe/Riga","LY|Africa/Tripoli","MA|Africa/Casablanca","MC|Europe/Monaco","MD|Europe/Chisinau","ME|Europe/Belgrade Europe/Podgorica","MF|America/Port_of_Spain America/Marigot","MG|Africa/Nairobi Indian/Antananarivo","MH|Pacific/Majuro Pacific/Kwajalein","MK|Europe/Belgrade Europe/Skopje","ML|Africa/Abidjan Africa/Bamako","MM|Asia/Yangon","MN|Asia/Ulaanbaatar Asia/Hovd Asia/Choibalsan","MO|Asia/Macau","MP|Pacific/Guam Pacific/Saipan","MQ|America/Martinique","MR|Africa/Abidjan Africa/Nouakchott","MS|America/Port_of_Spain America/Montserrat","MT|Europe/Malta","MU|Indian/Mauritius","MV|Indian/Maldives","MW|Africa/Maputo Africa/Blantyre","MX|America/Mexico_City America/Cancun America/Merida America/Monterrey America/Matamoros America/Mazatlan America/Chihuahua America/Ojinaga America/Hermosillo America/Tijuana America/Bahia_Banderas","MY|Asia/Kuala_Lumpur Asia/Kuching","MZ|Africa/Maputo","NA|Africa/Windhoek","NC|Pacific/Noumea","NE|Africa/Lagos Africa/Niamey","NF|Pacific/Norfolk","NG|Africa/Lagos","NI|America/Managua","NL|Europe/Amsterdam","NO|Europe/Oslo","NP|Asia/Kathmandu","NR|Pacific/Nauru","NU|Pacific/Niue","NZ|Pacific/Auckland Pacific/Chatham","OM|Asia/Dubai Asia/Muscat","PA|America/Panama","PE|America/Lima","PF|Pacific/Tahiti Pacific/Marquesas Pacific/Gambier","PG|Pacific/Port_Moresby Pacific/Bougainville","PH|Asia/Manila","PK|Asia/Karachi","PL|Europe/Warsaw","PM|America/Miquelon","PN|Pacific/Pitcairn","PR|America/Puerto_Rico","PS|Asia/Gaza Asia/Hebron","PT|Europe/Lisbon Atlantic/Madeira Atlantic/Azores","PW|Pacific/Palau","PY|America/Asuncion","QA|Asia/Qatar","RE|Indian/Reunion","RO|Europe/Bucharest","RS|Europe/Belgrade","RU|Europe/Kaliningrad Europe/Moscow Europe/Simferopol Europe/Kirov Europe/Astrakhan Europe/Volgograd Europe/Saratov Europe/Ulyanovsk Europe/Samara Asia/Yekaterinburg Asia/Omsk Asia/Novosibirsk Asia/Barnaul Asia/Tomsk Asia/Novokuznetsk Asia/Krasnoyarsk Asia/Irkutsk Asia/Chita Asia/Yakutsk Asia/Khandyga Asia/Vladivostok Asia/Ust-Nera Asia/Magadan Asia/Sakhalin Asia/Srednekolymsk Asia/Kamchatka Asia/Anadyr","RW|Africa/Maputo Africa/Kigali","SA|Asia/Riyadh","SB|Pacific/Guadalcanal","SC|Indian/Mahe","SD|Africa/Khartoum","SE|Europe/Stockholm","SG|Asia/Singapore","SH|Africa/Abidjan Atlantic/St_Helena","SI|Europe/Belgrade Europe/Ljubljana","SJ|Europe/Oslo Arctic/Longyearbyen","SK|Europe/Prague Europe/Bratislava","SL|Africa/Abidjan Africa/Freetown","SM|Europe/Rome Europe/San_Marino","SN|Africa/Abidjan Africa/Dakar","SO|Africa/Nairobi Africa/Mogadishu","SR|America/Paramaribo","SS|Africa/Juba","ST|Africa/Sao_Tome","SV|America/El_Salvador","SX|America/Curacao America/Lower_Princes","SY|Asia/Damascus","SZ|Africa/Johannesburg Africa/Mbabane","TC|America/Grand_Turk","TD|Africa/Ndjamena","TF|Indian/Reunion Indian/Kerguelen","TG|Africa/Abidjan Africa/Lome","TH|Asia/Bangkok","TJ|Asia/Dushanbe","TK|Pacific/Fakaofo","TL|Asia/Dili","TM|Asia/Ashgabat","TN|Africa/Tunis","TO|Pacific/Tongatapu","TR|Europe/Istanbul","TT|America/Port_of_Spain","TV|Pacific/Funafuti","TW|Asia/Taipei","TZ|Africa/Nairobi Africa/Dar_es_Salaam","UA|Europe/Simferopol Europe/Kiev Europe/Uzhgorod Europe/Zaporozhye","UG|Africa/Nairobi Africa/Kampala","UM|Pacific/Pago_Pago Pacific/Wake Pacific/Honolulu Pacific/Midway","US|America/New_York America/Detroit America/Kentucky/Louisville America/Kentucky/Monticello America/Indiana/Indianapolis America/Indiana/Vincennes America/Indiana/Winamac America/Indiana/Marengo America/Indiana/Petersburg America/Indiana/Vevay America/Chicago America/Indiana/Tell_City America/Indiana/Knox America/Menominee America/North_Dakota/Center America/North_Dakota/New_Salem America/North_Dakota/Beulah America/Denver America/Boise America/Phoenix America/Los_Angeles America/Anchorage America/Juneau America/Sitka America/Metlakatla America/Yakutat America/Nome America/Adak Pacific/Honolulu","UY|America/Montevideo","UZ|Asia/Samarkand Asia/Tashkent","VA|Europe/Rome Europe/Vatican","VC|America/Port_of_Spain America/St_Vincent","VE|America/Caracas","VG|America/Port_of_Spain America/Tortola","VI|America/Port_of_Spain America/St_Thomas","VN|Asia/Bangkok Asia/Ho_Chi_Minh","VU|Pacific/Efate","WF|Pacific/Wallis","WS|Pacific/Apia","YE|Asia/Riyadh Asia/Aden","YT|Africa/Nairobi Indian/Mayotte","ZA|Africa/Johannesburg","ZM|Africa/Maputo Africa/Lusaka","ZW|Africa/Maputo Africa/Harare"]}),c}); diff --git a/1337X_-_convert_torrent_timestamps_to_relative_format/moment.min.js b/1337X_-_convert_torrent_timestamps_to_relative_format/moment.min.js new file mode 100644 index 0000000..57cd2d4 --- /dev/null +++ b/1337X_-_convert_torrent_timestamps_to_relative_format/moment.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e,i;function f(){return e.apply(null,arguments)}function o(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function u(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function l(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(var t in e)if(m(e,t))return;return 1}function r(e){return void 0===e}function h(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function a(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function d(e,t){for(var n=[],s=0;s>>0,s=0;sFe(e)?(r=e+1,a-Fe(e)):(r=e,a);return{year:r,dayOfYear:o}}function Ae(e,t,n){var s,i,r=Ge(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+je(i=e.year()-1,t,n):a>je(e.year(),t,n)?(s=a-je(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function je(e,t,n){var s=Ge(e,t,n),i=Ge(e+1,t,n);return(Fe(e)-s+i)/7}C("w",["ww",2],"wo","week"),C("W",["WW",2],"Wo","isoWeek"),L("week","w"),L("isoWeek","W"),A("week",5),A("isoWeek",5),ce("w",te),ce("ww",te,Q),ce("W",te),ce("WW",te,Q),ge(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=Z(e)});function Ie(e,t){return e.slice(t,7).concat(e.slice(0,t))}C("d",0,"do","day"),C("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),C("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),C("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),C("e",0,0,"weekday"),C("E",0,0,"isoWeekday"),L("day","d"),L("weekday","e"),L("isoWeekday","E"),A("day",11),A("weekday",11),A("isoWeekday",11),ce("d",te),ce("e",te),ce("E",te),ce("dd",function(e,t){return t.weekdaysMinRegex(e)}),ce("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ce("dddd",function(e,t){return t.weekdaysRegex(e)}),ge(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:y(n).invalidWeekday=e}),ge(["d","e","E"],function(e,t,n,s){t[s]=Z(e)});var Ze="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),$e="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),qe=de,Be=de,Je=de;function Qe(){function e(e,t){return t.length-e.length}for(var t,n,s,i,r=[],a=[],o=[],u=[],l=0;l<7;l++)t=_([2e3,1]).day(l),n=me(this.weekdaysMin(t,"")),s=me(this.weekdaysShort(t,"")),i=me(this.weekdays(t,"")),r.push(n),a.push(s),o.push(i),u.push(n),u.push(s),u.push(i);r.sort(e),a.sort(e),o.sort(e),u.sort(e),this._weekdaysRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function Xe(){return this.hours()%12||12}function Ke(e,t){C(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function et(e,t){return t._meridiemParse}C("H",["HH",2],0,"hour"),C("h",["hh",2],0,Xe),C("k",["kk",2],0,function(){return this.hours()||24}),C("hmm",0,0,function(){return""+Xe.apply(this)+T(this.minutes(),2)}),C("hmmss",0,0,function(){return""+Xe.apply(this)+T(this.minutes(),2)+T(this.seconds(),2)}),C("Hmm",0,0,function(){return""+this.hours()+T(this.minutes(),2)}),C("Hmmss",0,0,function(){return""+this.hours()+T(this.minutes(),2)+T(this.seconds(),2)}),Ke("a",!0),Ke("A",!1),L("hour","h"),A("hour",13),ce("a",et),ce("A",et),ce("H",te),ce("h",te),ce("k",te),ce("HH",te,Q),ce("hh",te,Q),ce("kk",te,Q),ce("hmm",ne),ce("hmmss",se),ce("Hmm",ne),ce("Hmmss",se),ye(["H","HH"],Me),ye(["k","kk"],function(e,t,n){var s=Z(e);t[Me]=24===s?0:s}),ye(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ye(["h","hh"],function(e,t,n){t[Me]=Z(e),y(n).bigHour=!0}),ye("hmm",function(e,t,n){var s=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s)),y(n).bigHour=!0}),ye("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s,2)),t[Se]=Z(e.substr(i)),y(n).bigHour=!0}),ye("Hmm",function(e,t,n){var s=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s))}),ye("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s,2)),t[Se]=Z(e.substr(i))});var tt=z("Hours",!0);var nt,st={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Te,monthsShort:Ne,week:{dow:0,doy:6},weekdays:Ze,weekdaysMin:$e,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},it={},rt={};function at(e){return e?e.toLowerCase().replace("_","-"):e}function ot(e){for(var t,n,s,i,r=0;r=t&&function(e,t){for(var n=Math.min(e.length,t.length),s=0;s=t-1)break;t--}r++}return nt}function ut(t){var e;if(void 0===it[t]&&"undefined"!=typeof module&&module&&module.exports)try{e=nt._abbr,require("./locale/"+t),lt(e)}catch(e){it[t]=null}return it[t]}function lt(e,t){var n;return e&&((n=r(t)?dt(e):ht(e,t))?nt=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),nt._abbr}function ht(e,t){if(null===t)return delete it[e],null;var n,s=st;if(t.abbr=e,null!=it[e])Y("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=it[e]._config;else if(null!=t.parentLocale)if(null!=it[t.parentLocale])s=it[t.parentLocale]._config;else{if(null==(n=ut(t.parentLocale)))return rt[t.parentLocale]||(rt[t.parentLocale]=[]),rt[t.parentLocale].push({name:e,config:t}),null;s=n._config}return it[e]=new x(b(s,t)),rt[e]&&rt[e].forEach(function(e){ht(e.name,e.config)}),lt(e),it[e]}function dt(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return nt;if(!o(e)){if(t=ut(e))return t;e=[e]}return ot(e)}function ct(e){var t,n=e._a;return n&&-2===y(e).overflow&&(t=n[ve]<0||11xe(n[pe],n[ve])?ke:n[Me]<0||24je(n,r,a)?y(e)._overflowWeeks=!0:null!=u?y(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._a[pe]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=St(e._a[pe],s[pe]),(e._dayOfYear>Fe(r)||0===e._dayOfYear)&&(y(e)._overflowDayOfYear=!0),n=Ve(r,0,e._dayOfYear),e._a[ve]=n.getUTCMonth(),e._a[ke]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=u[t]=s[t];for(;t<7;t++)e._a[t]=u[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[Me]&&0===e._a[De]&&0===e._a[Se]&&0===e._a[Ye]&&(e._nextDay=!0,e._a[Me]=0),e._d=(e._useUTC?Ve:function(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}).apply(null,u),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Me]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(y(e).weekdayMismatch=!0)}}function Ot(e){if(e._f!==f.ISO_8601)if(e._f!==f.RFC_2822){e._a=[],y(e).empty=!0;for(var t,n,s,i,r,a,o,u=""+e._i,l=u.length,h=0,d=H(e._f,e._locale).match(N)||[],c=0;cn.valueOf():n.valueOf()"}),pn.toJSON=function(){return this.isValid()?this.toISOString():null},pn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},pn.unix=function(){return Math.floor(this.valueOf()/1e3)},pn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},pn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},pn.eraName=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},pn.isLocal=function(){return!!this.isValid()&&!this._isUTC},pn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},pn.isUtc=At,pn.isUTC=At,pn.zoneAbbr=function(){return this._isUTC?"UTC":""},pn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},pn.dates=n("dates accessor is deprecated. Use date instead.",fn),pn.months=n("months accessor is deprecated. Use month instead",Ue),pn.years=n("years accessor is deprecated. Use year instead",Le),pn.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),pn.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!r(this._isDSTShifted))return this._isDSTShifted;var e,t={};return v(t,this),(t=bt(t))._a?(e=(t._isUTC?_:Tt)(t._a),this._isDSTShifted=this.isValid()&&0 i.flaticon-magnet { + font-size: 13px; + color: #da3a04 + } + + .list-button-dl > i.flaticon-torrent-download { + font-size: 13px; + color: #89ad19; + } + + table.table-list td.dl-buttons { + border-left: 1px solid #f6f6f6; + border-right: 1px solid #c0c0c0; + padding-left: 2.5px; + padding-right: 2.5px; + text-align: center !important; + position: relative; + display: table-cell !important; /* proper height of cell on multiple row torrent name */ + width: 6%; + } + + td.dl-buttons > a, + td.dl-buttons > a:hover, + td.dl-buttons > a:visited, + td.dl-buttons > a:link, + td.dl-buttons > a:active { + color: inherit; + text-decoration: none; + cursor: pointer; + display: inline-block !important; + /* margin: 0 1.5px; */ + margin: 0 2px; + } + + table.table-list td.coll-1b { + border-right: 1px solid silver; + } + + .table-list > thead > tr > th:nth-child(2), + .table-list > thead > tr > td:nth-child(2) { + text-align: center; + } + +`); + + +function appendColumn() { + + const allTables = document.querySelectorAll('.table-list-wrap'); // for pages with multiple tables e.g. https://1337x.to/home/ + const isSeries = window.location.href.includes('/series/'); // for pages with tables that have no header e.g. https://1337x.to/series/a-to-z/1/13/ + const title = 'ml dl'; + + + allTables.forEach((table) => { + + const headersCellsInitial = table.querySelectorAll(`.table-list > thead > tr:not(.blank) > th:nth-child(1), + .table-list > tbody > tr:not(.blank) > td:nth-child(1)`); + headersCellsInitial.forEach((cell, index) => { + if (index === 0 && !isSeries) { + cell.insertAdjacentHTML('afterend', `` + title + ``); + } else { + cell.insertAdjacentHTML('afterend', `` + title + ``); + } + }); + + const headersCellsNew = table.querySelectorAll(`.table-list > thead > tr:not(.blank) > th:nth-child(2), + .table-list > tbody > tr:not(.blank) > td:nth-child(2)`); + headersCellsNew.forEach((cell, index) => { + cell.classList.add('coll-1b'); + if (index === 0 && !isSeries) { + cell.innerHTML = title; + } else { + cell.classList.add('dl-buttons'); + + let href; + if (!isSeries){ + href = headersCellsInitial[index].firstElementChild.nextElementSibling.href; + } else { + href = headersCellsInitial[index].firstElementChild.href; + } + + cell.innerHTML = ``; + cell.innerHTML += ``; + } + }); + + + }); + + +} + + + +function addClickListeners(links, type){ + + links.forEach((link) => { + + link.addEventListener('click', function(){ + + let href = this.getAttribute('href'); + if (href === 'javascript:void(0)') { + let tLink = this.getAttribute('data-href'); + + var xhr = new XMLHttpRequest(); + xhr.open('GET', tLink, true); // XMLHttpRequest.open(method, url, async) + xhr.onload = function () { + + let container = document.implementation.createHTMLDocument().documentElement; + container.innerHTML = xhr.responseText; + + let retrievedLink = (type === 'ml') ? container.querySelector('a[href^="magnet:"]') : container.querySelector('.dropdown-menu > li > a'); + + if (retrievedLink) { + link.setAttribute('href', retrievedLink.href.replace('http:', 'https:')); // the links are http and as such are blocked in Chrome + link.click(); + } + + + }; + xhr.send(); + + } + + }, false); + + }); + +} + + + +function createColumn(){ + appendColumn(); + addClickListeners(document.querySelectorAll('.list-button-magnet'), 'ml' ); + addClickListeners(document.querySelectorAll('.list-button-dl'), 'dl' ); +} + + +createColumn(); diff --git a/1337x_-_torrent_and_magnet_links/README.md b/1337x_-_torrent_and_magnet_links/README.md new file mode 100644 index 0000000..899c5f6 --- /dev/null +++ b/1337x_-_torrent_and_magnet_links/README.md @@ -0,0 +1,17 @@ +Adds a column with torrent and magnet links in 1337x lists: +![](https://i.imgur.com/goYAFQH.jpg) + +Notes: + +- The script generates all links via XHR: + - The DL/ML links will have: + - as tooltip: "`ml/dl via xhr`". + - as destination (href): + - initially: `javascript:void(0)` *(to avoid taking the user back to the top of the page, which occurred if having `#`, instead)*, + - as you click a ml/dl icon, the relevant target URL will be retrieved via XHR in the background. +- Thanks to: + - NotNeo: most of the CSS is from his [1337X - Magnet/Torrent links everywhere](https://greasyfork.org/en/scripts/373230-1337x-magnet-torrent-links-everywhere) script, + - barn852 for [this](https://greasyfork.org/en/scripts/420754-1337x-torrent-and-magnet-links/discussions/96026) contribution . +- Tampermonkey and Violentmonkey are supported - Greasemonkey is NOT supported. + +[Hosted at GitHub](https://github.com/darkred/Userscripts) diff --git a/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area.user.js b/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area.user.js new file mode 100644 index 0000000..d28f711 --- /dev/null +++ b/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area.user.js @@ -0,0 +1,255 @@ +// ==UserScript== +// @name Blabbermouth - generate timestamps and add link to the fb comments area +// @namespace darkred +// @version 2.0 +// @date 2022.5.14 +// @description Generates missing timestamps or converts the existing ones in relative format, and adds link to the fb comments area +// @author darkred +// @license MIT +// @include /^(https?:)?\/\/(www\.)?blabbermouth\.net\/(news|reviews)?/ +// @exclude /^(https?:)?\/\/(www\.)?blabbermouth\.net\/reviews(\/page|$)/ +// @include https://www.facebook.com/plugins/feedback.php* +// @grant none +// @require https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js +// @supportURL https://github.com/darkred/Userscripts/issues +// @icon https://drnizx3otcofi.cloudfront.net/b64e6010-2ac1-4e95-b545-1a2994bbbd04/img/favicon/favicon-32x32.png +// ==/UserScript== + + +/* global moment */ +/* eslint-disable no-console */ + +'use strict'; + + +// Customize the strings in the locale to display "1 minute ago" instead of "a minute ago" (https://github.com/moment/moment/issues/3764#issuecomment-279928245) +moment.updateLocale('en', { + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'seconds', + m: '1 minute', + mm: '%d minutes', + h: '1 hour', + hh: '%d hours', + d: '1 day', + dd: '%d days', + M: '1 month', + MM: '%d months', + y: '1 year', + yy: '%d years' + } +}); + +function convertToLocalTimezone(timestamp) { + // (the timestamp is in ISO 8601 format and its trailing Z means that it's in UTC ) + // 2020-03-05T15:40:38.000Z old + // 2022-05-11T12:16:05+00:00 new + let initialTimestamp = timestamp; + if (moment(initialTimestamp, moment.ISO_8601, true).isValid()) { + // let convertedToLocalTimezone = moment(initialTimestamp.replace('Z','') + '-05:00', 'YYYY-MM-DDTHH:mm:ssZ'); // the server's timezone is GMT-5 + let convertedToLocalTimezone = moment(initialTimestamp + '-03:47', 'YYYY-MM-DDTHH:mm:ss+Z'); // the server's timezone is GMT-4 plus 13 min, in order to sync with the relevant post timestamps in both Facebook and Twitter(TW is 1 min later than FB) blabbbermouth pages + publishedTimeLTZ = convertedToLocalTimezone.fromNow(); + let format = 'YYYY-MM-DD HH:mm:ss'; + publishedTimeLTZtitle = convertedToLocalTimezone.format(format); + } +} + +function recalc(existingTimestampElement, format, notitle) { + setInterval(function() { + if (existingTimestampElement && moment(existingTimestampElement.title, format, true).isValid()) { + existingTimestampElement.textContent = moment(existingTimestampElement.title).fromNow(); + } else if (notitle === true) { + existingTimestampElement.innerText = moment(existingTimestampElement.innerText.trim()).fromNow(); + } + }, 1 * 60 * 1000); // repeat every 1 minute +} + + +function onClick(){ + document.querySelector('iframe[title="fb:comments Facebook Social Plugin"]').scrollIntoView(); +} + + +// 1. IF ON NEWS PAGES LISTINGS (convertTolocal + apply to pagination) +if ( + window.location.href.endsWith('blabbermouth.net/') || + window.location.href.endsWith('blabbermouth.net/news') || + window.location.href.includes('blabbermouth.net/news/page/') +) { + + let options = { + root: null, + rootMargin: '0px', + threshold: 0 + }; + + let callback = (entries) => { + entries.forEach(entry => { + + if (!entry.target.classList.contains('done')){ + + + if (entry.isIntersecting && !entry.target.classList.contains('in-viewport') ) { + entry.target.classList.add('in-viewport'); + + const xhr = new XMLHttpRequest(); + const url = entry.target.parentElement.parentElement.firstElementChild.firstElementChild.href; + xhr.open('GET', url, true); // XMLHttpRequest.open(method, url, async) + xhr.onload = function () { + + let container = document.implementation.createHTMLDocument().documentElement; + container.innerHTML = xhr.responseText; + + let publishedTimestamp = container.querySelector('meta[property="article:published_time"]').content; + + convertToLocalTimezone(publishedTimestamp); + + entry.target.textContent = publishedTimeLTZ; + entry.target.title = publishedTimeLTZtitle; + + entry.target.classList.add('done'); + + recalc(entry.target, 'YYYY-MM-DD HH:mm:ss'); + }; + xhr.send(); + } + } + }); + }; + + let observer = new IntersectionObserver(callback, options); + + let allTimestamps = document.querySelectorAll('.news-single span.date'); + allTimestamps.forEach((element) => { + observer.observe(element); + }); + + + // ---------------------------------------- + // Watch for pagination events (when new '.article' children are added inside the '.infinite_scroll' element) + const targetNode2 = document.querySelector('.infinite-scroll-component'); + const config2 = { attributes: false, childList: true, subtree: false }; + + const callback2 = function(mutationsList) { + for(const mutation of mutationsList) { + if (mutation.type === 'childList') { + let allTimestamps = document.querySelectorAll('.news-single span.date'); + allTimestamps.forEach((element) => { + observer.observe(element); + }); + } + } + }; + + const observer2 = new MutationObserver(callback2); + observer2.observe(targetNode2, config2); + // ---------------------------------------- + + + // /blabbermouth\.net/\(reviews|news)/i.test(window.location.href) + +// 2+3. ELSE IF ON CD/DVD REVIEWS OR NEWS PAGES ((convertTolocal + generate timestamp) +} else if ( /blabbermouth\.net\/(reviews|news)/i.test(window.location.href) && + !window.location.href.includes('/page/') ) { + + //--- Double-check that this iframe is on the expected domain: + if (/blabbermouth\.net/i.test(location.host)) { + console.log('Userscript is in the MAIN page.'); + + // 2019-10-17T15:32:18.000Z + + + let publishedTimestamp; + if (document.querySelector('meta[property="article:published_time"]') !== null) { + publishedTimestamp = document.querySelector('meta[property="article:published_time"]').content; + } + console.log('publishedTimestamp: ' + publishedTimestamp); + + + + if (window.location.href.includes('blabbermouth.net/news/')) { + + var publishedTimeLTZ, publishedTimeLTZtitle; + + convertToLocalTimezone(publishedTimestamp); + + let existingTimestampElement = document.querySelector('div > h1+span.date'); + + existingTimestampElement.textContent = publishedTimeLTZ; + existingTimestampElement.title = publishedTimeLTZtitle; + + recalc(existingTimestampElement, 'YYYY-MM-DD HH:mm:ss'); + + } + + + + + + + + + if (!window.location.href.includes('blabbermouth.net/news/page/')){ + + convertToLocalTimezone(publishedTimestamp); + + var commentcount = '0'; + + var datePart = !window.location.href.includes('blabbermouth.net/news/') ? `${publishedTimeLTZ}` : ''; + + var HTML = ` +${datePart} + +`; + + const refSelector = '.reviews-single-article > div > .reviews-rate-comments,div > h1+span.date'; + + if (document.querySelector(refSelector) !== null) { + document.querySelector(refSelector).insertAdjacentHTML('afterend', HTML); + document.querySelector(refSelector).title = publishedTimeLTZtitle; + + document.getElementById('commentCount').addEventListener('click', onClick, false); + + let newDateTimeElement = document.querySelector('span.date'); + recalc(newDateTimeElement, 'YYYY-MM-DD HH:mm:ss'); + } + + } + + // Wait for messages [commentcount] (from iframe) + window.addEventListener('message', function addFbCounter(e) { + // something from an unknown domain, or doesn't contain the string "Comment" let's ignore it + console.log('Received message: ' + e.data); + if (e.origin !== 'https://www.facebook.com' || e.data.indexOf(' Comment') === -1) { + return; + } + console.log('Received message: ' + e.data); + // document.querySelector('#commentCount').innerText = e.data.replace(/ Comments?/i,''); + document.querySelector('#commentCount').innerText = e.data; + window.removeEventListener('message', addFbCounter); + }, + false + ); + console.log('Waiting for Message 1, from iframe...'); + } + + +// ELSE IF IT'S ON THE FACEBOOK COMMENTS IFRAME (send fb comment count to main page) +} + +if (window.location.href.includes('facebook.com')) { + + console.log('Userscript is in the FRAMED page.'); + + const selector = '._50f7'; + // Send commentcount to MAIN page + window.parent.postMessage( + document.querySelector(selector).innerText, + 'https://blabbermouth.net/reviews/' + ); +} diff --git a/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area/README.md b/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area/README.md new file mode 100644 index 0000000..5ddf36c --- /dev/null +++ b/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area/README.md @@ -0,0 +1,36 @@ +This script applies to blabbermouth.net. + +Blabbermouth only displays timestamps (just the date) in news listings and pages. +**It doesn't display timestamps in cd/dvd reviews pages at all.** +The script generates timestamps in relative format, in all cases. + +In details: + +- in **news** and **cd/dvd reviews** pages: + + It generates timestamps *(making use of the existing `published_time` data from inside the pages, e.g. `2020-02-20T19:10:22.000Z`)* +in relative format. Also, it recalculates them every 1 minute. +_(the initial retrieved timestamps -converted to local timezone's offset- are tooltips: just hover mouse on a relative date to view)_ + + It also shows a link to the Facebook comments next to the generated timestamp, +with **the comment count from that fb iframe** 1 (i.e. `6 Comments`, not just "Comments" ). + + +- in **news** listings: + + As you scroll down each page, it retrieves the relevant target news page in the background in order to get the relevant `published_time` data from the page, and then generates timestamps (like before) in relative format. + + Since v1.2 now the script also works in paginated news pages. +  + +1 Compatibility note regarding that feature: + +- Violentmonkey: the script works in ok with VM in its default settings. +- Tampermonkey: in order to work with TM, you have to remove the `*://www.facebook.com/plugins/*` pattern from TM blacklist (it's blacklisted in TM settings by default). +- Greasemonkey: not supported. + +--- + +The script uses [moment.js](http://momentjs.com/). + +[Hosted in GitHub](https://github.com/darkred/Userscripts) diff --git a/BugMeNot/BugMeNot.user.js b/BugMeNot/BugMeNot.user.js index 9f244b7..56044fa 100644 --- a/BugMeNot/BugMeNot.user.js +++ b/BugMeNot/BugMeNot.user.js @@ -1,106 +1,39 @@ // ==UserScript== // @name BugMeNot // @namespace darkred +// @version 2017.12.15 +// @description Integrates BugMeNot into any login form (it retrieves all matching logins from bugmenot.com and autofills the login form) // @authors hosts, Matt McCarthy, darkred // @license MIT -// @description It integrates BugMeNot into any login form (it retrieves all matching logins from bugmenot.com and autofills the login form) -// @version 2017.06.09 // @include http://* // @include https://* // @exclude http://bugmenot.com/* -// @grant GM_xmlhttpRequest -// @grant GM_setValue +// @grant GM.getValue // @grant GM_getValue -// @grant GM_log +// @grant GM.setValue +// @grant GM_setValue +// @grant GM.openInTab // @grant GM_openInTab +// @grant GM.xmlHttpRequest +// @grant GM_xmlhttpRequest +// @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js // @noframes // @run-at document-idle +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== +// // @grant GM.listValues + // latest version by hosts: 01.03.09 // based on code found at http://www.oreillynet.com/pub/h/4171 // ---------------------------- // based on code by Matt McCarthy // and included here with his gracious permission +/* global GM */ -// new logins gotten from the current page (reset on every page load) -var retrievals = 0; -// millisecond delay between a field losing focus and checking to see -// if any other of our fields has focus. If this is too low, the menu -// won't work because it will get "display: none" and its onclick -// won't fire. -// var BLUR_TIMEOUT = 150; -var BLUR_TIMEOUT = 250; - -//http://www.bugmenot.com/view/orasisx.net -//phoneRegex = /(?:http://)(.*)/.*?/; -//doma= location.href.match( phoneRegex ); - -// myString = location.href; -// domainnameRE = new RegExp('(?:https?://)(.*?)/.*?', 'i'); -// domainname = myString.match(domainnameRE) -// domainname = domainname[1]; -//alert (domainname); -var myString = location.href; -var domainnameRE = new RegExp('(?:https?://)(www\.)?(.*?)/.*?', 'i'); -var domainname = myString.match(domainnameRE); -domainname = domainname[2]; - -// If the current domain name doesn't match the stored lastURL, then reset the counter -if (GM_getValue('lastURL', '').indexOf(domainname) == -1){ - var counter = 0; - GM_setValue('counter', 0); -} else { - counter = parseInt(GM_getValue('counter')); // else retrieve stored counter value -} - - -// var allInputs = null; -var bmnView = 'http://bugmenot.com/view'; -var bmnUri = bmnView + '/' + domainname; -var bmnHomeUri = 'http://bugmenot.com/'; -var DEBUG = false; -// var bmnWrappers = new Object(); - -var Style = { - menuLink: { - border: 'none', - backgroundColor: '#fff', - color: '#000', - display: 'block', - padding: '2px', - margin: '0', - // width: '12em', - width: '17em', - fontSize: '8pt', - fontWeight: 'normal', - textDecoration: 'none' - }, - menuLinkHover: { - backgroundColor: '#316AC5', - color: '#fff' - }, - menuLinkWrapper: { - textAlign: 'left', - padding: '1px', - margin: 0 - }, - bmnWrapper: { - display: 'none', - fontFamily: 'tahoma, verdana, arial, sans-serif', - whiteSpace: 'nowrap', - position: 'absolute', - zIndex: 1000, - padding: '2px', - border: '1px solid #ACA899', - backgroundColor: '#fff', - opacity: '0.9', - filter: 'alpha(opacity=90)' - } -}; function copyProperties(to, from) { for (var i in from) { to[i] = from[i]; @@ -117,84 +50,96 @@ function getBmnWrapper(pwFieldIndex) { function processPasswordFields() { - var allInputs = document.getElementsByTagName('input'); - //allInputslength = allInputs.length; - var bmnContainer = document.createElement('div'); - bmnContainer.id = 'reify-bugmenot-container'; - var bodyEl = document.getElementsByTagName('body')[0]; - if (!bodyEl) return; - for (var i = 0; i < allInputs.length; i++) { - var pwField = allInputs[i]; - //GM_log (allInputs[i].type.toLowerCase()); - if (!(pwField.type && pwField.type.toLowerCase() == 'password')) { - continue; - } - var previousTextFieldInd = getPreviousTextField(i, allInputs); - if (previousTextFieldInd == - 1) { - if (DEBUG) { - GM_log('Couldn\'t find text field before password input ' + - i + '.'); + (async function() { + var allInputs = document.getElementsByTagName('input'); + //allInputslength = allInputs.length; + var bmnContainer = document.createElement('div'); + bmnContainer.id = 'reify-bugmenot-container'; + var bodyEl = document.getElementsByTagName('body')[0]; + if (!bodyEl) return; + for (var i = 0; i < allInputs.length; i++) { + var pwField = allInputs[i]; + // console.log(allInputs[i].type.toLowerCase()); + if (!(pwField.type && pwField.type.toLowerCase() == 'password')) { continue; } - } - var usernameField = allInputs[previousTextFieldInd]; - usernameField.blur(); // Workaround for when the Username textbox has focus by default on page load - usernameField.setAttribute('usernameInputIndex', previousTextFieldInd); - usernameField.setAttribute('passwordInputIndex', i); - Utility.addEventHandler(usernameField, 'focus', usernameField_onfocus); - Utility.addEventHandler(usernameField, 'blur', usernameField_onblur); - Utility.addEventHandler(pwField, 'focus', pwField_onfocus); - Utility.addEventHandler(pwField, 'blur', pwField_onblur); - pwField.setAttribute('usernameInputIndex', previousTextFieldInd); - pwField.setAttribute('passwordInputIndex', i); - - // var getLoginLink = menuLink(bmnUri, 'Get login from BugMeNot', 'Get a login from BugMeNot', getLoginLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); - if (counter == 0) { - var myprompt = 'Get login from BugMeNot' + ' (' + (counter + 1) + '/-)'; - var myprompt2 = 'Get a login from BugMeNot'; - } else { - var total = JSON.parse(GM_getValue('allUsernames')).length; - if (counter < total) { - myprompt = 'Try next login from BugMeNot' + ' (' + (counter + 1) + '/' + total + ')'; - myprompt2 = 'Try next login'; + var previousTextFieldInd = getPreviousTextField(i, allInputs); + if (previousTextFieldInd == - 1) { + if (DEBUG) { + console.log('Couldn\'t find text field before password input ' + i + '.'); + continue; + } + } + var usernameField = allInputs[previousTextFieldInd]; + usernameField.blur(); // Workaround for when the Username textbox has focus by default on page load + usernameField.setAttribute('usernameInputIndex', previousTextFieldInd); + usernameField.setAttribute('passwordInputIndex', i); + Utility.addEventHandler(usernameField, 'focus', usernameField_onfocus); + Utility.addEventHandler(usernameField, 'blur', usernameField_onblur); + Utility.addEventHandler(pwField, 'focus', pwField_onfocus); + Utility.addEventHandler(pwField, 'blur', pwField_onblur); + pwField.setAttribute('usernameInputIndex', previousTextFieldInd); + pwField.setAttribute('passwordInputIndex', i); + + // var getLoginLink = menuLink(bmnUri, 'Get login from BugMeNot', 'Get a login from BugMeNot', getLoginLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); + + // console.log('counter2: ' + counter); + if (counter === 0) { + // counter = 0; + var myprompt = 'Get login from BugMeNot' + ' (' + (counter + 1) + '/-)'; + var myprompt2 = 'Get a login from BugMeNot'; } else { - myprompt = 'No other logins'; - myprompt2 = 'No other logins available'; + // var total = JSON.parse(await GM.getValue('allUsernames')).length + var total; + total = JSON.parse(await GM.getValue('allUsernames')).length ; + // console.log('total: ' + total + ' | ' + ' counter: ' + counter); + // console.log(counter <= total); + + + if (counter + 1 <= total) { + myprompt = 'Try next login from BugMeNot' + ' (' + (counter + 1) + '/' + total + ')'; + myprompt2 = 'Try next login'; + } else { + myprompt = 'No other logins'; + myprompt2 = 'No other logins available'; + } + // })(); + } - } - var getLoginLink = menuLink(bmnUri, myprompt, myprompt2, getLoginLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); - var getLoginLinkWrapper = menuEntry(getLoginLink, Style.menuLinkWrapper); + var getLoginLink = menuLink(bmnUri, myprompt, myprompt2, getLoginLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); + var getLoginLinkWrapper = menuEntry(getLoginLink, Style.menuLinkWrapper); - if (counter > 0) { - var resetCounterLink = menuLink('', 'Reset login attempt counter', 'Resets the login attempt counter (reloads the page)', resetCounterLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); - var resetCounterLinkWrapper = menuEntry(resetCounterLink, Style.menuLinkWrapper); - } + if (counter > 0) { + var resetCounterLink = menuLink('', 'Reset login attempt counter', 'Resets the login attempt counter (reloads the page)', resetCounterLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); + var resetCounterLinkWrapper = menuEntry(resetCounterLink, Style.menuLinkWrapper); + } - var fullFormLink = menuLink(bmnUri, 'More options', 'See more options for getting logins from BugMeNot.com ' + '(opens a new window)', openMenuLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); - var fullFormLinkWrapper = menuEntry(fullFormLink, Style.menuLinkWrapper); + var fullFormLink = menuLink(bmnUri, 'More options', 'See more options for getting logins from BugMeNot.com ' + '(opens a new window)', openMenuLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); + var fullFormLinkWrapper = menuEntry(fullFormLink, Style.menuLinkWrapper); - var visitBmnLink = menuLink(bmnHomeUri, 'Visit BugMeNot', 'Go to the BugMeNot home page (opens a new window)', openMenuLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); - var visitBmnLinkWrapper = menuEntry(visitBmnLink, Style.menuLinkWrapper); + var visitBmnLink = menuLink(bmnHomeUri, 'Visit BugMeNot', 'Go to the BugMeNot home page (opens a new window)', openMenuLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); + var visitBmnLinkWrapper = menuEntry(visitBmnLink, Style.menuLinkWrapper); - var bmnWrapper = document.createElement('div'); - bmnWrapper.id = 'reify-bugmenot-bmnWrapper' + i; - bmnWrapper.className = 'reify-bugmenot-bmnWrapper'; + var bmnWrapper = document.createElement('div'); + bmnWrapper.id = 'reify-bugmenot-bmnWrapper' + i; + bmnWrapper.className = 'reify-bugmenot-bmnWrapper'; - bmnWrapper.appendChild(getLoginLinkWrapper); - if (counter > 0) { - bmnWrapper.appendChild(resetCounterLinkWrapper); - } - bmnWrapper.appendChild(fullFormLinkWrapper); - bmnWrapper.appendChild(visitBmnLinkWrapper); + bmnWrapper.appendChild(getLoginLinkWrapper); + if (counter > 0) { + bmnWrapper.appendChild(resetCounterLinkWrapper); + } + bmnWrapper.appendChild(fullFormLinkWrapper); + bmnWrapper.appendChild(visitBmnLinkWrapper); - copyProperties(bmnWrapper.style, Style.bmnWrapper); - bmnContainer.appendChild(bmnWrapper); - } - if (bmnContainer.hasChildNodes()) { - bodyEl.appendChild(bmnContainer); - } + copyProperties(bmnWrapper.style, Style.bmnWrapper); + bmnContainer.appendChild(bmnWrapper); + } + if (bmnContainer.hasChildNodes()) { + bodyEl.appendChild(bmnContainer); + } + })(); } function menuEntry(linkEl, styleObj) { @@ -243,8 +188,8 @@ function getLoginLink_onclick(event) { } function openMenuLink_onclick(event) { - if (typeof GM_openInTab != 'undefined') { - GM_openInTab(this.href); + if (typeof GM.openInTab !== 'undefined') { + GM.openInTab(this.href); } else { window.open(this.href); } @@ -256,7 +201,10 @@ function openMenuLink_onclick(event) { } function resetCounterLink_onclick(){ - GM_setValue('counter', 0); + (async function() { + GM.setValue('counter', 0); + })(); + window.location.reload(); } @@ -300,11 +248,11 @@ function pwField_onblur(event) { function hideIfNoFocus(usernameField, pwField) { return (function () { var bUsernameFocus = usernameField.getAttribute('hasFocus'); - if (typeof bUsernameFocus == 'string') { + if (typeof bUsernameFocus === 'string') { bUsernameFocus = (bUsernameFocus && bUsernameFocus != 'false'); } var bPasswordFocus = pwField.getAttribute('hasFocus'); - if (typeof bPasswordFocus == 'string') { + if (typeof bPasswordFocus === 'string') { bPasswordFocus = (bPasswordFocus && bPasswordFocus != 'false'); } if ((!bUsernameFocus) && (!bPasswordFocus)) { @@ -319,7 +267,7 @@ function showHideBmnWrapper(usernameField, pwField, show) { bmnWrapper.style.display = 'block'; positionBmnWrapper(bmnWrapper, usernameField, pwField); } else { - //GM_log('hiding bugmenot wrapper'); + // console.log('hiding bugmenot wrapper'); bmnWrapper.style.display = 'none'; // Menu links may not get onmouseout event, so they get // stuck with the hover style unless we do this. @@ -333,12 +281,12 @@ function showHideBmnWrapper(usernameField, pwField, show) { function positionBmnWrapper(bmnWrapper, usernameField, pwField) { var pwLeft = Utility.elementLeft(pwField); if (pwLeft + pwField.offsetWidth + bmnWrapper.offsetWidth + - Utility.scrollLeft() + 10 < Utility.viewportWidth()) { +Utility.scrollLeft() + 10 < Utility.viewportWidth()) { bmnWrapper.style.left = (pwLeft + pwField.offsetWidth + 2) + 'px'; bmnWrapper.style.top = Utility.elementTop(pwField) + 'px'; } else { bmnWrapper.style.left = (Utility.elementLeft(usernameField) - - bmnWrapper.offsetWidth - 2) + 'px'; + bmnWrapper.offsetWidth - 2) + 'px'; bmnWrapper.style.top = Utility.elementTop(usernameField) + 'px'; } } @@ -349,97 +297,118 @@ function positionBmnWrapper(bmnWrapper, usernameField, pwField) { // for pages other than the current one. function getLogin(uri, usernameInputIndex, passwordInputIndex) { - var allInputs = document.getElementsByTagName('input'); - var usernameField = allInputs[usernameInputIndex]; - var pwField = allInputs[passwordInputIndex]; - waitOrRestoreFields(usernameField, pwField, false); - // var hostUri = location.hostname; - var firstAttempt = retrievals == 0; - var submitData = 'submit=This+login+didn%27t+work&num=' + retrievals + - '&site=' + encodeURI(location.hostname); - - if (counter == 0){ - GM_xmlhttpRequest({ - method: firstAttempt ? 'get' : 'post', - headers: firstAttempt ? null : - { - 'Content-type': 'application/x-www-form-urlencoded' + (async function() { + + var allInputs = document.getElementsByTagName('input'); + var usernameField = allInputs[usernameInputIndex]; + var pwField = allInputs[passwordInputIndex]; + waitOrRestoreFields(usernameField, pwField, false); + // var hostUri = location.hostname; + var firstAttempt = retrievals == 0; + var submitData = 'submit=This+login+didn%27t+work&num=' + retrievals + +'&site=' + encodeURI(location.hostname); + + + + // console.log(uri + ' ' + usernameInputIndex + ' ' + passwordInputIndex); + if (counter === 0){ + console.log('( retrieving logins from bugmenot.com via XHR... )'); + // (async function(){ + GM.xmlHttpRequest({ + method: firstAttempt ? 'get' : 'post', + headers: firstAttempt ? null : + { + 'Content-type': 'application/x-www-form-urlencoded' + }, + data: firstAttempt ? null : submitData, + url: firstAttempt ? uri : bmnView, + // synchronous: true, + onload: function (responseDetails) { + if (responseDetails.status == 200) { + waitOrRestoreFields(usernameField, pwField, true); + // decoded = decodeit(responseDetails.responseText); + var decoded = responseDetails.responseText; + var doc = textToXml(decoded); + if (!(doc && doc.documentElement)) { + return Errors.say(Errors.malformedResponse); + } + + + + var allUsernames = doc.documentElement.querySelectorAll('dd:nth-child(2) > kbd'); + var allPasswords = doc.documentElement.querySelectorAll('dd:nth-child(4) > kbd'); + var allUsernamesArray = []; + var allPasswordsArray = []; + for (var i = 0; i < allUsernames.length; i++) { + allUsernamesArray.push(allUsernames[i].innerHTML); + allPasswordsArray.push(allPasswords[i].innerHTML); + } + + var temp = ''; + for (var j = 0; j < allUsernamesArray.length; j++){ + temp += (j + 1) + ': ' + allUsernamesArray[j] + ', ' + allPasswordsArray[j] + '\n'; + } + console.log('Found logins (' + allUsernamesArray.length + '):\n' + temp); + + (async function() { + GM.setValue('allUsernames', JSON.stringify(allUsernamesArray)); + GM.setValue('allPasswords', JSON.stringify(allPasswordsArray)); + })(); + // + // var accountInfo = doc.documentElement.getElementsByTagName('td') [0]; + var accountInfo = doc.documentElement.getElementsByTagName('kbd') [0]; + if (!(accountInfo)) { + return Errors.say(Errors.noLoginAvailable); + } + usernameField.value = accountInfo.childNodes[0].nodeValue; + // var pwsField = doc.documentElement.getElementsByTagName('td') [1]; + var pwsField = doc.documentElement.getElementsByTagName('kbd') [1]; + pwField.value = pwsField.childNodes[0].nodeValue; + retrievals++; + } else { + return Errors.say(Errors.xmlHttpFailure); + } }, - data: firstAttempt ? null : submitData, - url: firstAttempt ? uri : bmnView, - onload: function (responseDetails) { - if (responseDetails.status == 200) { + onerror: function (responseDetails) { waitOrRestoreFields(usernameField, pwField, true); - // decoded = decodeit(responseDetails.responseText); - var decoded = responseDetails.responseText; - var doc = textToXml(decoded); - if (!(doc && doc.documentElement)) { - return Errors.say(Errors.malformedResponse); - } + Errors.say(Errors.xmlHttpFailure); + } + }); + // })(); + } else { - var allUsernames = doc.documentElement.querySelectorAll('dd:nth-child(2) > kbd'); - var allPasswords = doc.documentElement.querySelectorAll('dd:nth-child(4) > kbd'); - var allUsernamesArray = []; - var allPasswordsArray = []; - for (var i = 0; i < allUsernames.length; i++) { - allUsernamesArray.push(allUsernames[i].innerHTML); - allPasswordsArray.push(allPasswords[i].innerHTML); - } + var retrievedUsernames = []; + var retrievedPasswords = []; + // (async function() { + retrievedUsernames = JSON.parse(await GM.getValue('allUsernames')); + retrievedPasswords = JSON.parse(await GM.getValue('allPasswords')); + var temp = ''; + for (var j = 0; j < retrievedUsernames.length; j++){ + temp += (j + 1) + ': ' + retrievedUsernames[j] + ', ' + retrievedPasswords[j] + '\n'; + } + console.log('Found logins (' + retrievedUsernames.length + '):\n' + temp); + usernameField.value = retrievedUsernames[counter]; + pwField.value = retrievedPasswords[counter]; + // })(); - var temp = ''; - for (var j = 0; j < allUsernamesArray.length; j++){ - temp += (j + 1) + ': ' + allUsernamesArray[j] + ', ' + allPasswordsArray[j] + '\n'; - } - console.log('Found logins (' + allUsernamesArray.length + '):\n' + temp); - GM_setValue('allUsernames', JSON.stringify(allUsernamesArray)); - GM_setValue('allPasswords', JSON.stringify(allPasswordsArray)); + } - // var accountInfo = doc.documentElement.getElementsByTagName('td') [0]; - var accountInfo = doc.documentElement.getElementsByTagName('kbd') [0]; - if (!(accountInfo)) { - return Errors.say(Errors.noLoginAvailable); - } - usernameField.value = accountInfo.childNodes[0].nodeValue; - // var pwsField = doc.documentElement.getElementsByTagName('td') [1]; - var pwsField = doc.documentElement.getElementsByTagName('kbd') [1]; - pwField.value = pwsField.childNodes[0].nodeValue; - retrievals++; - } else { - return Errors.say(Errors.xmlHttpFailure); - } - }, - onerror: function (responseDetails) { - waitOrRestoreFields(usernameField, pwField, true); - Errors.say(Errors.xmlHttpFailure); - } - }); - } else { - var retrievedUsernames = []; - var retrievedPasswords = []; - retrievedUsernames = JSON.parse(GM_getValue('allUsernames')); - retrievedPasswords = JSON.parse(GM_getValue('allPasswords')); - - var temp = ''; - for (var j = 0; j < retrievedUsernames.length; j++){ - temp += (j + 1) + ': ' + retrievedUsernames[j] + ', ' + retrievedPasswords[j] + '\n'; - } - console.log('Found logins (' + retrievedUsernames.length + '):\n' + temp); + counter = parseInt(counter); + counter++; // (after all is done..) + GM.setValue('counter', counter); // .. store just increased counter and.. + GM.setValue('lastURL', String(window.location)); // .. store current location as lastURL + - usernameField.value = retrievedUsernames[counter]; - pwField.value = retrievedPasswords[counter]; - } - counter = parseInt(counter); - counter++; // (after all is done..) - GM_setValue('counter', counter); // .. store just increased counter and.. - GM_setValue('lastURL', String(window.location)); // .. store current location as lastURL + })(); + } function waitOrRestoreFields(usernameField, pwField, restore) { @@ -516,10 +485,10 @@ function decodeit(codedtext) { function textToXml(t) { try { - if (typeof DOMParser != undefined) { + if (typeof DOMParser !== 'undefined') { //t = toString(t); - // var dp = new DOMParser( ); - // return dp.parseFromString(t, "text/xml"); + // var dp = new DOMParser( ); + // return dp.parseFromString(t, "text/xml"); var parser = new DOMParser(); //var t = t.replace(/<\?xml.*?\?>/g, ""); // strip tag //t = "\n" + t + ""; @@ -538,16 +507,106 @@ function textToXml(t) { } } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +var Style = { + menuLink: { + border: 'none', + backgroundColor: '#fff', + color: '#000', + display: 'block', + padding: '2px', + margin: '0', + // width: '12em', + width: '17em', + fontSize: '8pt', + fontWeight: 'normal', + textDecoration: 'none' + }, + menuLinkHover: { + backgroundColor: '#316AC5', + color: '#fff' + }, + menuLinkWrapper: { + textAlign: 'left', + padding: '1px', + margin: 0 + }, + bmnWrapper: { + display: 'none', + fontFamily: 'tahoma, verdana, arial, sans-serif', + whiteSpace: 'nowrap', + position: 'absolute', + zIndex: 1000, + padding: '2px', + border: '1px solid #ACA899', + backgroundColor: '#fff', + opacity: '0.9', + filter: 'alpha(opacity=90)' + } +}; + + + + + + + + + + + + + + + + + + var Errors = { noLoginAvailable: 'Sorry, but BugMeNot.com had no login available ' + - 'for this site.\nIf you\'re feeling helpful, you can click "More ' + - 'options" to provide a login for future visitors.', +'for this site.\nIf you\'re feeling helpful, you can click "More ' + +'options" to provide a login for future visitors.', malformedResponse: 'Sorry, but I couldn\'t understand the response ' + - 'from BugMeNot.com.\nThe service might be unavailable.', +'from BugMeNot.com.\nThe service might be unavailable.', siteBlocked: 'Sorry, but I couldn\'t understand the response ' + - 'from BugMeNot.com.\nThe service might be unavailable.', +'from BugMeNot.com.\nThe service might be unavailable.', xmlHttpFailure: 'There was an error in contacting BugMeNot.com.\n' + - 'The server may be unavailable or having internal errors.', +'The server may be unavailable or having internal errors.', say: function (msg) { alert(msg); return false; @@ -601,6 +660,86 @@ var Utility = { } }; -main(); + + + + + + + + + + + + + + + + + + + + + + + +// new logins gotten from the current page (reset on every page load) +var retrievals = 0; +// millisecond delay between a field losing focus and checking to see +// if any other of our fields has focus. If this is too low, the menu +// won't work because it will get "display: none" and its onclick +// won't fire. +// var BLUR_TIMEOUT = 150; +const BLUR_TIMEOUT = 250; + +//http://www.bugmenot.com/view/orasisx.net +//phoneRegex = /(?:http://)(.*)/.*?/; +//doma= location.href.match( phoneRegex ); + +// myString = location.href; +// domainnameRE = new RegExp('(?:https?://)(.*?)/.*?', 'i'); +// domainname = myString.match(domainnameRE) +// domainname = domainname[1]; +//alert (domainname); +const myString = location.href; +const domainnameRE = new RegExp('(?:https?://)(www\\.)?(.*?)/.*?', 'i'); +const domainname = myString.match(domainnameRE)[2]; + +// var allInputs = null; +const bmnView = 'http://bugmenot.com/view'; +const bmnUri = bmnView + '/' + domainname; +const bmnHomeUri = 'http://bugmenot.com/'; +const DEBUG = false; +// var bmnWrappers = new Object(); + + +var counter ; + + +// If the current domain name doesn't match the stored lastURL, then reset the counter +var lastURL; +(async function() { + lastURL = await GM.getValue('lastURL', ''); + // console.log('lastURL: ' + lastURL); + if (lastURL.indexOf(domainname) === -1){ + counter = 0; + GM.setValue('counter', 0); + // console.log('CASE 0'); + } else { + counter = parseInt(await GM.getValue('counter', 0)); + // console.log('counter1: ' + counter); + } + // console.log(await GM.listValues()); + + main(); +})(); + + + + +// main(); + + + // to do // http://www.bugmenot.com/view/thecavernforum.com Site Blocked diff --git a/Bugzilla_-_reveal_the_Depends,_Blocks,_See_Also_and_Duplicates_bug_titles/Bugzilla_-_reveal_the_Depends,_Blocks,_See_Also_and_Duplicates_bug_titles.user.js b/Bugzilla_-_reveal_the_Depends,_Blocks,_See_Also_and_Duplicates_bug_titles/Bugzilla_-_reveal_the_Depends,_Blocks,_See_Also_and_Duplicates_bug_titles.user.js index f4b4581..c5e082f 100644 --- a/Bugzilla_-_reveal_the_Depends,_Blocks,_See_Also_and_Duplicates_bug_titles/Bugzilla_-_reveal_the_Depends,_Blocks,_See_Also_and_Duplicates_bug_titles.user.js +++ b/Bugzilla_-_reveal_the_Depends,_Blocks,_See_Also_and_Duplicates_bug_titles/Bugzilla_-_reveal_the_Depends,_Blocks,_See_Also_and_Duplicates_bug_titles.user.js @@ -1,13 +1,15 @@ -// ==UserScript== +// ==UserScript== // @name Bugzilla - reveal the Depends, Blocks, See Also and Duplicates bug titles // @namespace darkred -// @license MIT +// @version 2017.16.11 // @description Reveal the Depends, Blocks, See Also and Duplicates bug titles in bugzilla.mozilla.org via keyboard shortcuts +// @license MIT // @include https://bugzilla.mozilla.org/show_bug.cgi?id=* -// @version 2017.3.7 // @grant none +// @require https://code.jquery.com/jquery-3.2.1.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/jquery-scrollTo/2.1.2/jquery.scrollTo.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/keypress/2.1.3/keypress.min.js +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== /* eslint-disable no-unused-vars */ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..0553819 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,39 @@ +# Contributing to my Userscripts repo + +* [How To Report Issues, Or Make Requests](#how-to-report-issues-or-make-requests) +* [Contributing Code](#contributing-code) + * [Installation](#installation) + * [Pull Requests](#pull-requests) + + +## How to Report Issues, Or Make Requests. + +When reporting problems: +- Start the issue title having the related script title in parenthesis. +- Be as specific as possible, I need to know where to look. +- State name and version of your browser and script manager. +- Provide a web address example where I can see the problem for myself. A domain name is not enough. +- Provide a screenshot if necessary. + +When making feature requests: +- Be as specific as possible, don't make me have to guess what you want. + + +## Contributing Code + +### Installation: + +Just use a script manager, such as Tampermonkey, Greasemonkey or Violentmonkey + +### Pull Requests: + +You are welcome to open pull requests as long as you: +* Follow the style that is already being used in the code, see the repo's [`.eslintrc` rules](https://github.com/darkred/Userscripts/blob/master/.eslintrc) +* When naming variables: + * Use names that properly describe the contents of the variable. + * Use camel casing as needed. +* Use comments if necesary. +* Use semicolons. +* Use single quotes. +* Use tabs, not 4 spaces indentation. +* Try not to have too long lines. diff --git a/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial.user.js b/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial.user.js index 3bfa5b5..8b4bfec 100644 --- a/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial.user.js +++ b/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial.user.js @@ -1,22 +1,38 @@ // ==UserScript== // @name Firefox for desktop - list fixed bugs in Mercurial // @namespace darkred -// @authors darkred, johnp +// @version 4.2.9 +// @date 2020.8.25 +// @description Lists fixed bugs related to Firefox for desktop in Mozilla Mercurial pushlogs +// @author darkred, johnp // @license MIT -// @description It generates a list of fixed bugs related to Firefox for desktop in Mozilla Mercurial pushlogs -// @version 4.2.2 -// @date 2017.3.25 // @include /^https?:\/\/hg\.mozilla\.org.*pushloghtml.*/ -// @grant GM_addStyle +// @grant GM_getResourceURL // @grant GM_getResourceText +// @grant GM_addStyle +// @grant GM_xmlhttpRequest // @grant GM_setClipboard // @require https://code.jquery.com/jquery-2.1.4.min.js // @require https://code.jquery.com/ui/1.11.4/jquery-ui.min.js -// @resource customCSS http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css +// @resource jqUI_CSS http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css +// @resource IconSet1 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png +// @resource IconSet2 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_glass_85_dfeffc_1x400.png +// @resource IconSet3 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +// @resource IconSet4 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +// @resource IconSet5 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-icons_217bc0_256x240.png +// @resource IconSet6 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-icons_469bdd_256x240.png +// @resource IconSet7 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-icons_6da8d5_256x240.png +// Thanks a lot to: johnp (your contribution is most appreciated!), wOxxOm and Brock Adams. +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== -/* global $:false */ -/* eslint-disable no-console */ + + + + + + +/* eslint-disable no-console, complexity */ var silent = false; @@ -24,27 +40,50 @@ var debug = false; time('MozillaMercurial'); -String.prototype.escapeHTML = function() { - var tagsToReplace = { - '&': '&', - '<': '<', - '>': '>' - }; - return this.replace(/[&<>]/g, function(tag) { - return tagsToReplace[tag] || tag; - }); -}; + + +// the dialog will only be opened after all these promises have finished +var requests = []; + // theme for the jQuery dialog -// $("head").append( -// '' -// ); -var newCSS = GM_getResourceText ('customCSS'); -GM_addStyle (newCSS); +if (typeof(GM_getResourceText) !== 'undefined' && typeof(GM_addStyle) !== 'undefined') { + + + // https://stackoverflow.com/a/11532646/ , i.e. https://stackoverflow.com/a/11532646/3231411 (By Brock Adams) + // Themes files URLs: https://cdnjs.com/libraries/jqueryui + let iconSet1 = GM_getResourceURL ('IconSet1'); + let iconSet2 = GM_getResourceURL ('IconSet2'); + let iconSet3 = GM_getResourceURL ('IconSet3'); + let iconSet4 = GM_getResourceURL ('IconSet4'); + let iconSet5 = GM_getResourceURL ('IconSet5'); + let iconSet6 = GM_getResourceURL ('IconSet6'); + let iconSet7 = GM_getResourceURL ('IconSet7'); + let jqUI_CssSrc = GM_getResourceText ('jqUI_CSS'); + // jqUI_CssSrc = jqUI_CssSrc.replace (/url\(images\/ui\-bg_.*00\.png\)/g, ''); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_glass_75_d0e5f5_1x400\.png/g, iconSet1); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_glass_85_dfeffc_1x400\.png/g, iconSet2); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_gloss-wave_55_5c9ccc_500x100\.png/g, iconSet3); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_inset-hard_100_fcfdfd_1x100\.png/g, iconSet4); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-icons_217bc0_256x240\.png/g, iconSet5); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-icons_469bdd_256x240\.png/g, iconSet6); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-icons_6da8d5_256x240\.png/g, iconSet7); + + GM_addStyle (jqUI_CssSrc); + + +} else { // e.g. Greasemonkey: https://github.com/greasemonkey/greasemonkey/issues/2548 + // load jquery-ui css dynamically to bypass Content-Security-Policy restrictions + let loadCss = $.get('https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css', function(css) { + $('head').append(''); + }); + requests.push(loadCss); // prevent a possible race condition where the dialog is opened before the css is loaded +} + + + + var regex = /^https:\/\/bugzilla\.mozilla\.org\/show_bug\.cgi\?id=(.*)$/; @@ -69,151 +108,176 @@ var numBugs = bugIds.length; var counter = 0; var rest_url = base_url + bugIds.join(); -time('MozillaMercurial-REST'); -$.getJSON(rest_url, function(data) { - timeEnd('MozillaMercurial-REST'); - data.bugs.sort(function(a, b) { - return (a.product + ': ' + a.component + ': ' + a.summary) > (b.product + ': ' + b.component + ': ' + b.summary); - }); - $.each(data.bugs, function(index) { - let bug = data.bugs[index]; - // process bug (let "shorthands" just to simplify things during refactoring) - let status = bug.status; - if (bug.resolution !== '') {status += ' ' + bug.resolution;} - let product = bug.product; - let component = bug.component; - let platform = bug.platform; - if (platform == 'Unspecified') { - platform = 'Uns'; - } - if (bug.op_sys !== '' && bug.op_sys !== 'Unspecified') { - platform += '/' + bug.op_sys; - } - let whiteboard = bug.whiteboard === '' ? '[]' : bug.whiteboard; - // todo: message??? - - log('----------------------------------------------------------------------------------------------------------------------------------'); - log((index + 1) + '/' + numBugs); // Progression counter - log('BugNo: ' + bug.id + '\nTitle: ' + bug.summary + '\nStatus: ' + status + '\nProduct: ' + product + '\nComponent: ' + component + '\nPlatform: ' + platform + '\nWhiteboard: ' + whiteboard); - - if (isRelevant(bug)) { - // add html code for this bug - bugsComplete.push('#' - + bug.id - + '' - + ' (' + product + ': ' + component + ') ' - + bug.summary.escapeHTML() + ' [' + platform + ']' + whiteboard.escapeHTML() + '
'); - } - counter++; // increase counter - // remove processed bug from bugIds - let i = bugIds.indexOf(bug.id); - if (i !== -1) {bugIds[i] = null;} - }); - log('==============\nReceived ' + counter + ' of ' + numBugs + ' bugs.'); - - // process remaining bugs one-by-one - var requests = []; - time('MozillaMercurial-missing'); - $.each(bugIds, function(index) { - let id = bugIds[index]; - if (id !== null) { - time('Requesting missing bug ' + id); - let promise = $.getJSON('https://bugzilla.mozilla.org/rest/bug/' + id, - function(json) { - // I've not end up here yet, so cry if we do - console.error('Request succeeded unexpectedly!'); - console.error('Please submit this information to the script authors:'); - timeEnd('Requesting missing bug ' + id); - console.log(json); - let bug = json.bugs[0]; - console.log(bug); - // TODO: display as much information as possible -}); - // Actually, we usually get an error - promise.error(function(req, status, error) { - timeEnd('Requesting missing bug ' + id); - if (error == 'Authorization Required') { - log('Bug ' + id + ' requires authorization!'); - log('https://bugzilla.mozilla.org/show_bug.cgi?id=' + id + ' requires authorization!'); - let text = ' requires authorization!
'; - - bugsComplete.push('#' - + id + '' + text); - } else { - console.error('Unexpected error encountered (Bug' + id + '): ' + status + ' ' + error); - } - }); - requests.push(promise); - } + + +String.prototype.escapeHTML = function() { + var tagsToReplace = { + '&': '&', + '<': '<', + '>': '>' + }; + + return this.replace(/[&<>]/g, function(tag) { + return tagsToReplace[tag] || tag; }); - // wait for all requests to be settled, then join them together - // Source: https://stackoverflow.com/questions/19177087/deferred-how-to-detect-when-every-promise-has-been-executed - $.when.apply($, $.map(requests, function(p) { - return p.then(null, function() { - return $.Deferred().resolveWith(this, arguments); +}; + + + +time('MozillaMercurial-REST'); + + +GM_xmlhttpRequest({ + method: 'GET', + url: rest_url, + onload: function(response) { + + var data = JSON.parse(response.responseText); + + timeEnd('MozillaMercurial-REST'); + data.bugs.sort(function(a, b) { + return (a.product + ': ' + a.component + ': ' + a.summary).localeCompare(b.product + ': ' + b.component + ': ' + b.summary); // had to change '>' with '.localeCompare' because the sorting wasn't applied when run with Tampermonkey + }); + $.each(data.bugs, function(index) { + let bug = data.bugs[index]; + // process bug (let "shorthands" just to simplify things during refactoring) + let status = bug.status; + if (bug.resolution !== '') {status += ' ' + bug.resolution;} + let product = bug.product; + let component = bug.component; + let platform = bug.platform; + if (platform === 'Unspecified') { + platform = 'Uns'; + } + if (bug.op_sys !== '' && bug.op_sys !== 'Unspecified') { + platform += '/' + bug.op_sys; + } + let whiteboard = bug.whiteboard === '' ? '[]' : bug.whiteboard; + // todo: message??? + + log('----------------------------------------------------------------------------------------------------------------------------------'); + log((index + 1) + '/' + numBugs); // Progression counter + log('BugNo: ' + bug.id + '\nTitle: ' + bug.summary + '\nStatus: ' + status + '\nProduct: ' + product + '\nComponent: ' + component + '\nPlatform: ' + platform + '\nWhiteboard: ' + whiteboard); + + if (isRelevant(bug)) { + // add html code for this bug + // console.log(typeof bug.summary) + bugsComplete.push('#' + + 'https://bugzilla.mozilla.org/show_bug.cgi?id='+ bug.id + '"' + ' title="' + bug.id + ' - ' + bug.summary + '">#' + + bug.id + + '' + + ' (' + product + ': ' + component + ') ' + + bug.summary.escapeHTML() + ' [' + platform + ']' + whiteboard.escapeHTML() + '
'); + } + counter++; // increase counter + // remove processed bug from bugIds + let i = bugIds.indexOf(bug.id); + if (i !== -1) {bugIds[i] = null;} }); - })).always(function() { - timeEnd('MozillaMercurial-missing'); - // Variable that will contain all values of the bugsComplete array, and will be displayed in the 'dialog' below - var docu = ''; - docu = bugsComplete.join(''); - - var div = document.createElement('div'); - $('div.page_footer').append(div); - div.id = 'dialog'; - // GM_setClipboard (docu); // This line stores the list content HTML code to clipboard (aimed for MozillaZine daily "The Official Win32 xxxxxxx builds" maintainer) - docu = '
' + docu + '
'; - div.innerHTML = docu; - $('#dialog').hide(); - - $(function() { - $('#dialog').dialog({ - title: 'List of recently fixed bugs of Firefox for Desktop (' + bugsComplete.length + ')', - width: '1350px' + log('==============\nReceived ' + counter + ' of ' + numBugs + ' bugs.'); + + // process remaining bugs one-by-one + time('MozillaMercurial-missing'); + $.each(bugIds, function(index) { + let id = bugIds[index]; + if (id !== null) { + time('Requesting missing bug ' + id); + let promise = $.getJSON('https://bugzilla.mozilla.org/rest/bug/' + id, + function(json) { + // I've not end up here yet, so cry if we do + console.error('Request for bug ' + id + ' succeeded unexpectedly!'); + timeEnd('Requesting missing bug ' + id); + console.error(json); + }); + // Actually, we usually get an '401 Authorization Required' error + promise.fail(function(req, status, error) { + timeEnd('Requesting missing bug ' + id); + if (error === 'Authorization Required') { + log('Bug ' + id + ' requires authorization!'); + log('https://bugzilla.mozilla.org/show_bug.cgi?id=' + id + ' requires authorization!'); + let text = ' requires authorization!
'; + + bugsComplete.push('#' + + id + '' + text); + } else { + console.error('Unexpected error encountered (Bug' + id + '): ' + status + ' ' + error); + } + }); + requests.push(promise); + } + }); + // wait for all requests to be settled, then join them together + // Source: https://stackoverflow.com/questions/19177087/deferred-how-to-detect-when-every-promise-has-been-executed + $.when.apply($, $.map(requests, function(p) { + return p.then(null, function() { + return $.Deferred().resolveWith(this, arguments); }); + })).always(function() { + timeEnd('MozillaMercurial-missing'); + // Variable that will contain all values of the bugsComplete array, and will be displayed in the 'dialog' below + var docu = ''; + docu = bugsComplete.join(''); + + var div = document.createElement('div'); + $('div.page_footer').append(div); + div.id = 'dialog'; + // GM_setClipboard (docu); // This line stores the list content HTML code to clipboard (aimed for MozillaZine daily "The Official Win32 xxxxxxx builds" maintainer) + // docu = '
' + docu + '
'; + docu = '
' + docu + '
'; + div.innerHTML = docu; + $('#dialog').hide(); + + $(function() { + $('#dialog').dialog({ + title: 'List of recently fixed bugs of Firefox for Desktop (' + bugsComplete.length + ')', + width: '1350px' + }); + }); + + log('ALL IS DONE'); + timeEnd('MozillaMercurial'); }); - log('ALL IS DONE'); - timeEnd('MozillaMercurial'); - }); + } }); function isRelevant(bug) { if (!bug.id) {return false;} - if (bug.status && bug.status != 'RESOLVED' && bug.status != 'VERIFIED') { + if (bug.status && bug.status !== 'RESOLVED' && bug.status !== 'VERIFIED') { log(' IRRELEVANT because of it\'s Status --> ' + bug.status); return false; } - if (bug.component && bug.product && bug.component == 'Build Config' && (bug.product == 'Toolkit' || bug.product == 'Firefox')) { + if (bug.component && bug.product && bug.component === 'Build Config' && (bug.product === 'Toolkit' || bug.product === 'Firefox')) { log(' IRRELEVANT because of it\'s Product --> ' + bug.product + 'having component --> ' + bug.component); return false; } - if (bug.product && bug.product != 'Add-on SDK' && - bug.product != 'Cloud Services' && - bug.product != 'Core' && - bug.product != 'Firefox' && - bug.product != 'Hello (Loop)' && - bug.product != 'Toolkit') { + if ( bug.product && + bug.product !== 'Add-on SDK' && + bug.product !== 'Cloud Services' && + bug.product !== 'Core' && + bug.product !== 'Firefox' && + bug.product !== 'Hello (Loop)' && + bug.product !== 'Toolkit') { log(' IRRELEVANT because of it\'s Product --> ' + bug.product); return false; } - if (bug.component && bug.component == 'AutoConfig' || - bug.component == 'Build Config' || - bug.component == 'DMD' || - bug.component == 'Embedding: GRE Core' || - bug.component == 'Embedding: Mac' || - bug.component == 'Embedding: MFC Embed' || - bug.component == 'Embedding: Packaging' || - bug.component == 'Hardware Abstraction Layer' || - bug.component == 'mach' || - bug.component == 'Nanojit' || - bug.component == 'QuickLaunch' || - bug.component == 'Widget: Gonk') { + if (bug.component && bug.component === 'AutoConfig'|| + bug.component === 'Build Config' || + bug.component === 'DMD' || + bug.component === 'Embedding: GRE Core' || + bug.component === 'Embedding: Mac' || + bug.component === 'Embedding: MFC Embed' || + bug.component === 'Embedding: Packaging' || + bug.component === 'Hardware Abstraction Layer' || + bug.component === 'mach' || + bug.component === 'Nanojit' || + bug.component === 'QuickLaunch' || + bug.component === 'Widget: Gonk') { log(' IRRELEVANT because of it\'s Component --> ' + bug.component); return false; @@ -257,7 +321,7 @@ $('#dialog').dialog({ minHeight: 200, zIndex: 3666 }) - .dialog('widget').draggable('option', 'containment', 'none'); + .dialog('widget').draggable('option', 'containment', 'none'); //-- Fix crazy bug in FF! ... $('#dialog').parent().css({ diff --git a/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial_as_sortable_table/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial_as_sortable_table.user.js b/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial_as_sortable_table/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial_as_sortable_table.user.js index 8c233ce..3c616ce 100644 --- a/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial_as_sortable_table/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial_as_sortable_table.user.js +++ b/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial_as_sortable_table/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial_as_sortable_table.user.js @@ -1,14 +1,16 @@ // ==UserScript== // @name Firefox for desktop - list fixed bugs in Mercurial as sortable table // @namespace darkred -// @authors darkred, johnp +// @version 5.5.9.2 +// @date 2020.8.25 +// @description Lists (as sortable table) fixed bugs related to Firefox for desktop in Mozilla Mercurial pushlogs +// @author darkred, johnp // @license MIT -// @description It generates a sortable table list of fixed bugs related to Firefox for desktop in Mozilla Mercurial pushlogs -// @version 5.5.4 -// @date 2017.3.25 // @include /^https?:\/\/hg\.mozilla\.org.*pushloghtml.*/ -// @grant GM_addStyle +// @grant GM_getResourceURL // @grant GM_getResourceText +// @grant GM_addStyle +// @grant GM_xmlhttpRequest // @require https://code.jquery.com/jquery-2.1.4.min.js // @require https://code.jquery.com/ui/1.11.4/jquery-ui.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.24.3/js/jquery.tablesorter.min.js @@ -17,92 +19,139 @@ // @require https://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.6/jstz.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/keypress/2.1.3/keypress.min.js -// @resource customCSS http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css +// @resource jqUI_CSS http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css +// @resource IconSet1 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png +// @resource IconSet2 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_glass_85_dfeffc_1x400.png +// @resource IconSet3 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +// @resource IconSet4 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +// @resource IconSet5 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-icons_217bc0_256x240.png +// @resource IconSet6 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-icons_469bdd_256x240.png +// @resource IconSet7 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-icons_6da8d5_256x240.png +// Thanks a lot to: johnp (your contribution is most appreciated!), wOxxOm and Brock Adams. +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== -/* global $:false, jstz, moment */ +/* eslint-disable no-console, complexity */ +/* global jstz, moment */ + + +var silent = false; +var debug = false; + +time('MozillaMercurial'); + + + // CSS rules in order to show 'up' and 'down' arrows in each table header -var stylesheet = ' \ -'; +var stylesheet = ` +`; $('head').append(stylesheet); -// in order to highlight hovered table row -GM_addStyle('#tbl tr:hover{ background:#F6E6C6 !important;}'); +var stylesheet2 = +``; +$('head').append(stylesheet2); -// in order the bug list to have width 1500px -GM_addStyle('.ui-dialog {width:1200px !important;}'); +// the dialog will only be opened after all these promises have finished +var requests = []; + + +// theme for the jQuery dialog +if (typeof(GM_getResourceText) !== 'undefined' && typeof(GM_addStyle) !== 'undefined') { + + + // https://stackoverflow.com/a/11532646/ , i.e. https://stackoverflow.com/a/11532646/3231411 (By Brock Adams) + // Themes files URLs: https://cdnjs.com/libraries/jqueryui + let iconSet1 = GM_getResourceURL ('IconSet1'); + let iconSet2 = GM_getResourceURL ('IconSet2'); + let iconSet3 = GM_getResourceURL ('IconSet3'); + let iconSet4 = GM_getResourceURL ('IconSet4'); + let iconSet5 = GM_getResourceURL ('IconSet5'); + let iconSet6 = GM_getResourceURL ('IconSet6'); + let iconSet7 = GM_getResourceURL ('IconSet7'); + let jqUI_CssSrc = GM_getResourceText ('jqUI_CSS'); + // jqUI_CssSrc = jqUI_CssSrc.replace (/url\(images\/ui\-bg_.*00\.png\)/g, ''); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_glass_75_d0e5f5_1x400\.png/g, iconSet1); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_glass_85_dfeffc_1x400\.png/g, iconSet2); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_gloss-wave_55_5c9ccc_500x100\.png/g, iconSet3); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_inset-hard_100_fcfdfd_1x100\.png/g, iconSet4); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-icons_217bc0_256x240\.png/g, iconSet5); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-icons_469bdd_256x240\.png/g, iconSet6); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-icons_6da8d5_256x240\.png/g, iconSet7); + + GM_addStyle (jqUI_CssSrc); + + +} else { // e.g. Greasemonkey: https://github.com/greasemonkey/greasemonkey/issues/2548 + // load jquery-ui css dynamically to bypass Content-Security-Policy restrictions + let loadCss = $.get('https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css', function(css) { + $('head').append(''); + }); + requests.push(loadCss); // prevent a possible race condition where the dialog is opened before the css is loaded +} + -var silent = false; -var debug = false; -time('MozillaMercurial'); -String.prototype.escapeHTML = function() { - var tagsToReplace = { - '&': '&', - '<': '<', - '>': '>' - }; - return this.replace(/[&<>]/g, function(tag) { - return tagsToReplace[tag] || tag; - }); -}; // theme for the jQuery dialog // $('head').append( @@ -111,8 +160,14 @@ String.prototype.escapeHTML = function() { // // 'href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.min.css" ' + // uncomment this line (and comment line 89) in order to change theme // 'rel="stylesheet" type="text/css">' // ); -var newCSS = GM_getResourceText ('customCSS'); -GM_addStyle (newCSS); +// var newCSS = GM_getResourceText ('customCSS'); +// GM_addStyle (newCSS); +$.ajax({ + url:'http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css', + success:function(data){ + $('').appendTo('head').html(data); + } +}); var regex = /^https:\/\/bugzilla\.mozilla\.org\/show_bug\.cgi\?id=(.*)$/; var base_url = 'https://bugzilla.mozilla.org/rest/bug?include_fields=id,summary,status,resolution,product,component,op_sys,platform,whiteboard,last_change_time&id='; @@ -136,66 +191,82 @@ var numBugs = bugIds.length; var counter = 0; var rest_url = base_url + bugIds.join(); -time('MozillaMercurial-REST'); +String.prototype.escapeHTML = function() { + var tagsToReplace = { + '&': '&', + '<': '<', + '>': '>' + }; + return this.replace(/[&<>]/g, function(tag) { + return tagsToReplace[tag] || tag; + }); +}; +time('MozillaMercurial-REST'); -$.getJSON(rest_url, function(data) { - timeEnd('MozillaMercurial-REST'); - $.each(data.bugs, function(index) { - let bug = data.bugs[index]; - // process bug (let "shorthands" just to simplify things during refactoring) - let status = bug.status; - if (bug.resolution !== '') {status += ' ' + bug.resolution;} - let product = bug.product; - let component = bug.component; - let platform = bug.platform; - if (platform == 'Unspecified') { - platform = 'Uns'; - } - if (bug.op_sys !== '' && bug.op_sys !== 'Unspecified') { - platform += '/' + bug.op_sys; - } - let whiteboard = bug.whiteboard === '' ? '[]' : bug.whiteboard; - // todo: message??? +GM_xmlhttpRequest({ + method: 'GET', + url: rest_url, + onload: function(response) { + var data = JSON.parse(response.responseText); + timeEnd('MozillaMercurial-REST'); + $.each(data.bugs, function(index) { + let bug = data.bugs[index]; + // process bug (let "shorthands" just to simplify things during refactoring) + let status = bug.status; + if (bug.resolution !== '') {status += ' ' + bug.resolution;} + let product = bug.product; + let component = bug.component; + let platform = bug.platform; + if (platform === 'Unspecified') { + platform = 'Uns'; + } + if (bug.op_sys !== '' && bug.op_sys !== 'Unspecified') { + platform += '/' + bug.op_sys; + } + let whiteboard = bug.whiteboard === '' ? '[]' : bug.whiteboard; + // todo: message??? - // 2015-11-09T14:40:41Z - function toRelativeTime(time, zone) { - var format2 = ('YYYY-MM-DD HH:mm:ss Z'); - return moment(time, format2).tz(zone).fromNow(); - } - function getLocalTimezone(){ - var tz = jstz.determine(); // Determines the time zone of the browser client - return tz.name(); // Returns the name of the time zone eg "Europe/Berlin" - } + // 2015-11-09T14:40:41Z + function toRelativeTime(time, zone) { + var format2 = ('YYYY-MM-DD HH:mm:ss Z'); + return moment(time, format2).tz(zone).fromNow(); + } + + + function getLocalTimezone(){ + var tz = jstz.determine(); // Determines the time zone of the browser client + return tz.name(); // Returns the name of the time zone eg "Europe/Berlin" + } - var changetime; - var localTimezone = getLocalTimezone(); + var changetime; + var localTimezone = getLocalTimezone(); - if (bug.last_change_time !== '') { - var temp = toRelativeTime(bug.last_change_time, localTimezone); - if (temp.match(/(an?)\ .*/)) { - changetime = temp.replace(/an?/, 1); + if (bug.last_change_time !== '') { + var temp = toRelativeTime(bug.last_change_time, localTimezone); + if (temp.match(/(an?) .*/)) { + changetime = temp.replace(/an?/, 1); + } else { + changetime = temp; + } + // changetime } else { - changetime = temp; + changetime = ''; } - // changetime - } else { - changetime = ''; - } @@ -204,174 +275,171 @@ $.getJSON(rest_url, function(data) { - log('----------------------------------------------------------------------------------------------------------------------------------'); - log((index + 1) + '/' + numBugs); // Progression counter - log('BugNo: ' + bug.id + '\nTitle: ' + bug.summary + '\nStatus: ' + status + '\nProduct: ' + product + '\nComponent: ' + component + '\nPlatform: ' + platform + '\nWhiteboard: ' + whiteboard); + log('----------------------------------------------------------------------------------------------------------------------------------'); + log((index + 1) + '/' + numBugs); // Progression counter + log('BugNo: ' + bug.id + '\nTitle: ' + bug.summary + '\nStatus: ' + status + '\nProduct: ' + product + '\nComponent: ' + component + '\nPlatform: ' + platform + '\nWhiteboard: ' + whiteboard); - if (isRelevant(bug)) { - // add html code for this bug - bugsComplete.push('' - + bug.id - + '' - + '(' + product + ': ' + component + ') ' - + ''+bug.summary.escapeHTML() + ' [' + platform + ']' + whiteboard.escapeHTML() + '' - + '' + changetime + ''); // previously had a
at the end; - } - counter++; // increase counter - // remove processed bug from bugIds - let i = bugIds.indexOf(bug.id); - if (i !== -1) {bugIds[i] = null;} - }); - log('==============\nReceived ' + counter + ' of ' + numBugs + ' bugs.'); - - - - - // process remaining bugs one-by-one - var requests = []; - time('MozillaMercurial-missing'); - $.each(bugIds, function(index) { - let id = bugIds[index]; - if (id !== null) { - time('Requesting missing bug ' + id); - let promise = $.getJSON('https://bugzilla.mozilla.org/rest/bug/' + id, - function(json) { - // I've not end up here yet, so cry if we do - console.error('Request succeeded unexpectedly!'); - console.error('Please submit this information to the script authors:'); - timeEnd('Requesting missing bug ' + id); - console.log(json); - let bug = json.bugs[0]; - console.log(bug); - // TODO: display as much information as possible -}); - // Actually, we usually get an error - promise.error(function(req, status, error) { - timeEnd('Requesting missing bug ' + id); - if (error == 'Authorization Required') { - // log("Bug " + id + " requires authorization!"); - log('https://bugzilla.mozilla.org/show_bug.cgi?id=' + id + ' requires authorization!'); - let text = ' requires authorization!
'; - - bugsComplete.push('#' - + id + '' + text); - } else { - console.error('Unexpected error encountered (Bug' + id + '): ' + status + ' ' + error); - } - }); - requests.push(promise); - } - }); - // wait for all requests to be settled, then join them together - // Source: https://stackoverflow.com/questions/19177087/deferred-how-to-detect-when-every-promise-has-been-executed - $.when.apply($, $.map(requests, function(p) { - return p.then(null, function() { - return $.Deferred().resolveWith(this, arguments); + if (isRelevant(bug)) { + // add html code for this bug + bugsComplete.push('' + + 'https://bugzilla.mozilla.org/show_bug.cgi?id='+ bug.id + '"' + ' title="' + bug.id + ' - ' + bug.summary + '">#' + + bug.id + + '' + + '(' + product + ': ' + component + ') ' + + ''+bug.summary.escapeHTML() + ' [' + platform + ']' + whiteboard.escapeHTML() + '' + + '' + changetime + ''); // previously had a
at the end; + } + counter++; // increase counter + // remove processed bug from bugIds + let i = bugIds.indexOf(bug.id); + if (i !== -1) {bugIds[i] = null;} }); - })).always(function() { - timeEnd('MozillaMercurial-missing'); - // Variable that will contain all values of the bugsComplete array, and will be displayed in the 'dialog' below - var docu = ''; - docu = bugsComplete.join(''); - docu = ' ' + - '' + - '' + - '' + // '' + - '' + - '' + // '' + - '' + - '' + docu + '
BugNoProduct/ComponentProduct/Component_________SummaryModified
Modified__
'; - - - - - var div = document.createElement('div'); - $('div.page_footer').append(div); - div.id = 'dialog'; - docu = '
' + docu + '
'; - div.innerHTML = docu; - $('#dialog').hide(); - - $(function() { - $('#dialog').dialog({ - title: 'List of fixed bugs of Firefox for desktop (' + bugsComplete.length + ')', - width: '1350px' - }); + log('==============\nReceived ' + counter + ' of ' + numBugs + ' bugs.'); + + + + + // process remaining bugs one-by-one + time('MozillaMercurial-missing'); + $.each(bugIds, function(index) { + let id = bugIds[index]; + if (id !== null) { + time('Requesting missing bug ' + id); + let promise = $.getJSON('https://bugzilla.mozilla.org/rest/bug/' + id, + function(json) { + // I've not end up here yet, so cry if we do + console.error('Request for bug ' + id + ' succeeded unexpectedly!'); + timeEnd('Requesting missing bug ' + id); + console.error(json); + }); + // Actually, we usually get an '401 Authorization Required' error + promise.fail(function(req, status, error) { + timeEnd('Requesting missing bug ' + id); + if (error === 'Authorization Required') { + // log("Bug " + id + " requires authorization!"); + log('https://bugzilla.mozilla.org/show_bug.cgi?id=' + id + ' requires authorization!'); + let text = ' requires authorization!
'; + + bugsComplete.push('#' + + id + '' + text); + } else { + console.error('Unexpected error encountered (Bug' + id + '): ' + status + ' ' + error); + } + }); + requests.push(promise); + } }); + // wait for all requests to be settled, then join them together + // Source: https://stackoverflow.com/questions/19177087/deferred-how-to-detect-when-every-promise-has-been-executed + $.when.apply($, $.map(requests, function(p) { + return p.then(null, function() { + return $.Deferred().resolveWith(this, arguments); + }); + })).always(function() { + timeEnd('MozillaMercurial-missing'); + // Variable that will contain all values of the bugsComplete array, and will be displayed in the 'dialog' below + var docu = ''; + docu = bugsComplete.join(''); + docu = ' ' + + '' + + '' + + '' + // '' + + '' + + '' + // '' + + '' + + '' + docu + '
BugNoProduct/ComponentProduct/Component_________SummaryModified
Modified__
'; + + + + + var div = document.createElement('div'); + $('div.page_footer').append(div); + div.id = 'dialog'; + docu = '
' + docu + '
'; + div.innerHTML = docu; + $('#dialog').hide(); + + $(function() { + $('#dialog').dialog({ + title: 'List of fixed bugs of Firefox for desktop (' + bugsComplete.length + ')', + width: '1350px' + }); + }); -// THE CUSTOM PARSER MUST BE PUT BEFORE '$('#tbl').tablesorter ( {'' or else it wont work !!!! -// add parser through the tablesorter addParser method (for the "Last modified" column) - $.tablesorter.addParser({ - // set a unique id - id: 'dates', - is: function(s) { - return false; // return false so this parser is not auto detected - }, - format: function(s) { - // format your data for normalization - if (s !== ''){ - var number1, number2; + // THE CUSTOM PARSER MUST BE PUT BEFORE '$('#tbl').tablesorter ( {'' or else it wont work !!!! + // add parser through the tablesorter addParser method (for the "Last modified" column) + $.tablesorter.addParser({ + // set a unique id + id: 'dates', + is: function(s) { + return false; // return false so this parser is not auto detected + }, + format: function(s) { + // format your data for normalization + if (s !== ''){ + var number1, number2; - // format your data for normalization - number1 = Number((/(.{1,2})\ .*/).exec(s)[1]); + // format your data for normalization + number1 = Number((/(.{1,2}) .*/).exec(s)[1]); - if (s.match(/A few seconds ago/)) { number2 = 0;} - else if (s.match(/(.*)seconds?.*/)) { number2 = 1;} - else if (s.match(/(.*)minutes?.*/)) {number2 = 60;} - else if (s.match(/(.*)hours?.*/)) { number2 = 3600;} - else if (s.match(/(.*)days?.*/)) { number2 = 86400;} - else if (s.match(/(.*)months?.*/)) { number2 = 30 * 86400;} - else if (s.match(/(.*)years?.*/)) {number2 = 365 * 30 * 86400;} - return number1 * number2; + if (s.match(/A few seconds ago/)) { number2 = 0;} + else if (s.match(/(.*)seconds?.*/)) { number2 = 1;} + else if (s.match(/(.*)minutes?.*/)) {number2 = 60;} + else if (s.match(/(.*)hours?.*/)) { number2 = 3600;} + else if (s.match(/(.*)days?.*/)) { number2 = 86400;} + else if (s.match(/(.*)months?.*/)) { number2 = 30 * 86400;} + else if (s.match(/(.*)years?.*/)) {number2 = 365 * 30 * 86400;} + return number1 * number2; - } - }, - // set type, either numeric or text - type: 'numeric' - }); + } + }, + // set type, either numeric or text + type: 'numeric' + }); -// make table sortable - $('#tbl').tablesorter({ - cssAsc: 'up', - cssDesc: 'down', - sortList: [[3, 0],[1, 0],[2, 0]], // in order the table to be sorted by default by column 3 'Modified', then by column 1 'Product/Component' and then by column 2 'Summary' - headers: {3: {sorter: 'dates'}}, - initialized: function() { - var mytable = document.getElementById('tbl'); - for (var i = 2, j = mytable.rows.length + 1; i < j; i++) { - if (mytable.rows[i].cells[3].innerHTML != mytable.rows[i - 1].cells[3].innerHTML) { - for (var k = 0; k < 4; k++) { - mytable.rows[i - 1].cells[k].style.borderBottom = '1px black dotted'; + // make table sortable + $('#tbl').tablesorter({ + cssAsc: 'up', + cssDesc: 'down', + sortList: [[3, 0],[1, 0],[2, 0]], // in order the table to be sorted by default by column 3 'Modified', then by column 1 'Product/Component' and then by column 2 'Summary' + headers: {3: {sorter: 'dates'}}, + initialized: function() { + var mytable = document.getElementById('tbl'); + for (let i = 2, j = mytable.rows.length + 1; i < j; i++) { + if (mytable.rows[i].cells[3].innerHTML !== mytable.rows[i - 1].cells[3].innerHTML) { + for (let k = 0; k < 4; k++) { + mytable.rows[i - 1].cells[k].style.borderBottom = '1px black dotted'; + } } } } - } - }); + }); - log('ALL IS DONE'); - timeEnd('MozillaMercurial'); + log('ALL IS DONE'); + timeEnd('MozillaMercurial'); - }); + }); + } }); @@ -380,13 +448,13 @@ var flag = 1; // bind keypress of ` so that when pressed, the separators between groups of the same timestamps to be removed, in order to sort manually var listener = new window.keypress.Listener(); listener.simple_combo('`', function() { - // console.log('You pressed `'); + // console.log('You pressed `'); if (flag === 1) { flag = 0; - // remove seperators + // remove seperators var mytable = document.getElementById('tbl'); - for (var i = 2, j = mytable.rows.length + 1; i < j; i++) { - for (var k = 0; k < 4; k++) { + for (let i = 2, j = mytable.rows.length + 1; i < j; i++) { + for (let k = 0; k < 4; k++) { mytable.rows[i - 1].cells[k].style.borderBottom = 'none'; } } @@ -395,13 +463,13 @@ listener.simple_combo('`', function() { } else { if (flag === 0) { flag = 1; - // console.log('You pressed ~'); - var sorting = [[3, 0], [1, 0], [2, 0]]; // sort by column 3 'Modified Date, then by '1 'Product/Component' and then by column 2 'Summary' + // console.log('You pressed ~'); + sorting = [[3, 0], [1, 0], [2, 0]]; // sort by column 3 'Modified Date, then by '1 'Product/Component' and then by column 2 'Summary' $('#tbl').trigger('sorton', [sorting]); - var mytable = document.getElementById('tbl'); - for (var i = 2, j = mytable.rows.length + 1; i < j; i++) { - if (mytable.rows[i].cells[3].innerHTML != mytable.rows[i - 1].cells[3].innerHTML) { - for (var k = 0; k < 4; k++) { + mytable = document.getElementById('tbl'); + for (let i = 2, j = mytable.rows.length + 1; i < j; i++) { + if (mytable.rows[i].cells[3].innerHTML !== mytable.rows[i - 1].cells[3].innerHTML) { + for (let k = 0; k < 4; k++) { mytable.rows[i - 1].cells[k].style.borderBottom = '1px black dotted'; } } @@ -417,35 +485,37 @@ listener.simple_combo('`', function() { function isRelevant(bug) { if (!bug.id) {return false;} - if (bug.status && bug.status != 'RESOLVED' && bug.status != 'VERIFIED') { + if (bug.status && bug.status !== 'RESOLVED' && bug.status !== 'VERIFIED') { log(' IRRELEVANT because of it\'s Status --> ' + bug.status); return false; } - if (bug.component && bug.product && bug.component == 'Build Config' && (bug.product == 'Toolkit' || bug.product == 'Firefox')) { + if (bug.component && bug.product && bug.component === 'Build Config' && (bug.product === 'Toolkit' || bug.product === 'Firefox')) { log(' IRRELEVANT because of it\'s Product --> ' + bug.product + 'having component --> ' + bug.component); return false; } - if (bug.product && bug.product != 'Add-on SDK' && - bug.product != 'Cloud Services' && - bug.product != 'Core' && - bug.product != 'Firefox' && - bug.product != 'Hello (Loop)' && - bug.product != 'Toolkit') { + if (bug.product && + bug.product !== 'Add-on SDK' && + bug.product !== 'Cloud Services' && + bug.product !== 'Core' && + bug.product !== 'Firefox' && + bug.product !== 'Hello (Loop)' && + bug.product !== 'Toolkit') { log(' IRRELEVANT because of it\'s Product --> ' + bug.product); return false; } - if (bug.component && bug.component == 'AutoConfig' || - bug.component == 'Build Config' || - bug.component == 'DMD' || - bug.component == 'Embedding: GRE Core' || - bug.component == 'Embedding: Mac' || - bug.component == 'Embedding: MFC Embed' || - bug.component == 'Embedding: Packaging' || - bug.component == 'Hardware Abstraction Layer' || - bug.component == 'mach' || - bug.component == 'Nanojit' || - bug.component == 'QuickLaunch' || - bug.component == 'Widget: Gonk') { + if (bug.component && + bug.component === 'AutoConfig' || + bug.component === 'Build Config' || + bug.component === 'DMD' || + bug.component === 'Embedding: GRE Core' || + bug.component === 'Embedding: Mac' || + bug.component === 'Embedding: MFC Embed' || + bug.component === 'Embedding: Packaging' || + bug.component === 'Hardware Abstraction Layer' || + bug.component === 'mach' || + bug.component === 'Nanojit' || + bug.component === 'QuickLaunch' || + bug.component === 'Widget: Gonk') { log(' IRRELEVANT because of it\'s Component --> ' + bug.component); return false; } @@ -475,7 +545,7 @@ function timeEnd(str) { } } -// $(function() { + $('#dialog').dialog({ modal: false, title: 'Draggable, sizeable dialog', @@ -485,10 +555,9 @@ $('#dialog').dialog({ of: document, collision: 'none' }, - // width: 1500, // not working + // width: 1500, // not working zIndex: 3666 -}) - .dialog('widget').draggable('option', 'containment', 'none'); +}).dialog('widget').draggable('option', 'containment', 'none'); //-- Fix crazy bug in FF! ... $('#dialog').parent().css({ diff --git a/Firefox_for_desktop_-_list_modified_bugs_in_Mercurial_as_sortable_table/Firefox_for_desktop_-_list_modified_bugs_in_Mercurial_as_sortable_table.user.js b/Firefox_for_desktop_-_list_modified_bugs_in_Mercurial_as_sortable_table/Firefox_for_desktop_-_list_modified_bugs_in_Mercurial_as_sortable_table.user.js index 7952841..f66838a 100644 --- a/Firefox_for_desktop_-_list_modified_bugs_in_Mercurial_as_sortable_table/Firefox_for_desktop_-_list_modified_bugs_in_Mercurial_as_sortable_table.user.js +++ b/Firefox_for_desktop_-_list_modified_bugs_in_Mercurial_as_sortable_table/Firefox_for_desktop_-_list_modified_bugs_in_Mercurial_as_sortable_table.user.js @@ -1,14 +1,16 @@ // ==UserScript== // @name Firefox for desktop - list modified bugs in Mercurial as sortable table // @namespace darkred -// @authors darkred, johnp +// @version 5.5.9.2 +// @date 2020.8.25 +// @description Lists (as sortable table) bugs related to Firefox for desktop for which patches have landed in Mozilla Mercurial pushlogs +// @author darkred, johnp // @license MIT -// @description It generates a sortable table list of bugs related to Firefox for desktop for which patches have landed in Mozilla Mercurial pushlogs -// @version 5.5.4 -// @date 2017.3.25 // @include /^https?:\/\/hg\.mozilla\.org.*pushloghtml.*/ -// @grant GM_addStyle +// @grant GM_getResourceURL // @grant GM_getResourceText +// @grant GM_addStyle +// @grant GM_xmlhttpRequest // @require https://code.jquery.com/jquery-2.1.4.min.js // @require https://code.jquery.com/ui/1.11.4/jquery-ui.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.24.3/js/jquery.tablesorter.min.js @@ -17,91 +19,127 @@ // @require https://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.6/jstz.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/keypress/2.1.3/keypress.min.js -// @resource customCSS http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css +// @resource jqUI_CSS http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css +// @resource IconSet1 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png +// @resource IconSet2 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_glass_85_dfeffc_1x400.png +// @resource IconSet3 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +// @resource IconSet4 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +// @resource IconSet5 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-icons_217bc0_256x240.png +// @resource IconSet6 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-icons_469bdd_256x240.png +// @resource IconSet7 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-icons_6da8d5_256x240.png +// Thanks a lot to: johnp (your contribution is most appreciated!), wOxxOm and Brock Adams. +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== +/* eslint-disable no-console, complexity */ +/* global jstz, moment */ + + +var silent = false; +var debug = false; + +time('MozillaMercurial'); + + + // CSS rules in order to show 'up' and 'down' arrows in each table header -var stylesheet = ' \ -'; +var stylesheet = ` +`; $('head').append(stylesheet); +var stylesheet2 = +``; +$('head').append(stylesheet2); -// in order the bug list to have width 1500px // it was 1500 and then 1600 -GM_addStyle('.ui-dialog {\ - width:1700px !important;\ -}'); +// the dialog will only be opened after all these promises have finished +var requests = []; -var silent = false; -var debug = false; +// theme for the jQuery dialog +if (typeof(GM_getResourceText) !== 'undefined' && typeof(GM_addStyle) !== 'undefined') { + + + // https://stackoverflow.com/a/11532646/ , i.e. https://stackoverflow.com/a/11532646/3231411 (By Brock Adams) + // Themes files URLs: https://cdnjs.com/libraries/jqueryui + let iconSet1 = GM_getResourceURL ('IconSet1'); + let iconSet2 = GM_getResourceURL ('IconSet2'); + let iconSet3 = GM_getResourceURL ('IconSet3'); + let iconSet4 = GM_getResourceURL ('IconSet4'); + let iconSet5 = GM_getResourceURL ('IconSet5'); + let iconSet6 = GM_getResourceURL ('IconSet6'); + let iconSet7 = GM_getResourceURL ('IconSet7'); + let jqUI_CssSrc = GM_getResourceText ('jqUI_CSS'); + // jqUI_CssSrc = jqUI_CssSrc.replace (/url\(images\/ui\-bg_.*00\.png\)/g, ''); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_glass_75_d0e5f5_1x400\.png/g, iconSet1); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_glass_85_dfeffc_1x400\.png/g, iconSet2); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_gloss-wave_55_5c9ccc_500x100\.png/g, iconSet3); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_inset-hard_100_fcfdfd_1x100\.png/g, iconSet4); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-icons_217bc0_256x240\.png/g, iconSet5); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-icons_469bdd_256x240\.png/g, iconSet6); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-icons_6da8d5_256x240\.png/g, iconSet7); + + GM_addStyle (jqUI_CssSrc); + + +} else { // e.g. Greasemonkey: https://github.com/greasemonkey/greasemonkey/issues/2548 + // load jquery-ui css dynamically to bypass Content-Security-Policy restrictions + let loadCss = $.get('https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css', function(css) { + $('head').append(''); + }); + requests.push(loadCss); // prevent a possible race condition where the dialog is opened before the css is loaded +} -time('MozillaMercurial'); -String.prototype.escapeHTML = function() { - var tagsToReplace = { - '&': '&', - '<': '<', - '>': '>' - }; - return this.replace(/[&<>]/g, function(tag) { - return tagsToReplace[tag] || tag; - }); -}; -// theme for the jQuery dialog -// $('head').append( -// '' -// ); -var newCSS = GM_getResourceText ('customCSS'); -GM_addStyle (newCSS); var regex = /^https:\/\/bugzilla\.mozilla\.org\/show_bug\.cgi\?id=(.*)$/; @@ -126,66 +164,83 @@ var numBugs = bugIds.length; var counter = 0; var rest_url = base_url + bugIds.join(); -time('MozillaMercurial-REST'); + + +String.prototype.escapeHTML = function() { + var tagsToReplace = { + '&': '&', + '<': '<', + '>': '>' + }; + return this.replace(/[&<>]/g, function(tag) { + return tagsToReplace[tag] || tag; + }); +}; +time('MozillaMercurial-REST'); +GM_xmlhttpRequest({ + method: 'GET', + url: rest_url, + onload: function(response) { -$.getJSON(rest_url, function(data) { - timeEnd('MozillaMercurial-REST'); - $.each(data.bugs, function(index) { - let bug = data.bugs[index]; - // process bug (let "shorthands" just to simplify things during refactoring) - let status = bug.status; - if (bug.resolution !== '') {status += ' ' + bug.resolution;} - let product = bug.product; - let component = bug.component; - let platform = bug.platform; - if (platform == 'Unspecified') { - platform = 'Uns'; - } - if (bug.op_sys !== '' && bug.op_sys !== 'Unspecified') { - platform += '/' + bug.op_sys; - } - let whiteboard = bug.whiteboard === '' ? '[]' : bug.whiteboard; - // todo: message??? + var data = JSON.parse(response.responseText); + timeEnd('MozillaMercurial-REST'); + $.each(data.bugs, function(index) { + let bug = data.bugs[index]; + // process bug (let "shorthands" just to simplify things during refactoring) + let status = bug.status; + if (bug.resolution !== '') {status += ' ' + bug.resolution;} + let product = bug.product; + let component = bug.component; + let platform = bug.platform; + if (platform === 'Unspecified') { + platform = 'Uns'; + } + if (bug.op_sys !== '' && bug.op_sys !== 'Unspecified') { + platform += '/' + bug.op_sys; + } + let whiteboard = bug.whiteboard === '' ? '[]' : bug.whiteboard; + // todo: message??? - // 2015-11-09T14:40:41Z - function toRelativeTime(time, zone) { - var format2 = ('YYYY-MM-DD HH:mm:ss Z'); - return moment(time, format2).tz(zone).fromNow(); - } + // 2015-11-09T14:40:41Z + function toRelativeTime(time, zone) { + var format2 = ('YYYY-MM-DD HH:mm:ss Z'); + return moment(time, format2).tz(zone).fromNow(); + } - function getLocalTimezone(){ - var tz = jstz.determine(); // Determines the time zone of the browser client - return tz.name(); // Returns the name of the time zone eg "Europe/Berlin" - } + + function getLocalTimezone(){ + var tz = jstz.determine(); // Determines the time zone of the browser client + return tz.name(); // Returns the name of the time zone eg "Europe/Berlin" + } - var changetime; - var localTimezone = getLocalTimezone(); + var changetime; + var localTimezone = getLocalTimezone(); - if (bug.last_change_time !== '') { - var temp = toRelativeTime(bug.last_change_time, localTimezone); - if (temp.match(/(an?)\ .*/)) { - changetime = temp.replace(/an?/, 1); + if (bug.last_change_time !== '') { + var temp = toRelativeTime(bug.last_change_time, localTimezone); + if (temp.match(/(an?) .*/)) { + changetime = temp.replace(/an?/, 1); + } else { + changetime = temp; + } + // changetime } else { - changetime = temp; + changetime = ''; } - // changetime - } else { - changetime = ''; - } @@ -194,176 +249,174 @@ $.getJSON(rest_url, function(data) { - log('----------------------------------------------------------------------------------------------------------------------------------'); - log((index + 1) + '/' + numBugs); // Progression counter - log('BugNo: ' + bug.id + '\nTitle: ' + bug.summary + '\nStatus: ' + status + '\nProduct: ' + product + '\nComponent: ' + component + '\nPlatform: ' + platform + '\nWhiteboard: ' + whiteboard); + log('----------------------------------------------------------------------------------------------------------------------------------'); + log((index + 1) + '/' + numBugs); // Progression counter + log('BugNo: ' + bug.id + '\nTitle: ' + bug.summary + '\nStatus: ' + status + '\nProduct: ' + product + '\nComponent: ' + component + '\nPlatform: ' + platform + '\nWhiteboard: ' + whiteboard); - if (isRelevant(bug)) { - // add html code for this bug - bugsComplete.push('' - + bug.id - + '' - + '(' + product + ': ' + component + ') ' - + ''+bug.summary.escapeHTML() + ' [' + platform + ']' + whiteboard.escapeHTML() + '' - + '' + changetime + '' - + '' + status + ''); // previously had a
at the end; - } - counter++; // increase counter - // remove processed bug from bugIds - let i = bugIds.indexOf(bug.id); - if (i !== -1) {bugIds[i] = null;} - }); - log('==============\nReceived ' + counter + ' of ' + numBugs + ' bugs.'); - - - - - // process remaining bugs one-by-one - var requests = []; - time('MozillaMercurial-missing'); - $.each(bugIds, function(index) { - let id = bugIds[index]; - if (id !== null) { - time('Requesting missing bug ' + id); - let promise = $.getJSON('https://bugzilla.mozilla.org/rest/bug/' + id, - function(json) { - // I've not end up here yet, so cry if we do - console.error('Request succeeded unexpectedly!'); - console.error('Please submit this information to the script authors:'); - timeEnd('Requesting missing bug ' + id); - console.log(json); - let bug = json.bugs[0]; - console.log(bug); - // TODO: display as much information as possible -}); - // Actually, we usually get an error - promise.error(function(req, status, error) { - timeEnd('Requesting missing bug ' + id); - if (error == 'Authorization Required') { - // log("Bug " + id + " requires authorization!"); - log('https://bugzilla.mozilla.org/show_bug.cgi?id=' + id + ' requires authorization!'); - let text = ' requires authorization!
'; - - bugsComplete.push('#' - + id + '' + text); - } else { - console.error('Unexpected error encountered (Bug' + id + '): ' + status + ' ' + error); - } - }); - requests.push(promise); - } - }); - // wait for all requests to be settled, then join them together - // Source: https://stackoverflow.com/questions/19177087/deferred-how-to-detect-when-every-promise-has-been-executed - $.when.apply($, $.map(requests, function(p) { - return p.then(null, function() { - return $.Deferred().resolveWith(this, arguments); + if (isRelevant(bug)) { + // add html code for this bug + bugsComplete.push('' + + 'https://bugzilla.mozilla.org/show_bug.cgi?id='+ bug.id + '"' + ' title="' + bug.id + ' - ' + bug.summary + '">#' + + bug.id + + '' + + '(' + product + ': ' + component + ') ' + + ''+bug.summary.escapeHTML() + ' [' + platform + ']' + whiteboard.escapeHTML() + '' + + '' + changetime + '' + + '' + status + ''); // previously had a
at the end; + } + counter++; // increase counter + // remove processed bug from bugIds + let i = bugIds.indexOf(bug.id); + if (i !== -1) {bugIds[i] = null;} }); - })).always(function() { - timeEnd('MozillaMercurial-missing'); - // Variable that will contain all values of the bugsComplete array, and will be displayed in the 'dialog' below - var docu = ''; - docu = bugsComplete.join(''); - docu = ' ' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + docu + '
BugNoProduct/ComponentSummaryModified___Status____________
'; - - - - - var div = document.createElement('div'); - $('div.page_footer').append(div); - div.id = 'dialog'; - docu = '
' + docu + '
'; - div.innerHTML = docu; - $('#dialog').hide(); - - $(function() { - $('#dialog').dialog({ - title: 'List of modified bugs of Firefox for desktop (' + bugsComplete.length + ')', - width: '1350px' - }); + log('==============\nReceived ' + counter + ' of ' + numBugs + ' bugs.'); + + + + + // process remaining bugs one-by-one + time('MozillaMercurial-missing'); + $.each(bugIds, function(index) { + let id = bugIds[index]; + if (id !== null) { + time('Requesting missing bug ' + id); + let promise = $.getJSON('https://bugzilla.mozilla.org/rest/bug/' + id, + function(json) { + // I've not end up here yet, so cry if we do + console.error('Request for bug ' + id + ' succeeded unexpectedly!'); + timeEnd('Requesting missing bug ' + id); + console.error(json); + }); + // Actually, we usually get an '401 Authorization Required' error + promise.fail(function(req, status, error) { + timeEnd('Requesting missing bug ' + id); + if (error === 'Authorization Required') { + + // log("Bug " + id + " requires authorization!"); + log('https://bugzilla.mozilla.org/show_bug.cgi?id=' + id + ' requires authorization!'); + let text = ' requires authorization!
'; + + bugsComplete.push('#' + + id + '' + text); + } else { + console.error('Unexpected error encountered (Bug' + id + '): ' + status + ' ' + error); + } + }); + requests.push(promise); + } }); + // wait for all requests to be settled, then join them together + // Source: https://stackoverflow.com/questions/19177087/deferred-how-to-detect-when-every-promise-has-been-executed + $.when.apply($, $.map(requests, function(p) { + return p.then(null, function() { + return $.Deferred().resolveWith(this, arguments); + }); + })).always(function() { + timeEnd('MozillaMercurial-missing'); + // Variable that will contain all values of the bugsComplete array, and will be displayed in the 'dialog' below + var docu = ''; + docu = bugsComplete.join(''); + docu = '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + docu + '
BugNoProduct/ComponentSummaryModified___Status____________
'; + + + + + var div = document.createElement('div'); + $('div.page_footer').append(div); + div.id = 'dialog'; + docu = '
' + docu + '
'; + div.innerHTML = docu; + $('#dialog').hide(); + + $(function() { + $('#dialog').dialog({ + title: 'List of modified bugs of Firefox for desktop (' + bugsComplete.length + ')', + width: '1350px' + }); + }); -// THE CUSTOM PARSER MUST BE PUT BEFORE '$('#tbl').tablesorter ( {'' or else it wont work !!!! -// add parser through the tablesorter addParser method (for the "Last modified" column) - $.tablesorter.addParser({ - // set a unique id - id: 'dates', - is: function(s) { - return false; // return false so this parser is not auto detected - }, - format: function(s) { - // format your data for normalization - if (s !== ''){ - var number1, number2; + // THE CUSTOM PARSER MUST BE PUT BEFORE '$('#tbl').tablesorter ( {'' or else it wont work !!!! + // add parser through the tablesorter addParser method (for the "Last modified" column) + $.tablesorter.addParser({ + // set a unique id + id: 'dates', + is: function(s) { + return false; // return false so this parser is not auto detected + }, + format: function(s) { + // format your data for normalization + if (s !== ''){ + var number1, number2; - // format your data for normalization - number1 = Number((/(.{1,2})\ .*/).exec(s)[1]); + // format your data for normalization + number1 = Number((/(.{1,2}) .*/).exec(s)[1]); - if (s.match(/A few seconds ago/)) { number2 = 0;} - else if (s.match(/(.*)seconds?.*/)) { number2 = 1;} - else if (s.match(/(.*)minutes?.*/)) {number2 = 60;} - else if (s.match(/(.*)hours?.*/)) { number2 = 3600;} - else if (s.match(/(.*)days?.*/)) { number2 = 86400;} - else if (s.match(/(.*)months?.*/)) { number2 = 30 * 86400;} - else if (s.match(/(.*)years?.*/)) {number2 = 365 * 30 * 86400;} - return number1 * number2; + if (s.match(/A few seconds ago/)) { number2 = 0;} + else if (s.match(/(.*)seconds?.*/)) { number2 = 1;} + else if (s.match(/(.*)minutes?.*/)) {number2 = 60;} + else if (s.match(/(.*)hours?.*/)) { number2 = 3600;} + else if (s.match(/(.*)days?.*/)) { number2 = 86400;} + else if (s.match(/(.*)months?.*/)) { number2 = 30 * 86400;} + else if (s.match(/(.*)years?.*/)) {number2 = 365 * 30 * 86400;} + return number1 * number2; - } - }, - // set type, either numeric or text - type: 'numeric' - }); + } + }, + // set type, either numeric or text + type: 'numeric' + }); -// make table sortable - $('#tbl').tablesorter({ - cssAsc: 'up', - cssDesc: 'down', - sortList: [[3, 0],[1, 0],[2, 0]], // in order the table to be sorted by default by column 3 'Modified', then by column 1 'Product/Component' and then by column 2 'Summary' - headers: {3: {sorter: 'dates'}}, - initialized: function() { - var mytable = document.getElementById('tbl'); - for (var i = 2, j = mytable.rows.length + 1; i < j; i++) { - if (mytable.rows[i].cells[3].innerHTML != mytable.rows[i - 1].cells[3].innerHTML) { - for (var k = 0; k < 5; k++) { - mytable.rows[i - 1].cells[k].style.borderBottom = '1px black dotted'; + // make table sortable + $('#tbl').tablesorter({ + cssAsc: 'up', + cssDesc: 'down', + sortList: [[3, 0],[1, 0],[2, 0]], // in order the table to be sorted by default by column 3 'Modified', then by column 1 'Product/Component' and then by column 2 'Summary' + headers: {3: {sorter: 'dates'}}, + initialized: function() { + var mytable = document.getElementById('tbl'); + for (var i = 2, j = mytable.rows.length + 1; i < j; i++) { + if (mytable.rows[i].cells[3].innerHTML !== mytable.rows[i - 1].cells[3].innerHTML) { + for (var k = 0; k < 5; k++) { + mytable.rows[i - 1].cells[k].style.borderBottom = '1px black dotted'; + } } } } - } - }); + }); - log('ALL IS DONE'); - timeEnd('MozillaMercurial'); + log('ALL IS DONE'); + timeEnd('MozillaMercurial'); - }); + }); + } }); @@ -372,13 +425,13 @@ var flag = 1; // bind keypress of ` so that when pressed, the separators between groups of the same timestamps to be removed, in order to sort manually var listener = new window.keypress.Listener(); listener.simple_combo('`', function() { - // console.log('You pressed `'); + // console.log('You pressed `'); if (flag === 1) { flag = 0; - // remove seperators + // remove seperators var mytable = document.getElementById('tbl'); - for (var i = 2, j = mytable.rows.length + 1; i < j; i++) { - for (var k = 0; k < 5; k++) { + for (let i = 2, j = mytable.rows.length + 1; i < j; i++) { + for (let k = 0; k < 5; k++) { mytable.rows[i - 1].cells[k].style.borderBottom = 'none'; } } @@ -387,13 +440,13 @@ listener.simple_combo('`', function() { } else { if (flag === 0) { flag = 1; - // console.log('You pressed ~'); - var sorting = [[3, 0], [1, 0], [2, 0]]; // sort by column 3 'Modified Date, then by '1 'Product/Component' and then by column 2 'Summary' + // console.log('You pressed ~'); + sorting = [[3, 0], [1, 0], [2, 0]]; // sort by column 3 'Modified Date, then by '1 'Product/Component' and then by column 2 'Summary' $('#tbl').trigger('sorton', [sorting]); - var mytable = document.getElementById('tbl'); - for (var i = 2, j = mytable.rows.length + 1; i < j; i++) { - if (mytable.rows[i].cells[3].innerHTML != mytable.rows[i - 1].cells[3].innerHTML) { - for (var k = 0; k < 5; k++) { + mytable = document.getElementById('tbl'); + for (let i = 2, j = mytable.rows.length + 1; i < j; i++) { + if (mytable.rows[i].cells[3].innerHTML !== mytable.rows[i - 1].cells[3].innerHTML) { + for (let k = 0; k < 5; k++) { mytable.rows[i - 1].cells[k].style.borderBottom = '1px black dotted'; } } @@ -409,35 +462,37 @@ listener.simple_combo('`', function() { function isRelevant(bug) { if (!bug.id) {return false;} - // if (bug.status && bug.status != 'RESOLVED' && bug.status != 'VERIFIED') { - // log(' IRRELEVANT because of it\'s Status --> ' + bug.status); - // return false; - // } - if (bug.component && bug.product && bug.component == 'Build Config' && (bug.product == 'Toolkit' || bug.product == 'Firefox')) { + // if (bug.status && bug.status !== 'RESOLVED' && bug.status !== 'VERIFIED') { + // log(' IRRELEVANT because of it\'s Status --> ' + bug.status); + // return false; + // } + if (bug.component && bug.product && bug.component === 'Build Config' && (bug.product === 'Toolkit' || bug.product === 'Firefox')) { log(' IRRELEVANT because of it\'s Product --> ' + bug.product + 'having component --> ' + bug.component); return false; } - if (bug.product && bug.product != 'Add-on SDK' && - bug.product != 'Cloud Services' && - bug.product != 'Core' && - bug.product != 'Firefox' && - bug.product != 'Hello (Loop)' && - bug.product != 'Toolkit') { + if (bug.product && + bug.product !== 'Add-on SDK' && + bug.product !== 'Cloud Services' && + bug.product !== 'Core' && + bug.product !== 'Firefox' && + bug.product !== 'Hello (Loop)' && + bug.product !== 'Toolkit') { log(' IRRELEVANT because of it\'s Product --> ' + bug.product); return false; } - if (bug.component && bug.component == 'AutoConfig' || - bug.component == 'Build Config' || - bug.component == 'DMD' || - bug.component == 'Embedding: GRE Core' || - bug.component == 'Embedding: Mac' || - bug.component == 'Embedding: MFC Embed' || - bug.component == 'Embedding: Packaging' || - bug.component == 'Hardware Abstraction Layer' || - bug.component == 'mach' || - bug.component == 'Nanojit' || - bug.component == 'QuickLaunch' || - bug.component == 'Widget: Gonk') { + if (bug.component && + bug.component === 'AutoConfig' || + bug.component === 'Build Config' || + bug.component === 'DMD' || + bug.component === 'Embedding: GRE Core' || + bug.component === 'Embedding: Mac' || + bug.component === 'Embedding: MFC Embed' || + bug.component === 'Embedding: Packaging' || + bug.component === 'Hardware Abstraction Layer' || + bug.component === 'mach' || + bug.component === 'Nanojit' || + bug.component === 'QuickLaunch' || + bug.component === 'Widget: Gonk') { log(' IRRELEVANT because of it\'s Component --> ' + bug.component); return false; } @@ -467,7 +522,6 @@ function timeEnd(str) { } } -// $(function() { $('#dialog').dialog({ modal: false, title: 'Draggable, sizeable dialog', @@ -477,10 +531,10 @@ $('#dialog').dialog({ of: document, collision: 'none' }, - // width: 1500, // not working + // width: 1500, // not working zIndex: 3666 }) - .dialog('widget').draggable('option', 'containment', 'none'); + .dialog('widget').draggable('option', 'containment', 'none'); //-- Fix crazy bug in FF! ... $('#dialog').parent().css({ diff --git a/GitHub_Confirmations_before_submitting_issues_and_comments/GitHub_Confirmations_before_submitting_issues_and_comments.user.js b/GitHub_Confirmations_before_submitting_issues_and_comments/GitHub_Confirmations_before_submitting_issues_and_comments.user.js index effd4ad..5d7d2fc 100644 --- a/GitHub_Confirmations_before_submitting_issues_and_comments/GitHub_Confirmations_before_submitting_issues_and_comments.user.js +++ b/GitHub_Confirmations_before_submitting_issues_and_comments/GitHub_Confirmations_before_submitting_issues_and_comments.user.js @@ -1,12 +1,13 @@ -// ==UserScript== +// ==UserScript== // @name GitHub - Confirmations before submitting issues and comments // @namespace darkred +// @version 2017.4.26 +// @description Creates a confirmation popup whenever attempting to create an issue or post comment via Ctrl+Enter in GitHub // @author darkred // @license MIT -// @description Creates a confirmation popup whenever attempting to create an issue or post comment via Ctrl+Enter in GitHub -// @version 2017.4.26 // @include https://github.com/* // @grant none +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== diff --git a/GitHub_Confirmations_before_submitting_issues_and_comments/README.md b/GitHub_Confirmations_before_submitting_issues_and_comments/README.md index b7a07e9..3c78fa0 100644 --- a/GitHub_Confirmations_before_submitting_issues_and_comments/README.md +++ b/GitHub_Confirmations_before_submitting_issues_and_comments/README.md @@ -12,4 +12,5 @@ i.e. it applies in these 3 cases: - when attempting to submit a new comment (while having focus in the new comment textarea) via Ctrl+Enter
-Thanks to trespassersW for his help [here](https://greasyfork.org/en/forum/discussion/comment/25063/#Comment_25063). + +Thanks to trespassersW for his help [here](https://greasyfork.org/en/discussions/development/55889-script-for-creating-a-confirmation-popup-when-submitting-closing-an-issue-via-ctrl-enter-in-github#comment-145065). diff --git a/Google_youtube_search_link/Google_youtube_search_link.user.js b/Google_youtube_search_link/Google_youtube_search_link.user.js index b753dda..e998740 100644 --- a/Google_youtube_search_link/Google_youtube_search_link.user.js +++ b/Google_youtube_search_link/Google_youtube_search_link.user.js @@ -4,13 +4,21 @@ // @author wOxxOm, darkred // @license MIT // @description Adds a YouTube search link next to the Videos link (e.g. Web, Images, Videos, YouTube, News, Maps, Shopping, ...) -// @version 2017.6.9 +// @version 2022.5.27 // @include https://www.google.com/* // @include /https?:\/\/(www\.)?google\.(com|(?:com?\.)?\w\w)\/.*/ // @grant none // @run-at document-start +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== +const escapeHTMLPolicy = (({ trustedTypes }, policy) => + trustedTypes + ? trustedTypes.createPolicy('myEscapePolicy', policy) + : policy)(window, { + createHTML: (str) => str, +}); + process(); new MutationObserver(process).observe(document, { childList: true, subtree: true }); @@ -19,15 +27,17 @@ function process(mutations) { if (youtube) return; - var menu = document.querySelector('#hdtb-msb'); // selector for the element that contains all the links (Web, Images, Videos, News, Maps, Shopping, ...) + // Selectors for the bar element that contains all the links (Web, Images, Videos, News, Maps, Shopping, ...) + // '.ndYZfc', is for when the 'Images' tab is selected. The other, '#hdtb', is for all other cases. + var menu = document.querySelector('#hdtb, .ndYZfc'); if (!menu) return; - var menuContainer = menu.querySelector('.hdtb-imb').parentNode; + var menuContainer = menu.querySelector('#hdtb-msb, .tAcEof').parentNode; // '.tAcEof' is for when the 'Images' tab is selected. The other, '#hdtb-msb', is for all other cases. if (!youtube) { var q = '', - queryElement = document.querySelector('input[name="q"]'); // selector for the Google search input textbox + queryElement = document.querySelector('input[name="q"]'); // The google search input textbox if (queryElement) { if (queryElement.value) q = encodeURIComponent(queryElement.value); @@ -42,15 +52,65 @@ function process(mutations) { } }).observe(queryElement, { attributes: true, attributeFilter: ['value'] }); // monitor the textbox for changes (your typed criteria) } - } else if ((q = location.href.match(/^.+?(?:[#\/&?](?:q|query))=(.+?)(?:|&.+|\|.+)$/))) + } else if ((q = location.href.match(/^.+?(?:[#/&?](?:q|query))=(.+?)(?:|&.+|\|.+)$/))) q = q[1]; - var node = document.querySelector(`a[href*='tbm=vid']`); // selector for the 'Videos' link (works in any Google search page language) - var text = '
' + - 'YouTube' + - '
'; - node.parentElement.insertAdjacentHTML('afterend', text); // insert the YouTube link + // Source URL: https://upload.wikimedia.org/wikipedia/commons/c/c9/YouTube_play_buttom_dark_icon_%282013-2017%29.svg + // No change is done to its source code (the only thing applied to it is the CSS below) + var svg = ` + + + + + + + + + + `; + + var text = ''; + + const isVideosTabSelected = !!document.querySelector('.hdtb-mitem.hdtb-msel path[d^="M10 16.5l6-4.5-6-4.5"]'); + var node = isVideosTabSelected === false ? document.querySelector(`a[href*='tbm=vid']`) : document.querySelector('path[d^="M10 16.5l6-4.5-6-4.5"]').closest('span').parentNode; + + + // (when the selected/active tab is 'Images') select the 'Images' selected tab svg icon by its path[d] attribute + var imagesTabSelected = !!document.querySelector('path[d^="M14 13l"]').closest('span.rQEFy'); + if (imagesTabSelected) { + text = '' + svg + 'YouTube'; + // select the (next, non-selected/non-active) 'Videos' tab svg icon by its path[d] attribute + node = document.querySelector('path[d^="M10 16.5l6-4.5-6-4.5"]').closest('span'); + } + + const escaped = escapeHTMLPolicy.createHTML(text); + node.parentElement.insertAdjacentHTML('afterend', escaped); // insert the YouTube link + } new MutationObserver(process).observe(menuContainer, { childList: true }); } + + +function addCss(cssString) { + var head = document.getElementsByTagName('head')[0]; + var newCss = document.createElement('style'); + newCss.type = 'text/css'; + newCss.innerHTML = escapeHTMLPolicy.createHTML(cssString); + head.appendChild(newCss); +} + +addCss(` + #__YOUTUBE_SEARCH__ svg { + filter: invert(100%); + } +`); diff --git a/Google_youtube_search_link/README.md b/Google_youtube_search_link/README.md index ac822ff..09b6fe2 100644 --- a/Google_youtube_search_link/README.md +++ b/Google_youtube_search_link/README.md @@ -11,7 +11,7 @@ _It doesn't rearrange the rest links (see note)._ i.e. if you type something in google search that looks like you're searching for _images_, -the links will become: +the links will become [2] : `All | Images | Videos | YouTube | etc` If it looks like you're looking for _videos_, the links will become: @@ -29,8 +29,10 @@ And, if you type a _book_ title then the links will become:
-_Note: The initial script was offering:_ -- _either (by default) to re-arrange links so that the Images, Videos, Youtube links to always be on 2nd, 3rd, 4th places, -which was breaking the Google's default tabs order (which takes into account the kind of search criteria that you have entered) -and is removed in this fork._ -- _or to add the YouTube link after all existing links, to the right (with some spacing in between)._ +_Notes:_ +1. The initial script was offering: + - either (by default) to re-arrange links so that the Images, Videos, Youtube links to always be on 2nd, 3rd, 4th places, +_which was breaking the Google's default tabs order (which takes into account the kind of search criteria that you have entered) and is removed in this fork._ + - or to add the YouTube link after all existing links, to the right (with some spacing in between). +2. The script currently no longer works when you are in the 'Images' tab, because the selectors are changed. [TODO] +*see https://github.com/darkred/Userscripts/issues/20#issuecomment-778643921* \ No newline at end of file diff --git a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages.user.js b/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages.user.js index d2103b7..2c4fb41 100644 --- a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages.user.js +++ b/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages.user.js @@ -1,44 +1,52 @@ // ==UserScript== -// @name GreasyFork - add a 'send PM to user' button in Greasyfork profile pages -// @namespace darkred -// @license MIT -// @description It adds a 'send PM to user' button in Greasyfork profile pages -// @version 2016.11.4 -// @include https://greasyfork.org/*/users/* -// @include https://greasyfork.org/*/forum/messages/add -// @grant GM.getResourceUrl -// @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js -// @resource icon http://i.imgur.com/ZU0xS0c.jpg +// @name GreasyFork - add a 'send PM to user' button in Greasyfork profile pages +// @namespace darkred +// @version 2021.1.22 +// @description Adds a 'send PM to user' button in Greasyfork profile pages (also compatible with Citrus GFork). +// @author darkred +// @license MIT +// @include https://greasyfork.org/*/users/* +// @include https://greasyfork.org/*/forum/messages/add +// @include https://sleazyfork.org/*/users/* +// @include https://sleazyfork.org/*/forum/messages/add +// @run-at document-idle +// @grant none +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== -if (window.location.href.indexOf('users') > -1 // if current URL is a profile page - && document.querySelector('.user-profile-link > a:nth-child(1)').innerHTML != document.querySelector('section.text-content:nth-child(1) > h2:nth-child(1)').innerHTML) { // ... and this profile page is not yours - - var profileName = document.querySelector('section.text-content:nth-child(1) > h2:nth-child(1)'); - sessionStorage.setItem('recipient', profileName); // store in sessionStorage the profileName (it will be inserted in the 'Recipients' textbox ) -after you press the button- - - var referenceNode = document.querySelector('section.text-content:nth-child(1) > h2:nth-child(1)'); - var a = document.createElement('input'); - - a.style.padding = '0px 12px'; - a.setAttribute('type', 'image'); - a.id = 'pmButton'; - a.title = 'Send PM to ' + profileName; - (async function() { - a.src = await GM.getResourceUrl('icon'); - })(); - referenceNode.appendChild(a); - - - document.getElementById('pmButton').addEventListener('click', function() { - window.open('https://greasyfork.org/en/forum/messages/add', '_self'); - }); - +var yourProfileNameElement = document.querySelector('.user-profile-link > a:nth-child(1)'); +if (yourProfileNameElement !== null) { + var yourProfileName = yourProfileNameElement.innerHTML; + var yourProfileURL = yourProfileNameElement.href; + // https://greasyfork.org/en/users/2160-darkred + // https://greasyfork.org/en/users/2160-darkred/conversations/new + // https://greasyfork.org/en/users/2160-darkred/conversations/new?other_user=JasonBarnabe + var yourCreateNewConversationURL = yourProfileURL + '/conversations/new' ; } +var targetProfileNameElement = document.querySelector('.text-content > h2'); +if (targetProfileNameElement !== null) { + // var targetProfileName = targetProfileNameElement.firstChild.textContent.replace('\'s Profile', ''); // the .firstChild is for mods profile pages, e.g. https://greasyfork.org/en/users/1-jasonbarnabe , https://greasyfork.org/en/users/2159-woxxom + var targetProfileName = targetProfileNameElement.firstChild.textContent; // the .firstChild is for mods profile pages, e.g. https://greasyfork.org/en/users/1-jasonbarnabe , https://greasyfork.org/en/users/2159-woxxom +} -if (window.location.href.indexOf('messages') > -1) { // if current URL is a 'send PM' page - document.querySelector('#Form_To').innerHTML = sessionStorage.getItem('recipient'); // .. then insert the stored value of 'recipient' in the 'Recipients' textbox +if (window.location.href.indexOf('users') !== -1 // if current URL is a profile page + && yourProfileName !== targetProfileName // ... and this profile page is not yours + && window.location.href !== yourProfileURL + '/conversations' // ... and this profile page is not your conversations page + && window.location.href.indexOf('conversations/new') === -1) { // .. and this page is not a 'Create a new conversation' page + sessionStorage.setItem('recipient', targetProfileName); // store in sessionStorage the profileName (it will be inserted in the 'Recipients' textbox ) -after you press the button- + var a = document.createElement('a'); + targetProfileNameElement.appendChild(a); + a.style.padding = '0px 12px'; + var img = document.createElement('img'); + a.appendChild(img); + // http://i.imgur.com/ZU0xS0c.jpg + img.setAttribute('src', 'data:image/jpeg;base64,/9j/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCAATABcDAREAAhEBAxEB/8QAFwABAQEBAAAAAAAAAAAAAAAABwAICf/EACgQAAEEAQMCBQUAAAAAAAAAAAECAwQFEQAGEgcIEyEiMUEUNmGl4//EABQBAQAAAAAAAAAAAAAAAAAAAAD/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwDof1i6ryOlkCHIi0YvlvJdccjpl+A4203x5OAcFFQHMZx7A59skAMDvnyfsj9t/DQPnS/fUnqDtxyxmVQpJbb5YdgGT462jxSoBZ4p4qIWDxIyMjPn5ADTuZg3ibzZN1R0c+7kVf1q0twoy3gh1QZDZcCQfTkFWD5K4lPzoAqDXblqLJq7r+kVoxuFDiXA85AkOQ0KBBKm43h+lR/KylOfSkYGA0f2x0s6m2demdVz6gzLt+W1Gsm1oeCFNM+/IAqwQpPL5450DBoLQWg//9k='); + a.id = 'pmButton'; + a.title = 'Send PM to ' + targetProfileName; + // var yourCreateNewConversationURL = yourProfileURL + '/conversations/new' ; + // https://greasyfork.org/en/users/2160-darkred/conversations/new?other_user=JasonBarnabe + a.href = yourCreateNewConversationURL + '?other_user=' + targetProfileName; } diff --git a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages/README.md b/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages/README.md index bb967f5..fb06b0a 100644 --- a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages/README.md +++ b/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages/README.md @@ -1,12 +1,28 @@ By default you may send a pm via a user's forum profile page (e.g. see link 1). With this script you may also send a pm via user's Greasyfork profile page (e.g. see link 2). + ``` -Forum profile: https://greasyfork.org/en/forum/profile/324/darkred -Greasyfork profile: https://greasyfork.org/en/users/2160-darkred +Forum profile: https://greasyfork.org/en/forum/profile/1/JasonBarnabe +Greasyfork profile: https://greasyfork.org/en/users/1-jasonbarnabe ``` example: -![image](https://i.imgur.com/KPikvlM.jpg) +![](https://i.imgur.com/0pe0Ce2.jpg) + +How it works: + +- By clicking the script's PM icon, the script always gets you to a "Create a new conversation" page (`https://greasyfork.org/en/users/your_username/conversations/new?other_user=target_username`). +- In contrast, by clicking the the site's built-in"Send message" link: + - if you haven't sent any PM before, +it gets you to a "Create a new conversation (`https://greasyfork.org/en/users/your_username/conversations/new?other_user=target_username`) + - if you have send PMs before, +it gets you to a "Conversation with user" page (`https://greasyfork.org/en/users/your_username/conversations/___`) +where all your previous PMs are displayed in the same page, +and you have to scroll down to reach the "Post Reply" form. + +Notes: + +- the button doesn't appear in your own Greasyfork profile page, and it only works when you are logged in, for obvious reasons, +- it is compatible with Citrus GFork. -*Notes: the button doesn't appear in your own Greasyfork profile page, -and it only works when you are logged in, for obvious reasons*. \ No newline at end of file +[Hosted in GitHub](https://github.com/darkred/Userscripts) \ No newline at end of file diff --git a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik.user.js b/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik.user.js deleted file mode 100644 index a9b8c3c..0000000 --- a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik.user.js +++ /dev/null @@ -1,63 +0,0 @@ -// ==UserScript== -// @name GreasyFork - add a 'send PM to user' button in Greasyfork profile pages - for Citrus GFork -// @namespace darkred -// @license MIT -// @description It adds a 'send PM to user' button in Greasyfork profile pages -// @version 2017.11.4 -// @include https://greasyfork.org/*/users/* -// @include https://greasyfork.org/*/forum/messages/add -// @grant GM_getResourceURL -// @require https://greasyfork.org/scripts/24818-bililiterange/code/bililiteRange.js -// @require https://code.jquery.com/jquery-3.1.1.min.js -// @require https://greasyfork.org/scripts/24819-jquery-simulate/code/jquery-simulate.js -// @require https://greasyfork.org/scripts/24820-jquery-simulate-ext/code/jquery-simulate-ext.js -// @require https://greasyfork.org/scripts/24822-jquery-simulate-key-sequence-js/code/jquerysimulatekey-sequencejs.js -// @require https://greasyfork.org/scripts/21927-arrive-js/code/arrivejs.js?version=139586 -// @resource icon http://i.imgur.com/ZU0xS0c.jpg -// @run-at document-idle -// ==/UserScript== - -if (document.querySelector('.user-profile-link > a:nth-child(1)') !== null) { - var yourProfileName = document.querySelector('.user-profile-link > a:nth-child(1)').innerHTML; -} -if (document.querySelector('.text-content > h2:nth-child(1)') !== null) { - var targetProfileName = document.querySelector('.text-content > h2:nth-child(1)').textContent.replace('\'s Profile', ''); -} -if (window.location.href.indexOf('users') !== -1 // if current URL is a profile page - && yourProfileName !== targetProfileName) { // ... and this profile page is not yours - sessionStorage.setItem('recipient', targetProfileName); // store in sessionStorage the profileName (it will be inserted in the 'Recipients' textbox ) -after you press the button- - var referenceNode = document.querySelector('.text-content > h2:nth-child(1)'); - var a = document.createElement('input'); - referenceNode.appendChild(a); - a.style.padding = '0px 12px'; - a.setAttribute('type', 'image'); - // a.setAttribute('src', GM_getResourceURL('icon')); // the GM_getResourceURL('icon') results in displaying a "Submit Query" text, instead of the pm icon in GM 3.17 (https://github.com/greasemonkey/greasemonkey/issues/2341) - a.setAttribute('src', 'http://i.imgur.com/ZU0xS0c.jpg'); - a.id = 'pmButton'; - a.title = 'Send PM to ' + targetProfileName; - var lang = String(window.location).match(/^https:\/\/greasyfork\.org\/([a-zA-Z-]+)\/.*$/)[1]; - document.getElementById('pmButton').addEventListener('click', function() { - window.open('https://greasyfork.org/' + lang + '/forum/messages/add', '_self'); - }); -} - -if (window.location.href.indexOf('messages') !== -1) { // if current URL is a 'send PM' page - document.querySelector('#token-input-Form_To').focus(); - document.querySelector('#token-input-Form_To').style.width = 'auto'; - - // document.querySelector('#token-input-Form_To').value = sessionStorage.getItem('recipient'); - var recipient = sessionStorage.getItem('recipient'); - $('#token-input-Form_To').simulate('key-sequence', { sequence: recipient, delay: 1 }); - - document.arrive('.token-input-selected-dropdown-item', function () { - triggerMouseEvent (document.querySelector('.token-input-selected-dropdown-item'), 'mousedown'); - }); - -} - - -function triggerMouseEvent (node, eventType) { - var clickEvent = document.createEvent ('MouseEvents'); - clickEvent.initEvent (eventType, true, true); - node.dispatchEvent (clickEvent); -} diff --git a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik/README.md b/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik/README.md deleted file mode 100644 index cc963c2..0000000 --- a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik/README.md +++ /dev/null @@ -1,32 +0,0 @@ -By default you may send a pm via a user's forum profile page (e.g. see link 1). -With this script you may also send a pm via user's Greasyfork profile page (e.g. see link 2). -``` -Forum profile: https://greasyfork.org/en/forum/profile/324/darkred -Greasyfork profile: https://greasyfork.org/en/users/2160-darkred -``` - -example: -![](https://i.imgur.com/LUN73U5.gif) - -*Notes: the button doesn't appear in your own Greasyfork profile page, -and it only works when you are logged in, for obvious reasons*. -
- -**Update 11/12/2016**: -The script was not working ok (because you have to simulate a keypress sequence -with a delay between each press- -in order the username to be "typed" in the autocomplete popup, and so the script to be able to click it, to select it). -I fixed it, but, in order to manage sending this simulated keypress sequence ( 1-line in the script! - line 47) -I have to use the following `require`'s : -- `jQuery`, -- 1 from [bililiteRange](https://github.com/dwachss/bililiteRange), -- 1 from [jquery-simulate](https://github.com/jquery/jquery-simulate) (by jQuery), and -- 2 from [jquery-simulate-ext](https://github.com/j-ulrich/jquery-simulate-ext) . - -The fact that these `require`'s are needed in order by the `jquery-simulate-ext` plugin to work, -is documented here: [https://github.com/j-ulrich/jquery-simulate-ext#usage](https://github.com/j-ulrich/jquery-simulate-ext#usage). - -And, I also use [arrive.js](https://github.com/uzairfarooq/arrive) in the script. - -
- -[Hosted in GitHub](https://github.com/darkred/Userscripts) diff --git a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik/ZU0xS0c.jpg b/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik/ZU0xS0c.jpg deleted file mode 100644 index 37a95b4..0000000 Binary files a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik/ZU0xS0c.jpg and /dev/null differ diff --git a/GreasyFork_-_filter_discussions_on_scripts_by_review_type_and_author/GreasyFork_-_filter_discussions_on_scripts_by_review_type_and_author.user.js b/GreasyFork_-_filter_discussions_on_scripts_by_review_type_and_author/GreasyFork_-_filter_discussions_on_scripts_by_review_type_and_author.user.js index 576e0f0..d9e0fbe 100644 --- a/GreasyFork_-_filter_discussions_on_scripts_by_review_type_and_author/GreasyFork_-_filter_discussions_on_scripts_by_review_type_and_author.user.js +++ b/GreasyFork_-_filter_discussions_on_scripts_by_review_type_and_author/GreasyFork_-_filter_discussions_on_scripts_by_review_type_and_author.user.js @@ -1,22 +1,23 @@ -// ==UserScript== -// @name GreasyFork - filter discussions on scripts by review type and author -// @namespace darkred -// @author darkred -// @contributor decembre -// @license MIT -// @description Filter discussions on scripts by review type and author via filter buttons, a hoverable dropdown menu or an autocomplete searchbox -// @version 2017.4.19 -// @include https://greasyfork.org/*/scripts/*/feedback* -// @include https://greasyfork.org/*/users/* -// @grant GM_addStyle -// @grant GM_getValue -// @grant GM_setValue -// @grant GM_getResourceText -// @require https://code.jquery.com/jquery-3.1.1.min.js -// @require https://code.jquery.com/ui/1.12.1/jquery-ui.min.js -// @resource jquery-ui.css http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css +// ==UserScript== +// @name GreasyFork - filter discussions on scripts by review type and author +// @namespace darkred +// @version 2017.4.19 +// @description Filter discussions on scripts by review type and author via filter buttons, a hoverable dropdown menu or an autocomplete searchbox +// @author darkred +// @contributor decembre +// @license MIT +// @include https://greasyfork.org/*/scripts/*/feedback* +// @include https://greasyfork.org/*/users/* +// @grant GM_addStyle +// @grant GM_getValue +// @grant GM_setValue +// @grant GM_getResourceText +// @require https://code.jquery.com/jquery-3.1.1.min.js +// @require https://code.jquery.com/ui/1.12.1/jquery-ui.min.js +// @resource jquery-ui.css http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css // This is partially based on this script (http://userscripts-mirror.org/scripts/show/97145) by kuehlschrank. // Thanks a lot to kuehlschrank for making another great script. +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== diff --git a/GreasyFork_-_filter_libraries_in_profiles/GreasyFork_-_filter_libraries_in_profiles.user.js b/GreasyFork_-_filter_libraries_in_profiles/GreasyFork_-_filter_libraries_in_profiles.user.js index 07b5c51..e1c5603 100644 --- a/GreasyFork_-_filter_libraries_in_profiles/GreasyFork_-_filter_libraries_in_profiles.user.js +++ b/GreasyFork_-_filter_libraries_in_profiles/GreasyFork_-_filter_libraries_in_profiles.user.js @@ -1,31 +1,36 @@ -// ==UserScript== -// @name GreasyFork - filter libraries in profiles -// @namespace darkred -// @license MIT -// @description Filters libraries in GreasyFork profiles -// @version 1 -// @include https://greasyfork.org/*/users/* -// @grant none +// ==UserScript== +// @name GreasyFork - filter libraries in profiles +// @namespace darkred +// @version 2018.9.6 +// @description Filters libraries in GreasyFork profiles +// @author darkred +// @contributor Skej +// @license MIT +// @include https://greasyfork.org/*/users/* +// @require https://code.jquery.com/jquery-3.3.1.min.js +// @grant none +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== -var all = document.querySelectorAll('article').length; -var libraries = document.getElementsByClassName('script-type').length; -var scripts = document.querySelectorAll('article').length - libraries; + +var all = document.querySelectorAll('li[data-script-type="public"], li[data-script-type="library"]').length; +var libraries = document.querySelectorAll('li[data-script-type="library"]').length; +var scripts = all - libraries; var parentElement = document.querySelector('#script-list-sort'); var theFirstChild = parentElement.firstChild; -var div = document.createElement("div"); +var div = document.createElement('div'); parentElement.insertBefore(div, theFirstChild); -div.style.position = "fixed"; -div.style.background = "white"; +div.style.position = 'fixed'; +div.style.background = 'white'; -div.style.top = "150px"; -div.style.right = "287px"; +div.style.top = '150px'; +div.style.right = '287px'; @@ -45,30 +50,27 @@ b.onclick = toggleScripts; var c = document.createElement('a'); div.appendChild(c); -c.innerHTML = '' + 'Libraries: ' + '' + '' + libraries + '' + "
"; +c.innerHTML = '' + 'Libraries: ' + '' + '' + libraries + '' + '
'; c.onclick = toggleLibraries; b.click(); function toggleAll(){ - a.style.fontWeight = "bold"; b.style.fontWeight = "normal"; c.style.fontWeight = "normal"; - $('article').show(); - $('.script-type').parent().parent().show(); + a.style.fontWeight = 'bold'; b.style.fontWeight = 'normal'; c.style.fontWeight = 'normal'; + $('li[data-script-type="public"], li[data-script-type="library"]').show(); } function toggleScripts(){ - a.style.fontWeight = "normal"; b.style.fontWeight = "bold"; c.style.fontWeight = "normal"; - $('article').show(); - $('.script-type').parent().parent().hide(); + a.style.fontWeight = 'normal'; b.style.fontWeight = 'bold'; c.style.fontWeight = 'normal'; + $('li[data-script-type="public"], li[data-script-type="library"]').hide(); + $('li[data-script-type="public"]').show(); } function toggleLibraries(){ - a.style.fontWeight = "normal"; b.style.fontWeight = "normal"; c.style.fontWeight = "bold"; - $('article').hide(); - $('.script-type').parent().parent().show(); - - + a.style.fontWeight = 'normal'; b.style.fontWeight = 'normal'; c.style.fontWeight = 'bold'; + $('li[data-script-type="public"], li[data-script-type="library"]').hide(); + $('li[data-script-type="library"]').show(); } diff --git a/GreasyFork_Bullshit_Filter/GreasyFork_Bullshit_Filter.user.js b/GreasyFork_Bullshit_Filter/GreasyFork_Bullshit_Filter.user.js index 762b66b..2b460d6 100644 --- a/GreasyFork_Bullshit_Filter/GreasyFork_Bullshit_Filter.user.js +++ b/GreasyFork_Bullshit_Filter/GreasyFork_Bullshit_Filter.user.js @@ -1,208 +1,185 @@ // ==UserScript== -// @name GreasyFork Bullshit Filter -// @namespace darkred -// @author kuehlschrank, darkred -// @license MIT -// @description Hides scripts for popular browser games and social networks as well as scripts that use "foreign" characters in descriptions. Applies to posts in Forum too. -// @version 2017.5.18 -// @icon https://s3.amazonaws.com/uso_ss/icon/97145/large.png -// @include https://greasyfork.org/*/scripts* -// @exclude /^https:\/\/greasyfork.org\/.*\/scripts\/\d+.*/ -// @exclude https://greasyfork.org/*/scripts/by-site -// @exclude https://greasyfork.org/*/scripts/by-site?* -// @include https://greasyfork.org/*/forum* -// @exclude https://greasyfork.org/*/forum/discussion/* -// @exclude https://greasyfork.org/*/forum/profile* -// @exclude https://greasyfork.org/*/forum/messages* -// @exclude https://greasyfork.org/*/forum/categories -// @grant none -// This is an edited version of this script (http://userscripts-mirror.org/scripts/show/97145) by kuehlschrank. -// Thanks a lot to kuehlschrank for making another great script. +// @name GreasyFork Bullshit Filter +// @namespace darkred +// @version 2021.3.31 +// @description Hides scripts for popular browser games and social networks as well as scripts that use "foreign" characters in descriptions. Applies to posts in Forum too. +// @author kuehlschrank, darkred, valacar, Graphen +// @license MIT +// @icon https://raw.githubusercontent.com/darkred/Userscripts/master/GreasyFork_Bullshit_Filter/large.png +// @include /^https:\/\/(greasy|sleazy)fork\.org\/(.*\/)?(scripts|discussions|users).*$/ +// @exclude /^https:\/\/(greasy|sleazy)fork\.org\/(.*\/)?(scripts\/[\w-]+\/feedback|discussions\/[\d]+|users\/.*\/conversations.*)$/ +// @grant none +// This is a modified version of this script (http://userscripts-mirror.org/scripts/show/97145) by kuehlschrank. +// Thanks a lot to: +// - kuehlschrank for making another great script, +// - valacar for the refactoring, +// - Graphen for the 'Non-Latin' regex. +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== -if (window.location.href.indexOf('forum') === -1) { - (function() { - var filters = { - 'Non-ASCII': /[^\x00-\x7F\s]+/i, - 'Games': /AntiGame|Agar|agar\.io|alis\.io|angel\.io|ExtencionRipXChetoMalo|AposBot|DFxLite|ZTx-Lite|AposFeedingBot|AposLoader|Blah Blah|Orc Clan Script|Astro\s*Empires|^\s*Attack|^\s*Battle|BiteFight|Blood\s*Wars|Bots|Bots4|Brawler|\bBvS\b|Business\s*Tycoon|Castle\s*Age|City\s*Ville|chopcoin\.io|Comunio|Conquer\s*Club|CosmoPulse|cursors\.io|Dark\s*Orbit|Dead\s*Frontier|Diep\.io|\bDOA\b|doblons\.io|DotD|Dossergame|Dragons\s*of\s*Atlantis|driftin\.io|Dugout|\bDS[a-z]+\n|elites\.io|Empire\s*Board|eRep(ublik)?|Epic.*War|ExoPlanet|Falcon Tools|Feuerwache|Farming|FarmVille|Fightinfo|Frontier\s*Ville|Ghost\s*Trapper|Gladiatus|Goalline|Gondal|gota\.io|Grepolis|Hobopolis|\bhwm(\b|_)|Ikariam|\bIT2\b|Jellyneo|Kapi\s*Hospital|Kings\s*Age|Kingdoms?\s*of|knastv(ö|oe)gel|Knight\s*Fight|\b(Power)?KoC(Atta?ck)?\b|\bKOL\b|Kongregate|Last\s*Emperor|Legends?\s*of|Light\s*Rising|lite\.ext\.io|Lockerz|\bLoU\b|Mafia\s*(Wars|Mofo)|Menelgame|Mob\s*Wars|Mouse\s*Hunt|Molehill\s*Empire|NeoQuest|MyFreeFarm|narwhale\.io|Neopets|Nemexia|\bOGame\b|Ogar(io)?|Pardus|Pennergame|Pigskin\s*Empire|PlayerScripts|pokeradar\.io|Popmundo|Po?we?r\s*(Bot|Tools)|PsicoTSI|Ravenwood|Schulterglatze|slither\.io|slitherplus\.io|slitheriogameplay|SpaceWars|splix\.io|\bSW_[a-z]+\n|\bSnP\b|The\s*Crims|The\s*West|torto\.io|Travian|Treasure\s*Isl(and|e)|Tribal\s*Wars|TW.?PRO|Vampire\s*Wars|vertix\.io|War\s*of\s*Ninja|West\s*Wars|wings\.io|\bWoD\b|World\s*of\s*Dungeons|wtf\s*battles|Wurzelimperium/i, - 'Social Networks': /Face\s*book|Google(\+| Plus)|\bHabbo|Kaskus|\bLepra|Leprosorium|MySpace|meinVZ|odnoklassniki|Одноклассники|Orkut|sch(ue|ü)ler(VZ|\.cc)?|studiVZ|Unfriend|Valenth|VK|vkontakte|ВКонтакте|Qzone|Twitter|TweetDeck/i, - 'Clutter': /^\s*(.{1,3})\1+\n|^\s*(.+?)\n+\2\n*$|^\s*.{1,5}\n|do\s*n('|o)?t (install|download)|nicht installieren|just(\s*a)?\s*test|^\s*.{0,4}test.{0,4}\n|\ntest(ing)?\s*|^\s*(\{@|Smolka|Hacks)|\[\d{4,5}\]|free\s*download/i - }; - if (typeof GM_getValue == 'undefined' || (typeof GM_getValue.toString == 'function' && GM_getValue.toString().indexOf('not supported') > -1)) { - GM_getValue = my_GM_getValue; - GM_setValue = my_GM_setValue; - } - insertStyle(); - insertStatus(); - filterScripts(); - insertSwitches(); - - // Note: you may uncomment line 35 (and comment out line 36), in order the filtered scripts to be highlighted khaki -instead of hiding them- so that you can check which scripts have been filtered - function insertStyle() { - var style = document.createElement('style'); - // style.textContent = 'li.filtered { background-color:khaki; !important;} .filter-status { margin-left: 6px; } .filter-switches { display:none; } *:hover > .filter-switches { display:block !important; } .filter-on, .filter-off {display:block !important; width: 97px;}} .filter-switches a { text-decoration:none !important; color:inherit; cursor:pointer; } .filter-switches a { margin-left: 8px; padding: 0 4px; } a.filter-on { background-color:#ffcccc; color:#333333; text-decoration:line-through !important } a.filter-off { background-color:#ccffcc; color:#333333 } '; - style.textContent = 'li.filtered { display:none !important; } .filter-status { margin-left: 6px; } .filter-switches { display:none; } *:hover > .filter-switches { display:block !important; } .filter-on, .filter-off {display:block !important; width: 97px;}} .filter-switches a { text-decoration:none !important; color:inherit; cursor:pointer; } .filter-switches a { margin-left: 8px; padding: 0 4px; } a.filter-on { background-color:#ffcccc; color:#333333; text-decoration:line-through !important } a.filter-off { background-color:#ccffcc; color:#333333 } '; - style.type = 'text/css'; - document.querySelector('head').appendChild(style); - } +(function() { - function insertStatus() { - var p = document.querySelector('#script-list-option-groups'); - if (p) { - var status = document.createElement('span'); - status.className = 'filter-status'; - p.appendChild(status); - } + const DEBUGGING = 0; + + const filters = { + 'Non-ASCII': /[^\x00-\x7F\s]+/, + 'Non-Latin': /[^\u0000-\u024F\u2000-\u214F\s]+/, + 'Games': /Aimbot|AntiGame|Agar|agar\.io|alis\.io|angel\.io|ExtencionRipXChetoMalo|AposBot|DFxLite|ZTx-Lite|AposFeedingBot|AposLoader|Balz|Blah Blah|Orc Clan Script|Astro\s*Empires|^\s*Attack|^\s*Battle|BiteFight|Blood\s*Wars|Bloble|Bonk|Bots|Bots4|Brawler|\bBvS\b|Business\s*Tycoon|Castle\s*Age|City\s*Ville|chopcoin\.io|Comunio|Conquer\s*Club|CosmoPulse|cursors\.io|Dark\s*Orbit|Dead\s*Frontier|Diep\.io|\bDOA\b|doblons\.io|DotD|Dossergame|Dragons\s*of\s*Atlantis|driftin\.io|Dugout|\bDS[a-z]+\n|elites\.io|Empire\s*Board|eRep(ublik)?|Epicmafia|Epic.*War|ExoPlanet|Falcon Tools|Feuerwache|Farming|FarmVille|Fightinfo|Frontier\s*Ville|Ghost\s*Trapper|Gladiatus|Goalline|Gondal|gota\.io|Grepolis|Hobopolis|\bhwm(\b|_)|Ikariam|\bIT2\b|Jellyneo|Kapi\s*Hospital|Kings\s*Age|Kingdoms?\s*of|knastv(o|oe)gel|Knight\s*Fight|\b(Power)?KoC(Atta?ck)?\b|\bKOL\b|Kongregate|Krunker|Last\s*Emperor|Legends?\s*of|Light\s*Rising|lite\.ext\.io|Lockerz|\bLoU\b|Mafia\s*(Wars|Mofo)|Menelgame|Mob\s*Wars|Mouse\s*Hunt|Molehill\s*Empire|MooMoo|MyFreeFarm|narwhale\.io|Neopets|NeoQuest|Nemexia|\bOGame\b|Ogar(io)?|Pardus|Pennergame|Pigskin\s*Empire|PlayerScripts|pokeradar\.io|Popmundo|Po?we?r\s*(Bot|Tools)|PsicoTSI|Ravenwood|Schulterglatze|Skribbl|slither\.io|slitherplus\.io|slitheriogameplay|SpaceWars|splix\.io|Survivio|\bSW_[a-z]+\n|\bSnP\b|The\s*Crims|The\s*West|torto\.io|Travian|Treasure\s*Isl(and|e)|Tribal\s*Wars|TW.?PRO|Vampire\s*Wars|vertix\.io|War\s*of\s*Ninja|World\s*of\s*Tanks|West\s*Wars|wings\.io|\bWoD\b|World\s*of\s*Dungeons|wtf\s*battles|Wurzelimperium|Yohoho|Zombs/iu, + 'Social Networks': /Face\s*book|Google(\+| Plus)|\bHabbo|Kaskus|\bLepra|Leprosorium|MySpace|meinVZ|odnoklassniki|Одноклассники|Orkut|sch(ue|ü)ler(VZ|\.cc)?|studiVZ|Unfriend|Valenth|VK|vkontakte|ВКонтакте|Qzone|Twitter|TweetDeck/iu, + 'Clutter': /^\s*(.{1,3})\1+\n|^\s*(.+?)\n+\2\n*$|^\s*.{1,5}\n|do\s*n('|o)?t (install|download)|nicht installieren|(just )?(\ban? |\b)test(ing|s|\d|\b)|^\s*.{0,4}test.{0,4}\n|\ntest(ing)?\s*|^\s*(\{@|Smolka|Hacks)|\[\d{4,5}\]|free\s*download|theme|(night|dark) ?(mode)?/iu + }; + + const commonCss = ` + .filter-status { + margin-left: 6px; } - function filterScripts() { - var activeFilters = []; - for (var filter in filters) { - if (filters.hasOwnProperty(filter) && GM_getValue(filter, 'on') == 'on') { - activeFilters.push(filters[filter]); - } - } - var nodes = document.querySelectorAll('article > h2'), - numActiveFilters = activeFilters.length, - numFiltered = 0; - for (var i = 0, numNodes = nodes.length, td = null; i < numNodes && (td = nodes[i]); i++) { - td.parentNode.parentNode.classList.remove('filtered'); - for (var j = 0; j < numActiveFilters; j++) { - if (td.innerText.match(activeFilters[j])) { - td.parentNode.parentNode.classList.add('filtered'); - numFiltered++; - break; - } - } - } - document.querySelector('.filter-status').textContent = document.querySelectorAll('article > h2').length - numFiltered + ' scripts (' + numFiltered + ' filtered)'; + .filter-switches { + display: none; } - function insertSwitches() { - var span = document.createElement('span'); - span.className = 'filter-switches'; - for (var filter in filters) { - if (filters.hasOwnProperty(filter)) { - span.appendChild(createSwitch(filter, GM_getValue(filter, 'on') == 'on')); - } - } - document.querySelector('.filter-status').parentNode.appendChild(span); + :hover>.filter-switches { + display: block; } - function createSwitch(label, isOn) { - var a = document.createElement('a'); - a.className = isOn ? 'filter-on' : 'filter-off'; - a.textContent = label; - a.addEventListener('click', function(e) { - if (this.className == 'filter-on') { - this.className = 'filter-off'; - GM_setValue(this.textContent, 'off'); - } else { - this.className = 'filter-on'; - GM_setValue(this.textContent, 'on'); - } - filterScripts(); - e.preventDefault(); - }, false); - return a; + .filter-on, + .filter-off { + display: block; + width: 100px; } - function my_GM_setValue(name, value) { - localStorage.setItem(name, value); + .filter-switches a { + text-decoration: none; + color: inherit; + cursor: pointer; } - function my_GM_getValue(name, defaultValue) { - var value; - if (!(value = localStorage.getItem(name))) { - return defaultValue; - } - return value; + .filter-switches a { + margin-left: 8px; + padding: 0 4px; } - })(); -} else { + a.filter-on { + background-color: #ffcccc; + color: #333333; + text-decoration: line-through; + } - (function() { - var filters = { - 'Non-ASCII': /[^\x00-\x7F\s]+/i, - 'Games': /AntiGame|Agar|agar\.io|alis\.io|angel\.io|ExtencionRipXChetoMalo|AposBot|DFxLite|ZTx-Lite|AposFeedingBot|AposLoader|Blah Blah|Orc Clan Script|Astro\s*Empires|^\s*Attack|^\s*Battle|BiteFight|Blood\s*Wars|Bots|Bots4|Brawler|\bBvS\b|Business\s*Tycoon|Castle\s*Age|City\s*Ville|chopcoin\.io|Comunio|Conquer\s*Club|CosmoPulse|cursors\.io|Dark\s*Orbit|Dead\s*Frontier|Diep\.io|\bDOA\b|doblons\.io|DotD|Dossergame|Dragons\s*of\s*Atlantis|driftin\.io|Dugout|\bDS[a-z]+\n|elites\.io|Empire\s*Board|eRep(ublik)?|Epic.*War|ExoPlanet|Falcon Tools|Feuerwache|Farming|FarmVille|Fightinfo|Frontier\s*Ville|Ghost\s*Trapper|Gladiatus|Goalline|Gondal|gota\.io|Grepolis|Hobopolis|\bhwm(\b|_)|Ikariam|\bIT2\b|Jellyneo|Kapi\s*Hospital|Kings\s*Age|Kingdoms?\s*of|knastv(ö|oe)gel|Knight\s*Fight|\b(Power)?KoC(Atta?ck)?\b|\bKOL\b|Kongregate|Last\s*Emperor|Legends?\s*of|Light\s*Rising|lite\.ext\.io|Lockerz|\bLoU\b|Mafia\s*(Wars|Mofo)|Menelgame|Mob\s*Wars|Mouse\s*Hunt|Molehill\s*Empire|NeoQuest|MyFreeFarm|narwhale\.io|Neopets|Nemexia|\bOGame\b|Ogar(io)?|Pardus|Pennergame|Pigskin\s*Empire|PlayerScripts|pokeradar\.io|Popmundo|Po?we?r\s*(Bot|Tools)|PsicoTSI|Ravenwood|Schulterglatze|slither\.io|slitherplus\.io|slitheriogameplay|SpaceWars|splix\.io|\bSW_[a-z]+\n|\bSnP\b|The\s*Crims|The\s*West|torto\.io|Travian|Treasure\s*Isl(and|e)|Tribal\s*Wars|TW.?PRO|Vampire\s*Wars|vertix\.io|War\s*of\s*Ninja|West\s*Wars|wings\.io|\bWoD\b|World\s*of\s*Dungeons|wtf\s*battles|Wurzelimperium/i, - 'Social Networks': /Face\s*book|Google(\+| Plus)|\bHabbo|Kaskus|\bLepra|Leprosorium|MySpace|meinVZ|odnoklassniki|Одноклассники|Orkut|sch(ue|ü)ler(VZ|\.cc)?|studiVZ|Unfriend|Valenth|VK|vkontakte|ВКонтакте|Qzone|Twitter|TweetDeck/i, - 'Clutter': /^\s*(.{1,3})\1+\n|^\s*(.+?)\n+\2\n*$|^\s*.{1,5}\n|do\s*n('|o)?t (install|download)|nicht installieren|just(\s*a)?\s*test|^\s*.{0,4}test.{0,4}\n|\ntest(ing)?\s*|^\s*(\{@|Smolka|Hacks)|\[\d{4,5}\]|free\s*download/i - }; - if (typeof GM_getValue == 'undefined' || (typeof GM_getValue.toString == 'function' && GM_getValue.toString().indexOf('not supported') > -1)) { - GM_getValue = my_GM_getValue; - GM_setValue = my_GM_setValue; + a.filter-off { + background-color: #ccffcc; + color: #333333; + } + `; + + const isOnForum = /discussions|feedback/.test(window.location.href); + + const site = {}; + if (isOnForum) { + site.css = '.discussion-list-item.filtered { display: none; } .filter-on, .filter-off { color: black; } ' + commonCss; + site.cssDebug = '.discussion-list-item.filtered { background-color: khaki; } ' + commonCss; + site.filterStatusLocation = '.list-option-groups'; + site.itemsToCheck = '.discussion-list-item'; + site.itemType = 'discussions'; + site.removeFilter = function(el) { + el.classList.remove('filtered'); + }; + site.applyFilter = function(el, activeFilter) { + const temp = el.children[1].innerText; + if (temp && temp.match(activeFilter)) { + el.classList.add('filtered'); + return true; + } + return false; + }; + } else { + site.css = 'li.filtered { display: none; } ' + commonCss; + site.cssDebug = 'li.filtered { background-color: khaki; } ' + commonCss; + site.filterStatusLocation = '#script-list-option-groups'; + site.itemsToCheck = 'article > h2'; + site.itemType = 'scripts'; + site.removeFilter = function(el) { + el.parentNode.parentNode.classList.remove('filtered'); + }; + site.applyFilter = function(el, activeFilter) { + if (el.innerText.match(activeFilter)) { + el.parentNode.parentNode.classList.add('filtered'); + return true; + } + return false; + }; } + insertStyle(); insertStatus(); filterScripts(); insertSwitches(); - // Note: you may uncomment line 35 (and comment out line 36), in order the filtered scripts to be highlighted khaki -instead of hiding them- so that you can check which scripts have been filtered function insertStyle() { - var style = document.createElement('style'); - // style.textContent = '.ItemDiscussion.filtered { background-color:khaki !important;} .filter-status { margin-left: 6px; } .filter-switches { display:none; } *:hover > .filter-switches { display:block !important; } .filter-on, .filter-off {display:block !important; width: 97px;}} .filter-switches a { text-decoration:none !important; color:inherit; cursor:pointer; } .filter-switches a { margin-left: 8px; padding: 0 4px; } a.filter-on { background-color:#ffcccc; color:#333333; text-decoration:line-through !important } a.filter-off { background-color:#ccffcc; color:#333333 } '; - style.textContent = '.ItemDiscussion.filtered { display:none !important; } .filter-status { margin-left: 6px; } .filter-switches { display:none; } *:hover > .filter-switches { display:block !important; } .filter-on, .filter-off {display:block !important; width: 97px;}} .filter-switches a { text-decoration:none !important; color:inherit; cursor:pointer; } .filter-switches a { margin-left: 8px; padding: 0 4px; } a.filter-on { background-color:#ffcccc; color:#333333; text-decoration:line-through !important } a.filter-off { background-color:#ccffcc; color:#333333 } .filter-on, .filter-off { color: black !important;} '; + const style = document.createElement('style'); + style.textContent = DEBUGGING ? site.cssDebug : site.css; style.type = 'text/css'; - document.querySelector('head').appendChild(style); + document.head.appendChild(style); } function insertStatus() { - var p = document.querySelector('#Head'); + const p = document.querySelector(site.filterStatusLocation); if (p) { - var status = document.createElement('span'); + const status = document.createElement('span'); status.className = 'filter-status'; p.appendChild(status); } } function filterScripts() { - var activeFilters = []; - for (var filter in filters) { - if (filters.hasOwnProperty(filter) && GM_getValue(filter, 'on') == 'on') { - activeFilters.push(filters[filter]); + const activeFilters = []; + for (let filterType of Object.keys(filters)) { + if (configGetValue(filterType, 'on') === 'on') { + activeFilters.push(filters[filterType]); } } - var nodes = document.querySelectorAll('.ItemDiscussion'), - numActiveFilters = activeFilters.length, - numFiltered = 0; - for (var i = 0, numNodes = nodes.length, td = null; i < numNodes && (td = nodes[i]); i++) { - td.classList.remove('filtered'); - for (var j = 0; j < numActiveFilters; j++) { - var temp = td.children[1].firstElementChild.innerText; - if(temp.match(activeFilters[j])) { - td.classList.add('filtered'); + const nodes = document.querySelectorAll(site.itemsToCheck); + let numFiltered = 0; + for (let node of nodes) { + site.removeFilter(node); + for (let activeFilter of activeFilters) { + let filtered = site.applyFilter(node, activeFilter); + if (filtered) { numFiltered++; break; } } } - document.querySelector('.filter-status').innerText = (document.querySelectorAll('.ItemDiscussion').length - numFiltered) + ' discussions (' + numFiltered + ' filtered)'; + const filterStatus = document.querySelector('.filter-status'); + if (filterStatus) { + const numUnfiltered = document.querySelectorAll(site.itemsToCheck).length - numFiltered; + filterStatus.textContent = `${numUnfiltered} ${site.itemType} (${numFiltered} filtered)`; + } } function insertSwitches() { - var span = document.createElement('span'); + const span = document.createElement('span'); span.className = 'filter-switches'; - for (var filter in filters) { - if (filters.hasOwnProperty(filter)) { - span.appendChild(createSwitch(filter, GM_getValue(filter, 'on') == 'on')); - } + for (let filterType of Object.keys(filters)) { + span.appendChild(createSwitch(filterType, configGetValue(filterType, 'on') === 'on')); + } + const filterStatus = document.querySelector('.filter-status'); + if (filterStatus) { + filterStatus.parentNode.appendChild(span); } - document.querySelector('.filter-status').parentNode.appendChild(span); } function createSwitch(label, isOn) { - var a = document.createElement('a'); + const a = document.createElement('a'); a.className = isOn ? 'filter-on' : 'filter-off'; a.textContent = label; a.addEventListener('click', function(e) { - if (this.className == 'filter-on') { + if (this.className === 'filter-on') { this.className = 'filter-off'; - GM_setValue(this.textContent, 'off'); + configSetValue(this.textContent, 'off'); } else { this.className = 'filter-on'; - GM_setValue(this.textContent, 'on'); + configSetValue(this.textContent, 'on'); } filterScripts(); e.preventDefault(); @@ -210,20 +187,13 @@ if (window.location.href.indexOf('forum') === -1) { return a; } - function my_GM_setValue(name, value) { + function configSetValue(name, value) { localStorage.setItem(name, value); } - function my_GM_getValue(name, defaultValue) { - var value; - if (!(value = localStorage.getItem(name))) { - return defaultValue; - } - return value; + function configGetValue(name, defaultValue) { + const value = localStorage.getItem(name); + return value ? value : defaultValue; } -})(); - - - -} \ No newline at end of file +})(); diff --git a/GreasyFork_Bullshit_Filter/README.md b/GreasyFork_Bullshit_Filter/README.md index 79ce41d..45bca2e 100644 --- a/GreasyFork_Bullshit_Filter/README.md +++ b/GreasyFork_Bullshit_Filter/README.md @@ -3,7 +3,7 @@ i.e. it filters any/all of these 4 categories: * **Games**: scripts for browser games like Kingdoms of Camelot, Mafia Wars and Ikariam * **Social Networks**: scripts for general purpose social networking sites like Facebook, studiVZ and VKontakte * **Non-ASCII**: scripts that use non-English characters in description (accents, umlauts, cyrillic letters, ...) -* **Clutter**: obvious spam, titles like "asdasdasd", description = title, title < 6 characters, "just a test". +* **Clutter**: obvious spam, titles like "asdasdasd", description = title, title < 6 characters, "just a test", scripts for themes/dark/night mode (because they are, in effect, userstyles). The filters list appears just below the `#script-list-option-groups` element (i.e. on the right). ![image](https://i.imgur.com/ASbOvvm.gif) @@ -11,4 +11,5 @@ The filters list appears just below the `#script-list-option-groups` element (i. *Note: you may uncomment line 35 (and comment out line 46), in order the filtered scripts to be highlighted khaki -instead of hiding them- so that you can check which scripts have been filtered.* This is a modified version of this script: [userscripts.org Bullshit Filter](http://userscripts-mirror.org/scripts/show/97145) (by kuehlschrank). -Thanks a lot to kuehlschrank for making another great script. +Thanks a lot to kuehlschrank for making another great script. +Thanks a lot to valacar for [the refactoring](https://greasyfork.org/en/forum/discussion/42803/refactored). diff --git a/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork.user.js b/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork.user.js index bc6dc31..a710d94 100644 --- a/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork.user.js +++ b/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork.user.js @@ -1,372 +1,241 @@ // ==UserScript== -// @name GreasyFork Bullshit Filter - for TS Citrus Gfork -// @namespace darkred -// @author kuehlschrank, darkred -// @license MIT -// @description Hides scripts for popular browser games and social networks as well as scripts that use "foreign" characters in descriptions. Applies to posts in Forum too. -// @version 2017.5.18 -// @icon https://s3.amazonaws.com/uso_ss/icon/97145/large.png -// @include https://greasyfork.org/*/scripts* -// @exclude /^https:\/\/greasyfork.org\/.*\/scripts\/\d+.*/ -// @exclude https://greasyfork.org/*/scripts/by-site -// @exclude https://greasyfork.org/*/scripts/by-site?* -// @include https://greasyfork.org/*/forum* -// @exclude https://greasyfork.org/*/forum/discussion/* -// @exclude https://greasyfork.org/*/forum/profile* -// @exclude https://greasyfork.org/*/forum/messages* -// @exclude https://greasyfork.org/*/forum/categories -// @include https://sleazyfork.org/*/scripts* -// @exclude /^https:\/\/sleazyfork.org\/.*\/scripts\/\d+.*/ -// @exclude https://sleazyfork.org/*/scripts/by-site -// @exclude https://sleazyfork.org/*/scripts/by-site?* -// @include https://sleazyfork.org/*/forum* -// @exclude https://sleazyfork.org/*/forum/discussion/* -// @exclude https://sleazyfork.org/*/forum/profile* -// @exclude https://sleazyfork.org/*/forum/messages* -// @exclude https://sleazyfork.org/*/forum/categories +// @name GreasyFork Bullshit Filter - for TS Citrus Gfork +// @namespace darkred +// @version 2021.3.31 +// @description Hides scripts for popular browser games and social networks as well as scripts that use "foreign" characters in descriptions. Applies to posts in Forum too. +// @author kuehlschrank, darkred, valacar, Graphen +// @license MIT +// @icon https://raw.githubusercontent.com/darkred/Userscripts/master/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork/large.png +// @include /^https:\/\/(greasy|sleazy)fork\.org\/(.*\/)?(scripts|discussions|users).*$/ +// @exclude /^https:\/\/(greasy|sleazy)fork\.org\/(.*\/)?(scripts\/[\w-]+\/feedback|discussions\/[\d]+|users\/.*\/conversations.*)$/ // @grant none // @run-at document-idle -// This is an edited version of this script (http://userscripts-mirror.org/scripts/show/97145) by kuehlschrank. -// Thanks a lot to kuehlschrank for making another great script. +// This is a modified version of this script (http://userscripts-mirror.org/scripts/show/97145) by kuehlschrank. +// Thanks a lot to: +// - kuehlschrank for making another great script, +// - valacar for the refactoring, +// - Graphen for the 'Non-Latin' regex. +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== -if (window.location.href.indexOf('forum') === -1) { - (function() { - var filters = { - 'Non-ASCII':/[^\x00-\x7F\s]+/i, - 'Games': /AntiGame|Agar|agar\.io|alis\.io|angel\.io|ExtencionRipXChetoMalo|AposBot|DFxLite|ZTx-Lite|AposFeedingBot|AposLoader|Blah Blah|Orc Clan Script|Astro\s*Empires|^\s*Attack|^\s*Battle|BiteFight|Blood\s*Wars|Bots|Bots4|Brawler|\bBvS\b|Business\s*Tycoon|Castle\s*Age|City\s*Ville|chopcoin\.io|Comunio|Conquer\s*Club|CosmoPulse|cursors\.io|Dark\s*Orbit|Dead\s*Frontier|Diep\.io|\bDOA\b|doblons\.io|DotD|Dossergame|Dragons\s*of\s*Atlantis|driftin\.io|Dugout|\bDS[a-z]+\n|elites\.io|Empire\s*Board|eRep(ublik)?|Epic.*War|ExoPlanet|Falcon Tools|Feuerwache|Farming|FarmVille|Fightinfo|Frontier\s*Ville|Ghost\s*Trapper|Gladiatus|Goalline|Gondal|gota\.io|Grepolis|Hobopolis|\bhwm(\b|_)|Ikariam|\bIT2\b|Jellyneo|Kapi\s*Hospital|Kings\s*Age|Kingdoms?\s*of|knastv(ö|oe)gel|Knight\s*Fight|\b(Power)?KoC(Atta?ck)?\b|\bKOL\b|Kongregate|Last\s*Emperor|Legends?\s*of|Light\s*Rising|lite\.ext\.io|Lockerz|\bLoU\b|Mafia\s*(Wars|Mofo)|Menelgame|Mob\s*Wars|Mouse\s*Hunt|Molehill\s*Empire|NeoQuest|MyFreeFarm|narwhale\.io|Neopets|Nemexia|\bOGame\b|Ogar(io)?|Pardus|Pennergame|Pigskin\s*Empire|PlayerScripts|pokeradar\.io|Popmundo|Po?we?r\s*(Bot|Tools)|PsicoTSI|Ravenwood|Schulterglatze|slither\.io|slitherplus\.io|slitheriogameplay|SpaceWars|splix\.io|\bSW_[a-z]+\n|\bSnP\b|The\s*Crims|The\s*West|torto\.io|Travian|Treasure\s*Isl(and|e)|Tribal\s*Wars|TW.?PRO|Vampire\s*Wars|vertix\.io|War\s*of\s*Ninja|West\s*Wars|wings\.io|\bWoD\b|World\s*of\s*Dungeons|wtf\s*battles|Wurzelimperium/i, - 'Social Networks': /Face\s*book|Google(\+| Plus)|\bHabbo|Kaskus|\bLepra|Leprosorium|MySpace|meinVZ|odnoklassniki|Одноклассники|Orkut|sch(ue|ü)ler(VZ|\.cc)?|studiVZ|Unfriend|Valenth|VK|vkontakte|ВКонтакте|Qzone|Twitter|TweetDeck/i, - 'Clutter':/^\s*(.{1,3})\1+\n|^\s*(.+?)\n+\2\n*$|^\s*.{1,5}\n|do\s*n('|o)?t (install|download)|nicht installieren|just(\s*a)?\s*test|^\s*.{0,4}test.{0,4}\n|\ntest(ing)?\s*|^\s*(\{@|Smolka|Hacks)|\[\d{4,5}\]|free\s*download/i +(function() { + + const DEBUGGING = 0; + + const filters = { + 'Non-ASCII': /[^\x00-\x7F\s]+/, + 'Non-Latin': /[^\u0000-\u024F\u2000-\u214F\s]+/, + 'Games': /Aimbot|AntiGame|Agar|agar\.io|alis\.io|angel\.io|ExtencionRipXChetoMalo|AposBot|DFxLite|ZTx-Lite|AposFeedingBot|AposLoader|Balz|Blah Blah|Orc Clan Script|Astro\s*Empires|^\s*Attack|^\s*Battle|BiteFight|Blood\s*Wars|Bloble|Bonk|Bots|Bots4|Brawler|\bBvS\b|Business\s*Tycoon|Castle\s*Age|City\s*Ville|chopcoin\.io|Comunio|Conquer\s*Club|CosmoPulse|cursors\.io|Dark\s*Orbit|Dead\s*Frontier|Diep\.io|\bDOA\b|doblons\.io|DotD|Dossergame|Dragons\s*of\s*Atlantis|driftin\.io|Dugout|\bDS[a-z]+\n|elites\.io|Empire\s*Board|eRep(ublik)?|Epicmafia|Epic.*War|ExoPlanet|Falcon Tools|Feuerwache|Farming|FarmVille|Fightinfo|Frontier\s*Ville|Ghost\s*Trapper|Gladiatus|Goalline|Gondal|gota\.io|Grepolis|Hobopolis|\bhwm(\b|_)|Ikariam|\bIT2\b|Jellyneo|Kapi\s*Hospital|Kings\s*Age|Kingdoms?\s*of|knastv(o|oe)gel|Knight\s*Fight|\b(Power)?KoC(Atta?ck)?\b|\bKOL\b|Kongregate|Krunker|Last\s*Emperor|Legends?\s*of|Light\s*Rising|lite\.ext\.io|Lockerz|\bLoU\b|Mafia\s*(Wars|Mofo)|Menelgame|Mob\s*Wars|Mouse\s*Hunt|Molehill\s*Empire|MooMoo|MyFreeFarm|narwhale\.io|Neopets|NeoQuest|Nemexia|\bOGame\b|Ogar(io)?|Pardus|Pennergame|Pigskin\s*Empire|PlayerScripts|pokeradar\.io|Popmundo|Po?we?r\s*(Bot|Tools)|PsicoTSI|Ravenwood|Schulterglatze|Skribbl|slither\.io|slitherplus\.io|slitheriogameplay|SpaceWars|splix\.io|Survivio|\bSW_[a-z]+\n|\bSnP\b|The\s*Crims|The\s*West|torto\.io|Travian|Treasure\s*Isl(and|e)|Tribal\s*Wars|TW.?PRO|Vampire\s*Wars|vertix\.io|War\s*of\s*Ninja|World\s*of\s*Tanks|West\s*Wars|wings\.io|\bWoD\b|World\s*of\s*Dungeons|wtf\s*battles|Wurzelimperium|Yohoho|Zombs/iu, + 'Social Networks': /Face\s*book|Google(\+| Plus)|\bHabbo|Kaskus|\bLepra|Leprosorium|MySpace|meinVZ|odnoklassniki|Одноклассники|Orkut|sch(ue|ü)ler(VZ|\.cc)?|studiVZ|Unfriend|Valenth|VK|vkontakte|ВКонтакте|Qzone|Twitter|TweetDeck/iu, + 'Clutter': /^\s*(.{1,3})\1+\n|^\s*(.+?)\n+\2\n*$|^\s*.{1,5}\n|do\s*n('|o)?t (install|download)|nicht installieren|(just )?(\ban? |\b)test(ing|s|\d|\b)|^\s*.{0,4}test.{0,4}\n|\ntest(ing)?\s*|^\s*(\{@|Smolka|Hacks)|\[\d{4,5}\]|free\s*download|theme|(night|dark) ?(mode)?/iu + }; + + const commonCss = ` + .filter-status { + margin-left: 6px; + position: fixed; + top: calc(0%); + left: calc(13.5%); + color: #787878; + } + .filter-switches { + display: none; + } + *:hover > .filter-switches { + display: block !important; + position: fixed; + top: calc(1.7%); + left: calc(14%); + } + .filter-on, + .filter-off { + display: block !important; + width: 105px; + } + .filter-switches a { + text-decoration: none !important; + color: inherit; + cursor: pointer; + } + .filter-switches a { + margin-left: 8px; + padding: 0 4px; + } + a.filter-on { + background-color: #ea6e6e; + color: #333333; + text-decoration: line-through !important; + } + a.filter-off { + background-color: #6da46b; + color: #333333; + } + `; + + const isOnForum = /discussions|feedback/.test(window.location.href); + + const site = {}; + if (isOnForum) { + site.css = '.discussion-list-item.filtered { display: none; } .filter-on, .filter-off { color: black; } ' + commonCss; + site.cssDebug = '.discussion-list-item.filtered { background-color: khaki !important; } ' + commonCss; + site.filterStatusLocation = '#main-header'; + site.itemsToCheck = '.discussion-list-item'; + site.itemType = 'discussions'; + site.removeFilter = function(el) { + el.classList.remove('filtered'); }; - if(typeof GM_getValue == 'undefined' || (typeof GM_getValue.toString == 'function' && GM_getValue.toString().indexOf('not supported') > -1)) { - GM_getValue = my_GM_getValue; - GM_setValue = my_GM_setValue; - } - - - insertStyle(); - insertStatus(); - filterScripts(); - insertSwitches(); - - - var target = document.querySelector('#script-table > tbody:nth-child(2)'); - var observer = new MutationObserver((mutations) => { - insertStyle(); - insertStatus(); - filterScripts(); - insertSwitches(); - }), - config = { - childList: true, - subtree: true, - }; - observer.observe(target, config); - - - - - - // Note: you may uncomment line 37-81 and comment out line 36, in order the filtered scripts to be highlighted red -instead of hiding them- so that you can check which scripts have been filtered - function insertStyle() { - var style = document.createElement('style'); - // style.textContent = ` tr.filtered td, li.filtered {background-color:khaki !important;} .filter-status {margin-left:6px; position:fixed; top:calc(0%); left:calc(13.5%)} .filter-switches {display:none; position:fixed; top:calc(2.5%); left:calc(14%)} *:hover > .filter-switches {display:block !important; position:fixed; top:calc(2.5%); left:calc(14%)} .filter-on,.filter-off {display:block !important; width:105px}} .filter-switches a {text-decoration:none !important; color:inherit; cursor:pointer} .filter-switches a {margin-left:8px; padding:0 4px} a.filter-on {background-color:#ff6161; color:#333333; text-decoration:line-through !important} a.filter-off {background-color:#97ca97;color:#333333; `; - style.textContent = ` tr.filtered, li.filtered { - display: none !important; - } - .filter-status { - margin-left: 6px; - position: fixed; - top: calc(0%); - left: calc(13.5%); - } - .filter-switches { - display: none; - position: fixed; - top: calc(2.5%); - left: calc(14%); - } - *:hover > .filter-switches { - display: block !important; - position: fixed; - top: calc(2.5%); - left: calc(14%); - } - .filter-on, - .filter-off { - display: block !important; - width: 105px; - } - } - .filter-switches a { - text-decoration: none !important; - color: inherit; - cursor: pointer; - } - .filter-switches a { - margin-left: 8px; - padding: 0 4px; - } - a.filter-on { - background-color: #ea6e6e; - color: #333333; - text-decoration: line-through !important - } - a.filter-off { - background-color: #6da46b; - color: #333333; - }`; - style.type = 'text/css'; - document.querySelector('head').appendChild(style); - } - - function insertStatus() { - var p = document.querySelector('#main-header'); - if(p) { - var status = document.createElement('span'); - status.className = 'filter-status'; - p.appendChild(status); + site.applyFilter = function(el, activeFilter) { + let temp = el.children[1].innerText; + if(temp && temp.match(activeFilter)) { + el.classList.add('filtered'); + return true; } - } - - function filterScripts() { - var activeFilters = []; - for(var filter in filters) { - if(filters.hasOwnProperty(filter) && GM_getValue(filter, 'on') == 'on') { - activeFilters.push(filters[filter]); - } + return false; + }; + } else { // Is in script listings + site.css = 'tr.filtered, li.filtered { display: none; } ' + commonCss; + site.cssDebug = 'tr.filtered td, li.filtered { background-color: khaki !important; } ' + commonCss; + site.filterStatusLocation = '#main-header'; + site.itemsToCheck = `tbody > tr > td > div.thetitle, + #browse-script-list > li`; + site.itemType = 'scripts'; + site.removeFilter = function(el) { + if (window.location.href.indexOf('/libraries') === -1) { + el.parentNode.parentNode.classList.remove('filtered'); + } else { + el.classList.remove('filtered'); } - var nodes = document.querySelectorAll('tbody > tr > td > div.thetitle, #browse-script-list > li'), - numActiveFilters = activeFilters.length, - numFiltered = 0; - for(var i = 0, numNodes = nodes.length, td = null; i < numNodes && (td = nodes[i]); i++) { + }; + site.applyFilter = function(el, activeFilter) { + if (window.location.href.indexOf('/libraries') === -1) { + var temp = el.parentNode.firstChild.firstChild.textContent + ' ' + el.parentNode.lastChild.textContent; // store script's name and description (with a space between) to variable 'temp' + } else { + temp = el.getAttribute('data-script-name') + ' ' + el.firstElementChild.firstElementChild.children[3].innerText; + } + if (temp && temp.match(activeFilter)) { if (window.location.href.indexOf('/libraries') === -1) { - td.parentNode.parentNode.classList.remove('filtered'); + el.parentNode.parentNode.classList.add('filtered'); } else { - td.classList.remove('filtered'); - } - for(var j = 0; j < numActiveFilters; j++) { - if (window.location.href.indexOf('/libraries') === -1) { - var temp = td.parentNode.firstChild.firstChild.textContent + ' ' + td.parentNode.lastChild.textContent; // store script's name and description (with a space between) to variable 'temp' - } else { - // temp = td.firstElementChild.firstElementChild.innerText + ' ' + td.firstElementChild.children[3].innerText; - temp = td.getAttribute('data-script-name') + ' ' + td.firstElementChild.firstElementChild.children[3].innerText; - } - if(temp.match(activeFilters[j])) { - if (window.location.href.indexOf('/libraries') === -1) { - td.parentNode.parentNode.classList.add('filtered'); - } else { - td.classList.add('filtered'); - } - numFiltered++; - break; - } + el.classList.add('filtered'); } + return true; } + return false; + }; + } - document.querySelector('.filter-status').textContent = (document.querySelectorAll('tbody > tr > td > div.thetitle, #browse-script-list > li').length - numFiltered) + ' scripts (' + numFiltered + ' filtered)'; - } + insertStyle(); + insertStatus(); + filterScripts(); + insertSwitches(); - function insertSwitches() { - var span = document.createElement('span'); - span.className = 'filter-switches'; - for(var filter in filters) { - if(filters.hasOwnProperty(filter)) { - span.appendChild(createSwitch(filter, GM_getValue(filter, 'on') == 'on')); - } - } - document.querySelector('.filter-status').parentNode.appendChild(span); - } - function createSwitch(label, isOn) { - var a = document.createElement('a'); - a.className = isOn ? 'filter-on' : 'filter-off'; - a.textContent = label; - a.addEventListener('click', function(e) { - if(this.className == 'filter-on') { - this.className = 'filter-off'; - GM_setValue(this.textContent, 'off'); - } else { - this.className = 'filter-on'; - GM_setValue(this.textContent, 'on'); + if (!isOnForum){ + + const target = document.querySelector('#script-table > tbody:nth-child(2)'); + const observer = new MutationObserver((mutations) => { + insertStyle(); + if (!document.querySelector('.filter-status')){ + insertStatus(); } filterScripts(); - e.preventDefault(); - }, false); - return a; - } - - function my_GM_setValue(name, value) { - localStorage.setItem(name, value); - } - - function my_GM_getValue(name, defaultValue) { - var value; - if (!(value = localStorage.getItem(name))) { - return defaultValue; - } - return value; - } - - })(); - - -} else { - + if (!document.querySelector('.filter-switches')){ + insertSwitches(); + } + }), + config = { + childList: true, + subtree: true, + }; + observer.observe(target, config); - (function() { - var filters = { - 'Non-ASCII':/[^\x00-\x7F\s]+/i, - 'Games': /AntiGame|Agar|agar\.io|alis\.io|angel\.io|ExtencionRipXChetoMalo|AposBot|DFxLite|ZTx-Lite|AposFeedingBot|AposLoader|Blah Blah|Orc Clan Script|Astro\s*Empires|^\s*Attack|^\s*Battle|BiteFight|Blood\s*Wars|Bots|Bots4|Brawler|\bBvS\b|Business\s*Tycoon|Castle\s*Age|City\s*Ville|chopcoin\.io|Comunio|Conquer\s*Club|CosmoPulse|cursors\.io|Dark\s*Orbit|Dead\s*Frontier|Diep\.io|\bDOA\b|doblons\.io|DotD|Dossergame|Dragons\s*of\s*Atlantis|driftin\.io|Dugout|\bDS[a-z]+\n|elites\.io|Empire\s*Board|eRep(ublik)?|Epic.*War|ExoPlanet|Falcon Tools|Feuerwache|Farming|FarmVille|Fightinfo|Frontier\s*Ville|Ghost\s*Trapper|Gladiatus|Goalline|Gondal|gota\.io|Grepolis|Hobopolis|\bhwm(\b|_)|Ikariam|\bIT2\b|Jellyneo|Kapi\s*Hospital|Kings\s*Age|Kingdoms?\s*of|knastv(ö|oe)gel|Knight\s*Fight|\b(Power)?KoC(Atta?ck)?\b|\bKOL\b|Kongregate|Last\s*Emperor|Legends?\s*of|Light\s*Rising|lite\.ext\.io|Lockerz|\bLoU\b|Mafia\s*(Wars|Mofo)|Menelgame|Mob\s*Wars|Mouse\s*Hunt|Molehill\s*Empire|NeoQuest|MyFreeFarm|narwhale\.io|Neopets|Nemexia|\bOGame\b|Ogar(io)?|Pardus|Pennergame|Pigskin\s*Empire|PlayerScripts|pokeradar\.io|Popmundo|Po?we?r\s*(Bot|Tools)|PsicoTSI|Ravenwood|Schulterglatze|slither\.io|slitherplus\.io|slitheriogameplay|SpaceWars|splix\.io|\bSW_[a-z]+\n|\bSnP\b|The\s*Crims|The\s*West|torto\.io|Travian|Treasure\s*Isl(and|e)|Tribal\s*Wars|TW.?PRO|Vampire\s*Wars|vertix\.io|War\s*of\s*Ninja|West\s*Wars|wings\.io|\bWoD\b|World\s*of\s*Dungeons|wtf\s*battles|Wurzelimperium/i, - 'Social Networks': /Face\s*book|Google(\+| Plus)|\bHabbo|Kaskus|\bLepra|Leprosorium|MySpace|meinVZ|odnoklassniki|Одноклассники|Orkut|sch(ue|ü)ler(VZ|\.cc)?|studiVZ|Unfriend|Valenth|VK|vkontakte|ВКонтакте|Qzone|Twitter|TweetDeck/i, - 'Clutter':/^\s*(.{1,3})\1+\n|^\s*(.+?)\n+\2\n*$|^\s*.{1,5}\n|do\s*n('|o)?t (install|download)|nicht installieren|just(\s*a)?\s*test|^\s*.{0,4}test.{0,4}\n|\ntest(ing)?\s*|^\s*(\{@|Smolka|Hacks)|\[\d{4,5}\]|free\s*download/i - }; - if(typeof GM_getValue == 'undefined' || (typeof GM_getValue.toString == 'function' && GM_getValue.toString().indexOf('not supported') > -1)) { - GM_getValue = my_GM_getValue; - GM_setValue = my_GM_setValue; - } + } - insertStyle(); - insertStatus(); - filterScripts(); - insertSwitches(); - // Note: you may uncomment line 37-81 and comment out line 36, in order the filtered scripts to be highlighted red -instead of hiding them- so that you can check which scripts have been filtered - function insertStyle() { - var style = document.createElement('style'); - // style.textContent = '.ItemDiscussion.filtered {background-color:khaki !important;} .filter-status {margin-left:6px; position:fixed; top:calc(0%); left:calc(13.5%)} .filter-switches {display:none; position:fixed; top:calc(2.5%); left:calc(14%)} *:hover > .filter-switches {display:block !important; position:fixed; top:calc(2.5%); left:calc(14%)} .filter-on,.filter-off {display:block !important; width:105px}} .filter-switches a {text-decoration:none !important; color:inherit; cursor:pointer} .filter-switches a {margin-left:8px; padding:0 4px} a.filter-on {background-color:#ff6161; color:#333333; text-decoration:line-through !important} a.filter-off {background-color:#97ca97;color:#333333; '; - style.textContent = ` .ItemDiscussion.filtered { - display: none !important; - } - .filter-status { - margin-left: 6px; - position: fixed; - top: calc(0%); - left: calc(13.5%); - } - .filter-switches { - display: none; - position: fixed; - top: calc(2.5%); - left: calc(14%); - } - *:hover > .filter-switches { - display: block !important; - position: fixed; - top: calc(2.5%); - left: calc(14%); - } - .filter-on, - .filter-off { - display: block !important; - width: 105px; - } - } - .filter-switches a { - text-decoration: none !important; - color: inherit; - cursor: pointer; - } - .filter-switches a { - margin-left: 8px; - padding: 0 4px; - } - a.filter-on { - background-color: #ea6e6e; - color: #333333; - text-decoration: line-through !important - } - a.filter-off { - background-color: #6da46b; - color: #333333; - }`; - style.type = 'text/css'; - document.querySelector('head').appendChild(style); - } + function insertStyle() { + const style = document.createElement('style'); + style.textContent = DEBUGGING ? site.cssDebug : site.css; + style.type = 'text/css'; + document.head.appendChild(style); + } - function insertStatus() { - var p = document.querySelector('#Head'); - if(p) { - var status = document.createElement('span'); - status.className = 'filter-status'; - p.appendChild(status); - } + function insertStatus() { + const p = document.querySelector(site.filterStatusLocation); + if (p) { + const status = document.createElement('span'); + status.className = 'filter-status'; + p.appendChild(status); } + } - function filterScripts() { - var activeFilters = []; - for(var filter in filters) { - if(filters.hasOwnProperty(filter) && GM_getValue(filter, 'on') == 'on') { - activeFilters.push(filters[filter]); - } - } - var nodes = document.querySelectorAll('.ItemDiscussion'), - numActiveFilters = activeFilters.length, - numFiltered = 0; - for(var i = 0, numNodes = nodes.length, td = null; i < numNodes && (td = nodes[i]); i++) { - td.classList.remove('filtered'); - for(var j = 0; j < numActiveFilters; j++) { - var temp = td.children[1].firstElementChild.innerText; - if(temp.match(activeFilters[j])) { - td.classList.add('filtered'); - numFiltered++; - break; - } - } + function filterScripts() { + const activeFilters = []; + for (let filterType of Object.keys(filters)) { + if (configGetValue(filterType, 'on') === 'on') { + activeFilters.push(filters[filterType]); } - - document.querySelector('.filter-status').innerText = (document.querySelectorAll('.ItemDiscussion').length - numFiltered) + ' discussions (' + numFiltered + ' filtered)'; } - - - - function insertSwitches() { - var span = document.createElement('span'); - span.className = 'filter-switches'; - for(var filter in filters) { - if(filters.hasOwnProperty(filter)) { - span.appendChild(createSwitch(filter, GM_getValue(filter, 'on') == 'on')); + const nodes = document.querySelectorAll(site.itemsToCheck); + let numFiltered = 0; + for (let node of nodes) { + site.removeFilter(node); + for (let activeFilter of activeFilters) { + let filtered = site.applyFilter(node, activeFilter); + if (filtered) { + numFiltered++; + break; } } - document.querySelector('.filter-status').parentNode.appendChild(span); } - - function createSwitch(label, isOn) { - var a = document.createElement('a'); - a.className = isOn ? 'filter-on' : 'filter-off'; - a.textContent = label; - a.addEventListener('click', function(e) { - if(this.className == 'filter-on') { - this.className = 'filter-off'; - GM_setValue(this.textContent, 'off'); - } else { - this.className = 'filter-on'; - GM_setValue(this.textContent, 'on'); - } - filterScripts(); - e.preventDefault(); - }, false); - return a; - } - - function my_GM_setValue(name, value) { - localStorage.setItem(name, value); - } - - function my_GM_getValue(name, defaultValue) { - var value; - if (!(value = localStorage.getItem(name))) { - return defaultValue; + const filterStatus = document.querySelector('.filter-status'); + if (filterStatus) { + const numUnfiltered = document.querySelectorAll(site.itemsToCheck).length - numFiltered; + filterStatus.textContent = `${numUnfiltered} ${site.itemType} (${numFiltered} filtered)`; + } + } + + function insertSwitches() { + const span = document.createElement('span'); + span.className = 'filter-switches'; + for (let filterType of Object.keys(filters)) { + span.appendChild(createSwitch(filterType, configGetValue(filterType, 'on') === 'on')); + } + const filterStatus = document.querySelector('.filter-status'); + if (filterStatus) { + filterStatus.parentNode.appendChild(span); + } + } + + function createSwitch(label, isOn) { + const a = document.createElement('a'); + a.className = isOn ? 'filter-on' : 'filter-off'; + a.textContent = label; + a.addEventListener('click', function(e) { + if (this.className === 'filter-on') { + this.className = 'filter-off'; + configSetValue(this.textContent, 'off'); + } else { + this.className = 'filter-on'; + configSetValue(this.textContent, 'on'); } - return value; - } + filterScripts(); + e.preventDefault(); + }, false); + return a; + } - })(); + function configSetValue(name, value) { + localStorage.setItem(name, value); + } + function configGetValue(name, defaultValue) { + const value = localStorage.getItem(name); + return value ? value : defaultValue; + } -} +})(); diff --git a/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork/README.md b/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork/README.md index 88ad243..bce16a8 100644 --- a/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork/README.md +++ b/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork/README.md @@ -3,7 +3,7 @@ i.e. it filters any/all of these 4 categories: * **Games**: scripts for browser games like Kingdoms of Camelot, Mafia Wars and Ikariam * **Social Networks**: scripts for general purpose social networking sites like Facebook, studiVZ and VKontakte * **Non-ASCII**: scripts that use non-English characters in description (accents, umlauts, cyrillic letters, ...) -* **Clutter**: obvious spam, titles like "asdasdasd", description = title, title < 6 characters, "just a test". +* **Clutter**: obvious spam, titles like "asdasdasd", description = title, title < 6 characters, "just a test", scripts for themes/dark/night mode (because they are, in effect, userstyles). It's the same as [GreasyFork Bullshit Filter](https://greasyfork.org/en/scripts/12179-greasyfork-bull-filter,) now compatible with [TS] Citrus GFork. @@ -14,4 +14,5 @@ Note: you may comment out #49 and uncomment #50 in order to change position of t This is a modified version of this script: [userscripts.org Bullshit Filter](http://userscripts-mirror.org/scripts/show/97145) (by kuehlschrank). -Thanks a lot to kuehlschrank for making another great script. \ No newline at end of file +Thanks a lot to kuehlschrank for making another great script. +Thanks a lot to valacar for [the refactoring](https://greasyfork.org/en/forum/discussion/42803/refactored). diff --git a/IMDb_user_reviews_pages_-_ten_star_ratings/IMDb_user_reviews_pages_-_ten_star_ratings.user.js b/IMDb_user_reviews_pages_-_ten_star_ratings/IMDb_user_reviews_pages_-_ten_star_ratings.user.js new file mode 100644 index 0000000..72af65b --- /dev/null +++ b/IMDb_user_reviews_pages_-_ten_star_ratings/IMDb_user_reviews_pages_-_ten_star_ratings.user.js @@ -0,0 +1,87 @@ +// ==UserScript== +// @name IMDb user reviews pages - ten star ratings +// @namespace darkred +// @version 2018.4.30 +// @description In IMDb user reviews pages, display the ratings with 10 stars, instead of just 1 +// @author darkred +// @license MIT +// @match https://www.imdb.com/title/*/reviews* +// @grant GM_addStyle +// @supportURL https://github.com/darkred/Userscripts/issues +// ==/UserScript== + + + +// Example: +// rating = 9 +// is displayed as: +// 1 star + 9/10 text +// +// Therefore: (1 existing +) 8 more stars needed +// and, if element is larger than 9, i.e. >9, i.e. 10th then blacken it + + +const fillColor = ['#e8e7e7', '#e6e5e5']; // default (almost white --> a bit darker) +// const fillColor = ['#2b2b2b', '#2f2f2f']; // for use with a dark style + + + +function addStars(){ + + let stars = document.querySelectorAll('.ipl-star-icon'); + + for (let i = 0; i < stars.length; i++) { + + if (stars[i].parentNode.children.length !== 12) { // if not already 10-star (+ 2 elements) + + let rating = Number(stars[i].nextElementSibling.textContent); + for (let j = 0; j < 9; j++) { // 9 more stars to each line + let clone = stars[i].cloneNode(true); + stars[i].parentNode.insertBefore(clone, stars[i].nextSibling); // https://stackoverflow.com/questions/11117519/inserting-a-clone-after-the-original + + } + + + for (let j = 0; j < 10; j++) { + + if (j > rating-1 ) { + if (i % 2 === 0){ // https://stackoverflow.com/a/12984254 (odd/even iterations of the loop) + stars[i].parentNode.children[j].children[1].setAttribute('style', 'fill:' + fillColor[0] + ';'); // for use with this style: https://userstyles.org/styles/98447/imdb-com-nightmode ---> OK + } else { + stars[i].parentNode.children[j].children[1].setAttribute('style', 'fill:' + fillColor[1] + ';'); // for use with this style: https://userstyles.org/styles/98447/imdb-com-nightmode ---> OK + } + } + + + } + } + + } + +} + +let CSS = ` + svg.ipl-star-icon { + height: 18px; + width: 18px; + vertical-align: middle !important; + } +`; +GM_addStyle(CSS); + + + +addStars(); + + + + +var observer = new MutationObserver(function() { + addStars(); +}).observe(document.querySelector('div.lister-list'), // target of the observer: the "pics" area element, with rows that contain 3 pics each (watching for 'row' element additions) + { + // attributes: true, + childList: true, + // characterData: true, + // subtree: true, + }); // config of the observer \ No newline at end of file diff --git a/IMDb_user_reviews_pages_-_ten_star_ratings/README.md b/IMDb_user_reviews_pages_-_ten_star_ratings/README.md new file mode 100644 index 0000000..e24429d --- /dev/null +++ b/IMDb_user_reviews_pages_-_ten_star_ratings/README.md @@ -0,0 +1,12 @@ +This userscript applies to IMDb user reviews pages. It displays the ratings with 10 stars, instead of just 1. +_It also works when you click the 'Load More' button to view more reviews._ + +Screenshot from e.g. https://www.imdb.com/title/tt0076759/reviews +Intial: +![initial](https://i.imgur.com/ApMIFAK.jpg) + +With the script: +![With the script](https://i.imgur.com/Wl0PKtQ.jpg) + +Note: if you use this style: [IMDb.com - Nightmode](https://userstyles.org/styles/98447/imdb-com-nightmode) (like me) then comment out line 22 and uncomment line 29, +in order the extra stars to be almost-black (instead of almost-white). diff --git a/Instagram_-_visible_images_counter/Instagram_-_visible_images_counter.user.js b/Instagram_-_visible_images_counter/Instagram_-_visible_images_counter.user.js index 5ab321f..3c5be12 100644 --- a/Instagram_-_visible_images_counter/Instagram_-_visible_images_counter.user.js +++ b/Instagram_-_visible_images_counter/Instagram_-_visible_images_counter.user.js @@ -1,26 +1,38 @@ -// ==UserScript== +// ==UserScript== // @name Instagram - visible images counter // @namespace darkred +// @version 2024.2.23 +// @description Shows in instagram profile pages how many images out of total (as a number and as a percentage) are currently visible, as you scroll down the page. +// @author darkred // @license MIT -// @description Shows (in instagram profile pages) how many images out of total (as a number and as a percentage) are currently visible, as you scroll down the page -// @version 2017.11.5 // @include https://www.instagram.com/* -// @grant GM_addStyle +// @grant none // @require https://code.jquery.com/jquery-3.2.1.min.js -// @require https://greasyfork.org/scripts/21927-arrive-js/code/arrivejs.js?version=139586 +// @require https://greasyfork.org/scripts/21927-arrive-js/code/arrivejs.js +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== +/* eslint-disable no-console */ -GM_addStyle(` - -.counter { - color: #D9D9D9 !important; - } +const escapeHTMLPolicy = (({ trustedTypes }, policy) => + trustedTypes + ? trustedTypes.createPolicy('myEscapePolicy', policy) + : policy)(window, { + createHTML: (str) => str, +}); -`); +var stylesheet = +``; +$('head').append(stylesheet); +// Not needed anymore +/* // If you scroll down, beyond the first 12 images, then the "LOAD MORE" button(to show more images) will be automatically clicked $(window).scroll(function() { if ($(window).scrollTop() + $(window).height() > $(document).height() - 100) { @@ -28,28 +40,51 @@ $(window).scroll(function() { element.click(); } }); +*/ - +var hrefselems = []; +var hrefs = []; +var total; function showCounter() { - var visibleCount = $( `a[href*='taken-by']` ).length; // Count of visible images - var totalString = $(`span:contains('posts')`).eq(1).children().eq(0).html(); // The 'total' value (it's a string) - var total = totalString.replace(/(\d+),(?=\d{3}(\D|$))/g, '$1'); // Apply regex to 'total' string to strip the thousand comma seperator - if (visibleCount > total){ - visibleCount = total; + + // var totalString = $(`span:contains('posts'):last-child > span, .g47SY`).html(); // The 'total' value (it's a string). The ".g47SY" selector is for localized pages, e.g. https://www.instagram.com/instagram/?hl=de + // var totalString = document.querySelector(`#react-root > section > main > div > header > section > ul > li:nth-child(1) > * > span`).textContent; // The 'total' value (it's a string). The ".g47SY" selector is for localized pages, e.g. https://www.instagram.com/instagram/?hl=de + var totalString = document.querySelector(`[id^=mount_0_0_] section > main > div > header > section > ul > li:nth-child(1) > * > span`).textContent; // The 'total' value (it's a string). The ".g47SY" selector is for localized pages, e.g. https://www.instagram.com/instagram/?hl=de + total = totalString.replace(',', '').replace('.', ''); // strip the thousand comma/dot seperator + + + // hrefselems = document.querySelectorAll(`a[href*='taken-by']`); + // hrefselems = document.querySelectorAll(`._aabd._aa8k._aanf > a`); + // hrefselems = document.querySelectorAll(`._aabd._aa8k._al3l > a`); + hrefselems = document.querySelectorAll(`._aabd._aa8k.x2pgyrj > a`); + $.each(hrefselems, function(index, value) { + // hrefs.indexOf(String(value)) === -1 ? hrefs.push(String(value)) : console.log("This item already exists"); // https://stackoverflow.com/a/36683363 + if (hrefs.indexOf(String(value)) === -1) { // hrefs.count -below- serves as a counter for the newly added displayed images (on each infinite scrolling event) + hrefs.push(String(value)); + } + }); + + var visibleCount = hrefs.length; + + var visiblePercent = ((visibleCount / total) * 100).toFixed(1); // Visible images count as percentage + if (isNaN(visiblePercent)) { + visiblePercent = 0 ; // avoid NaN } - var visiblePercent = ((visibleCount / total) * 100).toFixed(1); // Visible images as percentage + var counter = visibleCount + ' / ' + totalString + ' that is ' + visiblePercent + '%'; return counter; + } -function createDiv(){ +function createDiv() { // Creation of the counter element document.body.appendChild(div); - div.innerHTML = showCounter(); // Initial display of the counter + // div.innerHTML = showCounter(); // Initial display of the counter + div.innerHTML = escapeHTMLPolicy.createHTML(showCounter()); // Initial display of the counter div.style.top = '1px'; div.style.right = '1px'; div.style.position = 'fixed'; @@ -58,20 +93,33 @@ function createDiv(){ -function observer(){ +function createObserver() { + + // var thePics = document.querySelector('div[style="flex-direction: column; padding-bottom: 0px; padding-top: 0px;"]'); + var thePics = document.querySelector('div[style*="flex-direction: column;"], div[style$="padding-top: 0px;"]'); // the "pics" area element, with rows that contain 3 pics each (watching for 'row' element additions) --> https://stackoverflow.com/a/5110337 ("wildcard * in CSS") starting (^=) with x and ending ($=) with y + if (!thePics){ + return; + } + hrefselems.length = 0; // empty the array (see https://stackoverflow.com/a/1232046, method #2) + hrefs.length = 0; /// --------------------------------- /// mutation observer -monitors the Posts grid for infinite scrolling event-. /// --------------------------------- - observer1 = new MutationObserver(function(mutations) { - mutations.forEach(function(mutation) { - div.innerHTML = showCounter(); // In each infinite scrolling event, re-calculate counter - }); - }).observe($('article').children().eq(1).children()[0], // target of the observer - { - // attributes: true, + observer = new MutationObserver(function() { // --> Callback function to execute when mutations are observed + if (div.innerHTML.indexOf(total + ' / ' + total) === -1) { + // div.innerHTML = showCounter(); // On each infinite scrolling event, re-calculate counter + div.innerHTML = escapeHTMLPolicy.createHTML(showCounter()); // On each infinite scrolling event, re-calculate counter + } + // }).observe(document.querySelector('._havey'), // target of the observer: the "pics" area element, with rows that contain 3 pics each (watching for 'row' element additions) + // }).observe(document.querySelector('div[style="flex-direction: column; padding-bottom: 0px; padding-top: 0px;"]'), // target of the observer: the "pics" area element, with rows that contain 3 pics each (watching for 'row' element additions) + }); + + observer.observe(thePics, // target of the observer + { // attributes: true, childList: true, // characterData: true, + // subtree: true, }); // config of the observer } @@ -81,27 +129,88 @@ function observer(){ -var div = document.createElement('div'); // global variable -var observer1; // global variable +var div = document.createElement('div'); +var observer; + +// var avatarSelector = 'span[style="width: 152px; height: 152px;"]'; // the profile's photo/avatar element +// var avatarSelector = 'main > article > header > section > div._ienqf > div > button'; // the 3-dots icon +// var avatarSelector = 'div[style="flex-direction: column; padding-bottom: 0px; padding-top: 0px;"]'; // the 3-dots icon +// var avatarSelector = '._mainc'; // the profile's bio area element +// var avatarSelector = 'h1.notranslate'; // the profile name element +// var avatarSelector = 'h1.rhpdm'; // the profile name element +// var avatarSelector = 'span.-nal3'; // the 'posts' count element, e.g. 683 posts +// var avatarSelector = 'ul.k9GMp'; // the profile's 3 counters container element +// var avatarSelector = '.eC4Dz'; // the profile's username container element +// var avatarSelector = '._aa_m'; // the profile's username container element +// var avatarSelector = '._aa_c'; // the profile's username container element +// var avatarSelector = 'main > article > header > section > div._ienqf > div > button'; // the 3-dots icon +// var avatarSelector = 'div[style="flex-direction: column; padding-bottom: 0px; padding-top: 0px;"]'; // the 3-dots icon +var avatarSelector = '.x1q0g3np.x2lah0s.x8j4wrb'; // the 3-dots icon -if (document.URL !== 'https://www.instagram.com/' && - document.URL.indexOf('https://www.instagram.com/p/') === -1 ){ - createDiv(); - observer(); -} -$(document).arrive('article._mesn5', function() { // the avatar in the profile page +if (document.querySelector(avatarSelector) ) { + if (!document.querySelector('.counter')){ + createDiv(); + createObserver(); + } +} else { + console.log('ERROR: Cannot create the Counter element, the avatarSelector element ( ' + avatarSelector + ' ) doesn\'t exist !!'); +} + + +document.arrive(avatarSelector, function() { // the avatar in the profile page createDiv(); - observer(); + createObserver(); + // alert() }); -$(document).leave('article._mesn5', function() { - if (!document.querySelector('article._mesn5')) { - div.remove(); - observer1.disconnect(); +function removeCounter(){ + div.remove(); + hrefselems.length = 0; // empty the array (see https://stackoverflow.com/a/1232046, method #2) + hrefs.length = 0; + total = ''; + observer.disconnect(); + // if (observer) { + // observer.disconnect(); + // } +} + + +document.leave(avatarSelector, function() { + if (!document.querySelector(avatarSelector)){ + removeCounter(); } }); + + +// when navigating using the browser's back/forth +window.addEventListener('popstate', function () { + // alert() + removeCounter(); + console.log('COUNTER IS REMOVED'); + + // TODO + // createDiv(); + // createObserver(); + +}); + + +// when navigating from a profile to another via searchbox // history API) +// https://stackoverflow.com/questions/56760727/how-to-observe-a-change-in-the-url-using-javascript +(function(){ + var rs = history.pushState; + history.pushState = function(state, title, url){ + if ( !url.includes('/following/') && !url.includes('/followers/') && !url.includes('/p/') && !url.includes('/direct/') && !window.location.href.includes('/p/') ){ // avoid all possible in-page/popup "pages" (a profile's following/followers, and posts -opened by clicking on a thumb-) + rs.apply(history, arguments); // preserve normal functionality + console.log('navigating', arguments); // do something extra here; raise an event + removeCounter(); + // alert() + } + }; +}()); + diff --git a/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup.user.js b/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup.user.js index b1319cf..4e57692 100644 --- a/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup.user.js +++ b/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup.user.js @@ -1,11 +1,13 @@ -// ==UserScript== +// ==UserScript== // @name KAT - add APPROVE ALL and APPROVE SELECTED buttons to Feedback popup // @namespace darkred +// @version 2015.12.30 +// @description Adds 'APPROVE ALL' and 'APPROVE SELECTED' buttons inside the 'Torrents awaiting feedback' popup // @author darkred +// @license MIT // @include https://kat.cr/* -// @description Adds 'APPROVE ALL' and 'APPROVE SELECTED' buttons inside the 'Torrents awaiting feedback' popup -// @version 2015.12.30 // @grant none +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== @@ -13,21 +15,21 @@ function approveAll() { - var x = document.getElementsByClassName('ka-thumbs-up'); - for (var i = 2; i < x.length; i++) { - x[i].click(); - } + var x = document.getElementsByClassName('ka-thumbs-up'); + for (var i = 2; i < x.length; i++) { + x[i].click(); + } } function approveSelected() { - var x = document.getElementsByClassName('torrentboxes'); - var y = document.querySelectorAll("table > tbody > tr > td > div > form > div > a > i.ka-thumbs-up "); - for (var i = 0; i < x.length; i++) { + var x = document.getElementsByClassName('torrentboxes'); + var y = document.querySelectorAll('table > tbody > tr > td > div > form > div > a > i.ka-thumbs-up '); + for (var i = 0; i < x.length; i++) { if (x[i].checked){ - y[i].click(); + y[i].click(); } - } + } } @@ -38,72 +40,72 @@ function approveSelected() { document.querySelector('.showFeedback > a').addEventListener('click', function() { - new MutationObserver(function(mutations, observer) { - if (document.querySelector('#fancybox-wrap') ) { - observer.disconnect(); - console.log('TRUE'); + new MutationObserver(function(mutations, observer) { + if (document.querySelector('#fancybox-wrap') ) { + observer.disconnect(); + console.log('TRUE'); - // add button "APPROVE SELECTED" - var parentElement = document.querySelector('div.buttonsline:nth-child(10)'); - var theFirstChild = parentElement.firstChild; - var button1 = document.createElement('BUTTON'); - parentElement.insertBefore(button1, theFirstChild); - button1.id = 'mybutton1'; - button1.innerHTML = 'APPROVE SELECTED'; - button1.className = 'siteButton bigButton'; + // add button "APPROVE SELECTED" + var parentElement = document.querySelector('div.buttonsline:nth-child(10)'); + var theFirstChild = parentElement.firstChild; + var button1 = document.createElement('BUTTON'); + parentElement.insertBefore(button1, theFirstChild); + button1.id = 'mybutton1'; + button1.innerHTML = 'APPROVE SELECTED'; + button1.className = 'siteButton bigButton'; - button1.addEventListener('click', function() { - approveSelected(); - // document.querySelector('#fancybox-close').click(); // uncomment this line to also close the popup after approving all torrents. - }); + button1.addEventListener('click', function() { + approveSelected(); + // document.querySelector('#fancybox-close').click(); // uncomment this line to also close the popup after approving all torrents. + }); - // add button "APPROVE ALL" - parentElement = document.querySelector('div.buttonsline:nth-child(10)'); - theFirstChild = parentElement.firstChild; - var button2 = document.createElement('BUTTON'); - parentElement.insertBefore(button2, theFirstChild); - button2.id = 'mybutton2'; - button2.innerHTML = 'APPROVE ALL'; - button2.className = 'siteButton bigButton'; - button2.style = 'margin-right: 4px'; + // add button "APPROVE ALL" + parentElement = document.querySelector('div.buttonsline:nth-child(10)'); + theFirstChild = parentElement.firstChild; + var button2 = document.createElement('BUTTON'); + parentElement.insertBefore(button2, theFirstChild); + button2.id = 'mybutton2'; + button2.innerHTML = 'APPROVE ALL'; + button2.className = 'siteButton bigButton'; + button2.style = 'margin-right: 4px'; - button2.addEventListener('click', function() { - approveAll(); - document.querySelector('#fancybox-close').click(); // uncomment this line to also close the popup after approving all torrents. - }); + button2.addEventListener('click', function() { + approveAll(); + document.querySelector('#fancybox-close').click(); // uncomment this line to also close the popup after approving all torrents. + }); - // add button "DISCARD ALL" - parentElement = document.querySelector('button.siteButton:nth-child(3)'); - theFirstChild = parentElement.firstChild; - var button3 = document.createElement('BUTTON'); - parentElement.parentNode.insertBefore(button3, theFirstChild.nextSibling); - button3.id = 'mybutton3'; - button3.innerHTML = 'DISCARD ALL'; - button3.className = 'siteButton bigButton'; + // add button "DISCARD ALL" + parentElement = document.querySelector('button.siteButton:nth-child(3)'); + theFirstChild = parentElement.firstChild; + var button3 = document.createElement('BUTTON'); + parentElement.parentNode.insertBefore(button3, theFirstChild.nextSibling); + button3.id = 'mybutton3'; + button3.innerHTML = 'DISCARD ALL'; + button3.className = 'siteButton bigButton'; - button3.addEventListener('click', function() { - document.querySelector('th.lasttd:nth-child(1) > input:nth-child(1)').click(); - document.querySelector('button.siteButton:nth-child(3)').click(); - // document.querySelector('#fancybox-close').click(); // uncomment this line to also close the popup after approving all torrents. - }); + button3.addEventListener('click', function() { + document.querySelector('th.lasttd:nth-child(1) > input:nth-child(1)').click(); + document.querySelector('button.siteButton:nth-child(3)').click(); + // document.querySelector('#fancybox-close').click(); // uncomment this line to also close the popup after approving all torrents. + }); - } - }).observe( - document.querySelector('#fancybox-wrap'), { - attributes: true, - attributeFilter: ['style'], - } - ); + } + }).observe( + document.querySelector('#fancybox-wrap'), { + attributes: true, + attributeFilter: ['style'], + } + ); diff --git a/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup/README.md b/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup/README.md index 351db6c..2d7111f 100644 --- a/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup/README.md +++ b/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup/README.md @@ -5,5 +5,4 @@ _(by default it only has `DISCARD SELECTED`)_ _Note: You may uncomment lines 59, 76 and/or 94 to also close the popup after approving all/selected torrents._ -
Thanks to wOxxOm for his help in [here](http://stackoverflow.com/questions/34072802/insertbefore-enclosed-in-addeventlistener-click-and-called-via-mutationobserv). \ No newline at end of file diff --git a/Markdown_toolbar_for_GreasyFork/66x40-solid.png b/Markdown_toolbar_for_GreasyFork/66x40-solid.png new file mode 100644 index 0000000..579b9e0 Binary files /dev/null and b/Markdown_toolbar_for_GreasyFork/66x40-solid.png differ diff --git a/Markdown_toolbar_for_GreasyFork/Markdown_toolbar_for_GreasyFork.user.js b/Markdown_toolbar_for_GreasyFork/Markdown_toolbar_for_GreasyFork.user.js new file mode 100644 index 0000000..e8b43ac --- /dev/null +++ b/Markdown_toolbar_for_GreasyFork/Markdown_toolbar_for_GreasyFork.user.js @@ -0,0 +1,352 @@ +// ==UserScript== +// @name Markdown toolbar for GreasyFork +// @name:ru Markdown-тулбар для GreasyFork +// @name:zh-CN GreasyFork markdown +// @namespace darkred +// @version 2.0.4 +// @description Select Markdown format by default, add help links, add toolbar formatting buttons for markdown +// @description:ru Включает формат Markdown по умолчанию, добавляет справочные ссылки по форматам, добавляет панель кнопок форматирования markdown +// @description:zh-CN 在论坛默认使用 Markdown 格式,添加格式帮助链接及 Markdown 工具栏 +// @author wOxxOm, darkred +// @contributor JixunMoe +// @license MIT +// @icon https://raw.githubusercontent.com/dcurtis/markdown-mark/master/png/66x40-solid.png +// @include https://greasyfork.org/*discussions/* +// @include https://greasyfork.org/*scripts/*/versions/new* +// @include https://greasyfork.org/*scripts/*/feedback* +// @include https://greasyfork.org/*script_versions/new* +// @include https://greasyfork.org/*/conversations/* +// @include https://greasyfork.org/*/users/edit +// @grant GM_addStyle +// @run-at document-start +// @supportURL https://github.com/darkred/Userscripts/issues +// ==/UserScript== + + +// Example URLS to test: +// https://greasyfork.org/en/discussions/new +// https://greasyfork.org/en/scripts/422887-markdown-toolbar-for-greasyfork/discussions/78139 +// https://greasyfork.org/en/scripts/23493/versions/new +// https://greasyfork.org/en/scripts/422445-github-watcher/feedback +// https://greasyfork.org/en/users/2160-darkred/conversations/new +// https://greasyfork.org/en/users/edit + + + + + +var inForum = location.href.indexOf('/discussions') > 0; +var inPostNewScriptVer = location.href.indexOf('/versions/new') > 0; + + +// Native $("selector:contains('text')"); https://github.com/nefe/You-Dont-Need-jQuery#1.12 +function contains(selector, text) { + var elements = document.querySelectorAll(selector); + return Array.from(elements).filter(function(element) { + return RegExp(text).test(element.textContent); + }); +} + + +window.addEventListener('DOMContentLoaded', function(e) { + + // var refElements = contains('.label-note', '(See allowed code)' ); + var refElements = document.querySelectorAll(` + input[name="authenticity_token"] + .label-note, + + label[for="script-version-additional-info-0"] + .label-note, + label[for="changelog"] + .label-note, + + label[for="conversation_messages_attributes_0_content"] + .label-note, + + label[for="user_profile"] + .label-note, + + form > .label-note + `); + + if (inForum){ + + refElements.forEach(element => {element.insertAdjacentHTML('beforeend','
'); addFeatures(element); }); + + } + else { // not in Forum + + // This page has 2 non-code textareas: 'Additional info' and 'Changelog' + if (inPostNewScriptVer) { + + refElements.forEach(element => { addFeatures(element.appendChild(document.createElement('br'))); }); + + } else { // every other page + + + if (nn = document.querySelectorAll('input[value="markdown"]')) { + for (var n, i=0; (i?' ; + n.insertAdjacentHTML('beforeend', + ' (?)'); + // if (location.href.indexOf('/forum/messages/') > -1) + if (location.href.indexOf('/conversations/') > -1) + GM_addStyle('#ConversationForm label { display:inline-block; margin-right:2ex }\ + #ConversationForm .TextBox { margin-top:0 }'); +*/ +// ------------------------------------------------------------------ + + + GM_addStyle('\ + .Button {\ + display: inline-block;\ + cursor: pointer;\ + margin: 0px;\ + font-size: 12px;\ + line-height: 1;\ + font-weight: bold;\ + padding: 4px 6px;\ + background: -moz-linear-gradient(center bottom , #CCC 0%, #FAFAFA 100%) repeat scroll 0% 0% #F8F8F8;\ + border: 1px solid #999;\ + border-radius: 2px;\ + white-space: nowrap;\ + text-shadow: 0px 1px 0px #FFF;\ + box-shadow: 0px 1px 0px #FFF inset, 0px -1px 2px #BBB inset;\ + color: #333;}' + ); + + + + + + + // add buttons + // debugger + btnMake(n, ''+__('B')+'', __('Bold'), '**'); + btnMake(n, ''+__('I')+'', __('Italic'), '*'); + btnMake(n, ''+__('U')+'', __('Underline'), '',''); + btnMake(n, ''+__('S')+'', __('Strikethrough'), '',''); + btnMake(n, '<br>', __('Force line break'), '
','', true); + btnMake(n, '---', __('Horizontal line'), '\n\n---\n\n', '', true); + btnMake(n, __('URL'), __('Add URL to selected text'), + function(e) { + try {edWrapInTag('[', ']('+prompt(__('URL')+':')+')', edInit(e.target))} + catch(ex) {} + }); + btnMake(n, __('Image (https)'), __('Convert selected https://url to inline image'), '!['+__('image')+'](', ')'); + if (inForum) + btnMake(n, __('Table'), __('Insert table template'), __('\n| head1 | head2 |\n|-------|-------|\n| cell1 | cell2 |\n| cell3 | cell4 |\n'), '', true); + btnMake(n, __('Code'), __('Apply CODE markdown to selected text'), + function(e){ + var ed = edInit(e.target); + if (ed.sel.indexOf('\n') < 0) + edWrapInTag('`', '`', ed); + else + edWrapInTag(((ed.sel1==0) || (ed.text.charAt(ed.sel1-1) == '\n') ? '' : '\n') + '```' + (ed.sel.charAt(0) == '\n' ? '' : '\n'), + (ed.sel.substr(-1) == '\n' ? '' : '\n') + '```' + (ed.text.substr(ed.sel2,1) == '\n' ? '' : '\n'), + ed); + }); + + + + + + var allPreviewTabs = contains('.preview-tab', 'Preview' ); + allPreviewTabs.forEach(element => { element.onclick = function(event) { + let target = event.target; // delegation: where was the click? + if (target.tagName !== 'A' && target.tagName !== 'SPAN') {return} + // console.log(element.closest('.label-note') ) + form.querySelectorAll('.Button').forEach(element2 => element2.style.display = 'none'); + } } ); + + var allWriteTabs = contains('.write-tab', 'Write' ); + allWriteTabs.forEach(element => { element.onclick = function(event) { + let target = event.target; // where was the click? + if (target.tagName !== 'A' && target.tagName !== 'SPAN') {return} + form.querySelectorAll('.Button').forEach(element2 => element2.style.display = 'inline-block'); + } }); + + + + + +} + + + + +function btnMake(afterNode, label, title, tag1_or_cb, tag2, noWrap) { + var a = document.createElement('a'); + a.className = 'Button'; + a.innerHTML = label; + a.title = title; + // if (inForum) + // a.style.setProperty('float','right'); + a.addEventListener('click', + typeof(tag1_or_cb) == 'function' ? tag1_or_cb : // if + noWrap ? function(e){edInsertText(tag1_or_cb, edInit(e.target))} : // else if + function(e){edWrapInTag(tag1_or_cb, tag2, edInit(e.target))} // else + ); + + + var nparent; + inForum ? nparent = afterNode : nparent = afterNode.parentNode; + a.textAreaNode = nparent.textAreaNode || nparent.parentNode.querySelector('textArea');; + nparent.appendChild(a); +} + + + + +function edInit(btn) { + var ed = {node: btn.textAreaNode || btn.parentNode.textAreaNode}; + ed.sel1 = ed.node.selectionStart; + ed.sel2 = ed.node.selectionEnd, + ed.text = ed.node.value; + ed.sel = ed.text.substring(ed.sel1, ed.sel2); + return ed; +} + +function edWrapInTag(tag1, tag2, ed) { + ed.node.value = ed.text.substr(0, ed.sel1) + tag1 + ed.sel + (tag2?tag2:tag1) + ed.text.substr(ed.sel2); + ed.node.setSelectionRange(ed.sel1 + tag1.length, ed.sel1 + tag1.length + ed.sel.length); + ed.node.focus(); +} + +function edInsertText(text, ed) { + ed.node.value = ed.text.substr(0, ed.sel2) + text + ed.text.substr(ed.sel2); + ed.node.setSelectionRange(ed.sel2 + text.length, ed.sel2 + text.length); + ed.node.focus(); +} + +var __ = (function (l, langs) { + var lang = langs[l] || langs[l.replace(/-.+/, '')]; + return lang ? function (text) { return lang[text] || text; } + : function (text) { return text }; // No matching language, fallback to english +})(location.pathname.match(/^\/(.+?)\//)[1], { + // Can be full name, or just the beginning part. + 'zh-CN': { + 'Bold': '粗体', + 'Italic': '斜体', + 'Underline': '下划线', + 'Strikethrough': '删除线', + 'Force line break': '强制换行', + 'Horizontal line': '水平分割线', + 'URL': '链接', + 'Add URL to selected text': '为所选文字添加链接', + 'Image (https)': '图片 (https)', + 'Convert selected https://url to inline image': '将所选地址转换为行内图片', + 'image': '图片描述', // Default image alt value + 'Table': '表格', + 'Insert table template': '插入表格模板', + 'Code': '代码', + 'Apply CODE markdown to selected text': '将选中代码围起来', + + '\n| head1 | head2 |\n|-------|-------|\n| cell1 | cell2 |\n| cell3 | cell4 |\n': + '\n| 表头 1 | 表头 2 |\n|-------|-------|\n| 表格 1 | 表格 2 |\n| 表格 3 | 表格 4 |\n' + }, + 'ru': { + 'B': 'Ж', + 'I': 'К', + 'U': 'Ч', + 'S': 'П', + 'Bold': 'Жирный', + 'Italic': 'Курсив', + 'Underline': 'Подчеркнутый', + 'Strikethrough': 'Перечеркнутый', + 'Force line break': 'Новая строка', + 'Horizontal line': 'Горизонтальная линия', + 'URL': 'ссылка', + 'Add URL to selected text': 'Добавить ссылку к выделенному тексту', + 'Image (https)': 'Картинка (https)', + 'Convert selected https://url to inline image': 'Преобразовать выделенный https:// адрес в картинку', + 'image': 'картинка', // Default image alt value + 'Table': 'Таблица', + 'Insert table template': 'Вставить шаблон таблицы', + 'Code': 'Код', + 'Apply CODE markdown to selected text': 'Пометить выделенный фрагмент как программный код', + + '\n| head1 | head2 |\n|-------|-------|\n| cell1 | cell2 |\n| cell3 | cell4 |\n': + '\n| заголовок1 | заголовок2 |\n|-------|-------|\n| ячейка1 | ячейка2 |\n| ячейка3 | ячейка4 |\n' + }, + 'fr': { + 'B': 'G', + 'I': 'I', + 'U': 'S', + 'S': 'B', + 'Bold': 'Gras', + 'Italic': 'Italique', + 'Underline': 'Souligné', + 'Strikethrough': 'Barré', + 'Force line break': 'Forcer le saut de ligne', + 'Horizontal line': 'Ligne horizontale', + 'URL': 'URL', + 'Add URL to selected text': 'Ajouter URL au texte sélectionné', + 'Image (https)': 'Image (https)', + 'Convert selected https://url to inline image': 'Convertir https://url sélectionnés en images', + 'image': 'image', // Default image alt value + 'Table': 'Tableau', + 'Insert table template': 'Insérer un modèle de table', + 'Code': 'Code', + 'Apply CODE markdown to selected text': 'Appliquer CODE markdown au texte sélectionné', + + '\n| head1 | head2 |\n|-------|-------|\n| cell1 | cell2 |\n| cell3 | cell4 |\n': + '\n| En-tête 1 | En-tête 2 |\n|-------|-------|\n| cellule 1 | cellule 2 |\n| cellule 3 | cellule 4 |\n' + } +}); diff --git a/Markdown_toolbar_for_GreasyFork/README.md b/Markdown_toolbar_for_GreasyFork/README.md new file mode 100644 index 0000000..55a668e --- /dev/null +++ b/Markdown_toolbar_for_GreasyFork/README.md @@ -0,0 +1,29 @@ +The script is a modified version of by wOxxOm, to work with the new GF layout. +Thanks to wOxxOm for offering the initial versions. + +* Common formatting buttons (markdown only) +* (forum) HTML & markdown formatting help links +* CODE markdown button that wraps selected text in \` or \``` if multiple lines are selected. +* MARKDOWN format by default for new comments - also can be set in your profile settings. + +Tested on Chrome/Firefox with Tampermonkey/Violentmonkey *(Greasemonkey is not supported)*. + +Screenshots: + +
+Forum + +![](https://i.imgur.com/lxFoQBs.jpg) ![](https://i.imgur.com/9CLLAzV.jpg) +
+ +
+Publish script | Info + +![](https://i.imgur.com/poPEKZ3.jpg) +
+ +
+Conversations/pm + +![](https://i.imgur.com/VZ4clqQ.jpg) +
\ No newline at end of file diff --git a/Markdown_toolbar_for_reddit.com/Markdown_toolbar_for_redditcom.user.js b/Markdown_toolbar_for_reddit.com/Markdown_toolbar_for_redditcom.user.js index 53da19d..4d9a6ef 100644 --- a/Markdown_toolbar_for_reddit.com/Markdown_toolbar_for_redditcom.user.js +++ b/Markdown_toolbar_for_reddit.com/Markdown_toolbar_for_redditcom.user.js @@ -1,12 +1,14 @@ // ==UserScript== // @name Markdown toolbar for reddit.com // @namespace darkred +// @version 1.4.1 +// @description Creates a Markdown toolbar whenever you make/edit text posts or comments in reddit.com // @author wOxxOm, darkred // @license MIT -// @description Creates a Markdown toolbar whenever you make/edit text posts or comments in reddit.com. -// @version 1.3 // @include https://www.reddit.com/*submit* +// @include https://old.reddit.com/*submit* // @include https://www.reddit.com/*comments* +// @include https://old.reddit.com/*comments* // @grant GM_addStyle // @icon https://raw.githubusercontent.com/dcurtis/markdown-mark/master/png/66x40-solid.png // @@ -14,6 +16,7 @@ // This is a modified version of the script "Markdown toolbar for GreasyFork and UserStyles.org" ()https://greasyfork.org/en/scripts/6779-markdown-toolbar-for-greasyfork-and-userstyles-org) // Thanks a lot to wOxxOm for making that script. // +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== @@ -29,7 +32,7 @@ else { var textareas = document.querySelectorAll('textarea'); // ADD TOOLBAR: TO EDITING YOUR POST, TO 'NEW COMMENT' FORM AND TO EDITING YOUR EXISTING COMMENT(S) - for (i = 0; i < textareas.length - 2; i++) { + for (var i = 0; i < textareas.length; i++) { x = document.querySelectorAll('textarea') [i].parentNode; addFeatures(x); } diff --git a/Metal_Archives_discography_pages_-_Reviews_column_split_and_sortable_tables/Metal_Archives_discography_pages_-_Reviews_column_split_and_sortable_tables.user.js b/Metal_Archives_discography_pages_-_Reviews_column_split_and_sortable_tables/Metal_Archives_discography_pages_-_Reviews_column_split_and_sortable_tables.user.js index 1b6b22d..ea51d4e 100644 --- a/Metal_Archives_discography_pages_-_Reviews_column_split_and_sortable_tables/Metal_Archives_discography_pages_-_Reviews_column_split_and_sortable_tables.user.js +++ b/Metal_Archives_discography_pages_-_Reviews_column_split_and_sortable_tables/Metal_Archives_discography_pages_-_Reviews_column_split_and_sortable_tables.user.js @@ -1,22 +1,26 @@ // ==UserScript== // @name Metal Archives discography pages - Reviews column split and sortable tables // @namespace darkred +// @version 2.1.0 +// @date 2020.9.20 +// @description Splits the Reviews column into Reviews(count) and Ratings and makes the tables in all discography tabs sortable. // @author RobG, Brock Adams, Mottie, darkred // @license MIT -// @description Splits the Reviews column into Reviews(count) and Ratings and makes the tables in all discography tabs sortable. -// @version 2.0.1 -// @date 2017.6.11 // @include /^https?:\/\/www\.metal-archives\.com/bands?/.*$/ -// @grant none -// @require https://greasyfork.org/scripts/12036-mutation-summary/code/Mutation%20Summary.js?version=70722 -// @require https://greasyfork.org/scripts/5844-tablesorter/code/TableSorter.js?version=21758 +// @grant GM_addStyle +// @require https://code.jquery.com/jquery-3.5.1.min.js +// @require https://greasyfork.org/scripts/12036-mutation-summary/code/Mutation%20Summary.js +// @require https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.3/js/jquery.tablesorter.min.js +// @require https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.3/js/jquery.tablesorter.widgets.min.js +// @require https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.3/js/extras/jquery.tablesorter.pager.min.js // -// This userscript uses jQuery (v1.11.1, i.e. that the page itself loads from inside: http://www.metal-archives.com/min/index.php?g=js ), +// This userscript uses jQuery v1.11.1, // the jQuery plugin 'tablesorter' (forked by Rob Garrison (Mottie)) http://mottie.github.io/tablesorter/docs/index.html , // and the JavaScript library 'Mutation Summary' (https://github.com/rafaelw/mutation-summary) (by Rafael Weinstein). // -// Thanks a lot to RobG, Brock Adams and Mottie for their invaluable help. +// Thanks a lot for the invaluable help to RobG, Mottie and especially Brock Adams. // +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== @@ -26,18 +30,83 @@ var stylesheet = ` `; $('head').append(stylesheet); @@ -48,11 +117,11 @@ $('head').append(stylesheet); function appendColumn(jNode) { - // STEP 1+2: SPLIT THE 'REVIEWS' COLUMN INTO A 'REVIEWS' COLUMN AND A 'RATINGS' COLUMN + // STEP 1+2: SPLIT THE 'REVIEWS' COLUMN INTO A 'REVIEWS' COLUMN AND A 'RATINGS' COLUMN var tbl = jNode[0]; // table reference - // If you have logged in (therefore the column 'Tools' exists in the discography table) + // If you have logged in (therefore the column 'Tools' exists in the discography table) if (document.getElementsByClassName('member_name').length >0){ tbl.rows[0].cells[1].width = '45%'; // In order the column 'Name'(it's the 2nd) to have enough(in fact fixed) width } else { @@ -61,7 +130,7 @@ function appendColumn(jNode) { - // If the current sub-table has no data, then stop the execution of the function + // If the current sub-table has no data, then stop the execution of the function if (tbl.rows[1].cells[0].innerHTML === 'Nothing entered yet. Please add the releases, if applicable. ') { return; } @@ -102,13 +171,26 @@ function appendColumn(jNode) { } } - // STEP 3: MAKE THE DISCOGRAPHY TABLE SORTABLE (using the jQuery plugin "tablesorter") + + // TODO: are you login? Then header0: sorter: false + let login; + // if login form doesn't exist (=you have login), then disable sorting (NOT filtering too) on column 0 ("Edit/Tools") + $('#login_form > div > button').length === 0 ? login = false : login = true; + + // STEP 3: MAKE THE DISCOGRAPHY TABLE SORTABLE (using the jQuery plugin "tablesorter") $(tbl).tablesorter ( { cssAsc: 'up', cssDesc: 'down', headers: { - 0: {sorter: false} - } + // 0: {sorter: false} + 0: { sorter: login, + filter: login} + }, + widgets: ['filter'], + ignoreCase: true, + widgetOptions : { + filter_hideFilters : true, + }, } ); } diff --git a/Metal_Archives_discography_pages_-_Reviews_column_split_and_sortable_tables/README.md b/Metal_Archives_discography_pages_-_Reviews_column_split_and_sortable_tables/README.md index eb5d789..a215cc0 100644 --- a/Metal_Archives_discography_pages_-_Reviews_column_split_and_sortable_tables/README.md +++ b/Metal_Archives_discography_pages_-_Reviews_column_split_and_sortable_tables/README.md @@ -9,13 +9,16 @@ Example *(see screenshots below)* : http://www.metal-archives.com/bands/Kamelot/166 (DISCOGRAPHY > MAIN tab) -the script works in all DISCOGRAPHY tabs- -Tested with Greasemonkey 3.3. +Tested with Greasemonkey and Tampermonkey.
-This userscript the jQuery plugin [tablesorter](http://mottie.github.io/tablesorter/docs/index.html) (forked by Rob Garrison (Mottie)) -and the JavaScript library [Mutation Summary](https://github.com/rafaelw/mutation-summary) (by Rafael Weinstein). +This userscript makes use of: -Thanks a lot to Rob Garrison and Brock Adams for their invaluable help ([1](http://stackoverflow.com/questions/26331773/javascript-in-an-html-table-how-to-select-part-of-text-matching-some-regex-f), [2](http://stackoverflow.com/questions/26416049/greasemonkey-using-the-waitforkeyelements-utility-how-to-call-a-function-aft), [3](https://github.com/Mottie/tablesorter/issues/990), [4](http://stackoverflow.com/questions/32233895/using-waitforkeyelements-is-it-possible-to-prevent-the-key-element-from-being-d)) +- ~~the page's~~ jQuery 1.11.1 ~~(because of the script's '@grant none' imperative), located inside the combined jQuery libraries file http://www.metal-archives.com/min/index.php?g=js,~~ +- the jQuery plugin [tablesorter](http://mottie.github.io/tablesorter/docs/index.html) (forked by Mottie), and +- the JavaScript library [Mutation Summary](https://github.com/rafaelw/mutation-summary) (by Rafael Weinstein). + +Thanks a lot for the invaluable help to RobG, Mottie and especially Brock Adams ([1](http://stackoverflow.com/questions/26331773/javascript-in-an-html-table-how-to-select-part-of-text-matching-some-regex-f), [2](http://stackoverflow.com/questions/26416049/greasemonkey-using-the-waitforkeyelements-utility-how-to-call-a-function-aft), [3](https://github.com/Mottie/tablesorter/issues/990), [4](http://stackoverflow.com/questions/32233895/using-waitforkeyelements-is-it-possible-to-prevent-the-key-element-from-being-d), [5](https://github.com/Tampermonkey/tampermonkey/issues/780)) Screenshots -![initially](https://greasyfork.org/system/screenshots/screenshots/000/001/815/original/1.jpg?1440546373) ![with the script](https://greasyfork.org/system/screenshots/screenshots/000/001/816/original/2_.jpg?1440546373) ![with the script (here sorted by Ratings(avg) in descending order)](https://greasyfork.org/system/screenshots/screenshots/000/001/817/original/3_.jpg?1440546373) \ No newline at end of file +![initially](https://greasyfork.org/system/screenshots/screenshots/000/001/815/original/1.jpg?1440546373) ![with the script](https://greasyfork.org/system/screenshots/screenshots/000/001/816/original/2_.jpg?1440546373) ![with the script (here sorted by Ratings(avg) in descending order)](https://greasyfork.org/system/screenshots/screenshots/000/001/817/original/3_.jpg?1440546373) diff --git a/OpenSubtitles_-_direct_download_links/OpenSubtitles_-_direct_download_links.user.js b/OpenSubtitles_-_direct_download_links/OpenSubtitles_-_direct_download_links.user.js index d491cc1..eac46d9 100644 --- a/OpenSubtitles_-_direct_download_links/OpenSubtitles_-_direct_download_links.user.js +++ b/OpenSubtitles_-_direct_download_links/OpenSubtitles_-_direct_download_links.user.js @@ -1,12 +1,14 @@ // ==UserScript== // @name OpenSubtitles - direct download links // @namespace darkred -// @license MIT -// @description Converts the subtitles download links to direct ones, in order to avoid redirection to download pages that display ads. // @version 2017.11.6 +// @description Converts the subtitles download links to direct ones, in order to avoid redirection to download pages that display ads. +// @author darkred +// @license MIT // @include https://www.opensubtitles.org/*/search/* // @include https://www.opensubtitles.org/*/subtitles/* // @grant none +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== diff --git a/OpenUserJS_Bullshit_Filter/OpenUserJS_Bullshit_Filter.user.js b/OpenUserJS_Bullshit_Filter/OpenUserJS_Bullshit_Filter.user.js index c659106..449f5d6 100644 --- a/OpenUserJS_Bullshit_Filter/OpenUserJS_Bullshit_Filter.user.js +++ b/OpenUserJS_Bullshit_Filter/OpenUserJS_Bullshit_Filter.user.js @@ -1,110 +1,210 @@ -// ==UserScript== +// ==UserScript== // @name OpenUserJS Bullshit Filter // @namespace darkred -// @author kuehlschrank, darkred -// @license MIT +// @version 2019.12.5 // @description Hides scripts for popular browser games and social networks as well as scripts that use "foreign" characters in descriptions. -// @version 1.2.3 -// @include https://openuserjs.org/ -// @include https://openuserjs.org/?*p=* -// @include https://openuserjs.org/?*q=* +// @author kuehlschrank, darkred, valacar, Graphen +// @license MIT +// @include /^https:\/\/openuserjs\.org\/((\?(q|p|orderBy|library)=|group\/|users\/.*\/scripts).*)?$/ +// @include /^http:\/\/localhost:8080\/((\?(q|p|orderBy|library)=|group\/|users\/.*\/scripts).*)?$/ // @grant none -// @icon https://s3.amazonaws.com/uso_ss/icon/97145/large.png -// This is an edited version of this script (http://userscripts-mirror.org/scripts/show/97145) by kuehlschrank. -// Thanks a lot to kuehlschrank for making another great script. +// @icon https://raw.githubusercontent.com/darkred/Userscripts/master/OpenUserJS_Bullshit_Filter/large.png +// This is a modified version of this script (http://userscripts-mirror.org/scripts/show/97145) by kuehlschrank. +// Thanks a lot to: +// - kuehlschrank for making another great script, +// - valacar for the refactoring, +// - Graphen for the 'Non-Latin' regex. +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== - (function() { - var filters = { - 'Games': /AntiGame|Agar|agar.io|ExtencionRipXChetoMalo|AposBot|DFxLite|ZTx-Lite|AposFeedingBot|AposLoader|Blah Blah|Orc Clan Script|Astro\s*Empires|^\s*Attack|^\s*Battle|BiteFight|Blood\s*Wars|Bots|Bots4|Brawler|\bBvS\b|Business\s*Tycoon|Castle\s*Age|City\s*Ville|Comunio|Conquer\s*Club|CosmoPulse|Dark\s*Orbit|Dead\s*Frontier|Diep\.io|\bDOA\b|Dossergame|Dragons\s*of\s*Atlantis|Dugout|\bDS[a-z]+\n|Empire\s*Board|eRep(ublik)?|Epic.*War|ExoPlanet|Falcon Tools|Feuerwache|Farming|FarmVille|Fightinfo|Frontier\s*Ville|Ghost\s*Trapper|Gladiatus|Goalline|Gondal|Grepolis|Hobopolis|\bhwm(\b|_)|Ikariam|\bIT2\b|Jellyneo|Kapi\s*Hospital|Kings\s*Age|Kingdoms?\s*of|knastv(ö|oe)gel|Knight\s*Fight|\b(Power)?KoC(Atta?ck)?\b|\bKOL\b|Kongregate|Last\s*Emperor|Legends?\s*of|Light\s*Rising|Lockerz|\bLoU\b|Mafia\s*(Wars|Mofo)|Menelgame|Mob\s*Wars|Mouse\s*Hunt|Molehill\s*Empire|NeoQuest|MyFreeFarm|Neopets|Nemexia|\bOGame\b|Ogar(io)?|Pardus|Pennergame|Pigskin\s*Empire|PlayerScripts|Popmundo|Po?we?r\s*(Bot|Tools)|PsicoTSI|Ravenwood|Schulterglatze|slither\.io|SpaceWars|\bSW_[a-z]+\n|\bSnP\b|The\s*Crims|The\s*West|Travian|Treasure\s*Isl(and|e)|Tribal\s*Wars|TW.?PRO|Vampire\s*Wars|War\s*of\s*Ninja|West\s*Wars|\bWoD\b|World\s*of\s*Dungeons|wtf\s*battles|Wurzelimperium/i, - 'Social Networks': /Face\s*book|Google(\+| Plus)|\bHabbo|Kaskus|\bLepra|Leprosorium|MySpace|meinVZ|odnoklassniki|Одноклассники|Orkut|sch(ue|ü)ler(VZ|\.cc)?|studiVZ|Unfriend|Valenth|VK|vkontakte|ВКонтакте|Qzone|Twitter|TweetDeck/i, - 'Non-ASCII': /[^\x00-\x7F\s]+/i, - 'Clutter': /^\s*(.{1,3})\1+\n|^\s*(.+?)\n+\2\n*$|^\s*.{1,5}\n|do\s*n('|o)?t (install|download)|nicht installieren|just(\s*a)?\s*test|^\s*.{0,4}test.{0,4}\n|\ntest(ing)?\s*|^\s*(\{@|Smolka|Hacks)|\[\d{4,5}\]|free\s*download/i + + const DEBUGGING = 0; + + const filters = { + 'Non-ASCII': /[^\x00-\x7F\s]+/, + 'Non-Latin': /[^\u0000-\u024F\u2000-\u214F\s]+/, + 'Games': /Aimbot|AntiGame|Agar|agar\.io|alis\.io|angel\.io|ExtencionRipXChetoMalo|AposBot|DFxLite|ZTx-Lite|AposFeedingBot|AposLoader|Balz|Blah Blah|Orc Clan Script|Astro\s*Empires|^\s*Attack|^\s*Battle|BiteFight|Blood\s*Wars|Bloble|Bonk|Bots|Bots4|Brawler|\bBvS\b|Business\s*Tycoon|Castle\s*Age|City\s*Ville|chopcoin\.io|Comunio|Conquer\s*Club|CosmoPulse|cursors\.io|Dark\s*Orbit|Dead\s*Frontier|Diep\.io|\bDOA\b|doblons\.io|DotD|Dossergame|Dragons\s*of\s*Atlantis|driftin\.io|Dugout|\bDS[a-z]+\n|elites\.io|Empire\s*Board|eRep(ublik)?|Epicmafia|Epic.*War|ExoPlanet|Falcon Tools|Feuerwache|Farming|FarmVille|Fightinfo|Frontier\s*Ville|Ghost\s*Trapper|Gladiatus|Goalline|Gondal|gota\.io|Grepolis|Hobopolis|\bhwm(\b|_)|Ikariam|\bIT2\b|Jellyneo|Kapi\s*Hospital|Kings\s*Age|Kingdoms?\s*of|knastv(o|oe)gel|Knight\s*Fight|\b(Power)?KoC(Atta?ck)?\b|\bKOL\b|Kongregate|Krunker|Last\s*Emperor|Legends?\s*of|Light\s*Rising|lite\.ext\.io|Lockerz|\bLoU\b|Mafia\s*(Wars|Mofo)|Menelgame|Mob\s*Wars|Mouse\s*Hunt|Molehill\s*Empire|MooMoo|MyFreeFarm|narwhale\.io|Neopets|NeoQuest|Nemexia|\bOGame\b|Ogar(io)?|Pardus|Pennergame|Pigskin\s*Empire|PlayerScripts|pokeradar\.io|Popmundo|Po?we?r\s*(Bot|Tools)|PsicoTSI|Ravenwood|Schulterglatze|Skribbl|slither\.io|slitherplus\.io|slitheriogameplay|SpaceWars|splix\.io|Survivio|\bSW_[a-z]+\n|\bSnP\b|The\s*Crims|The\s*West|torto\.io|Travian|Treasure\s*Isl(and|e)|Tribal\s*Wars|TW.?PRO|Vampire\s*Wars|vertix\.io|War\s*of\s*Ninja|World\s*of\s*Tanks|West\s*Wars|wings\.io|\bWoD\b|World\s*of\s*Dungeons|wtf\s*battles|Wurzelimperium|Yohoho|Zombs/iu, + 'Social Networks': /Face\s*book|Google(\+| Plus)|\bHabbo|Kaskus|\bLepra|Leprosorium|MySpace|meinVZ|odnoklassniki|Одноклассники|Orkut|sch(ue|ü)ler(VZ|\.cc)?|studiVZ|Unfriend|Valenth|VK|vkontakte|ВКонтакте|Qzone|Twitter|TweetDeck/iu, + 'Clutter': /^\s*(.{1,3})\1+\n|^\s*(.+?)\n+\2\n*$|^\s*.{1,5}\n|do\s*n('|o)?t (install|download)|nicht installieren|(just )?(\ban? |\b)test(ing|s|\d|\b)|^\s*.{0,4}test.{0,4}\n|\ntest(ing)?\s*|^\s*(\{@|Smolka|Hacks)|\[\d{4,5}\]|free\s*download|theme|(night|dark) ?(mode)?/iu }; - if (typeof GM_getValue == 'undefined' || (typeof GM_getValue.toString == 'function' && GM_getValue.toString().indexOf('not supported') > -1)) { - GM_getValue = my_GM_getValue; - GM_setValue = my_GM_setValue; - } + + const commonCss = ` + .filter-status { + margin-left: 6px; + } + + .filter-switches { + display: none; + } + + :hover>.filter-switches { + display: block; + } + + .filter-on, + .filter-off { + display: block; + width: 125px; + } + + .filter-switches a { + text-decoration: none; + color: inherit; + cursor: pointer; + } + + .filter-switches a { + margin-left: 8px; + padding: 0 4px; + } + + a.filter-on { + background-color: #ffcccc; + color: #333333; + text-decoration: line-through; + } + + a.filter-off { + background-color: #ccffcc; + color: #333333 + } + `; + + // const isOnForum = window.location.href.includes('forum'); + + const site = {}; + + + + // if (isOnForum) { + // // site.css = '.ItemDiscussion.filtered { display: none; } .filter-on, .filter-off { color: black; } ' + commonCss; + // site.css = '.tr-link.filtered { display: none; } ' + commonCss; + // site.cssDebug = '.tr-link.filtered { background-color: khaki; } ' + commonCss; + // // site.filterStatusLocation = '#Head'; + // site.filterStatusLocation = '.col-md-2'; + // site.itemsToCheck = '.tr-link'; + // site.itemType = 'discussions'; + // site.removeFilter = function(el) { + // el.classList.remove('filtered'); + // }; + // site.applyFilter = function(el, activeFilter) { + // let textToFilter = el.firstElementChild.firstElementChild.innerText; + // if (textToFilter.match(activeFilter) ) { + // el.classList.add('filtered'); + // return true; + // } + // return false; + // }; + // } else { + + site.css = 'tr.filtered { display: none; } ' + commonCss; + site.cssDebug = 'tr.filtered { background-color: khaki; } ' + commonCss; + site.filterStatusLocation = '.col-sm-4'; + site.itemsToCheck = '.col-sm-8 tbody tr'; + site.itemType = 'scripts'; + site.removeFilter = function(el) { + el.classList.remove('filtered'); + }; + site.applyFilter = function(el, activeFilter) { + // if (el.innerText.match(activeFilter)) { + let textToFilter = el.firstElementChild.querySelector('a.tr-link-a').innerText + ' ' + el.firstElementChild.lastElementChild.innerText ; // Script title + description + if (textToFilter.match(activeFilter) ) { + + el.classList.add('filtered'); + return true; + } + return false; + }; + // } + insertStyle(); insertStatus(); filterScripts(); insertSwitches(); - // Note: you may uncomment line 37 (and comment out line 38), in order the filtered scripts to be highlighted khaki -instead of hiding them- so that you can check which scripts have been filtered function insertStyle() { - var style = document.createElement('style'); - // style.textContent = 'tr.filtered { background-color:khaki; !important; } .filter-status { margin-left: 6px; } .filter-switches { display:none; } *:hover > .filter-switches { display:block !important; } .filter-on, .filter-off {display:block !important; width: 107px; outline: none;} .filter-switches a { text-decoration:none !important; color:inherit; cursor:pointer; } .filter-switches a { margin-left: 8px; padding: 0 4px; } a.filter-on { background-color:#ffcccc; color:#333333; text-decoration:line-through !important } a.filter-off { background-color:#ccffcc; color:#333333 } '; - style.textContent = 'tr.filtered { display:none !important; } .filter-status { margin-left: 6px; } .filter-switches { display:none; } *:hover > .filter-switches { display:block !important; } .filter-on, .filter-off {display:block !important; width: 107px; outline: none;} .filter-switches a { text-decoration:none !important; color:inherit; cursor:pointer; } .filter-switches a { margin-left: 8px; padding: 0 4px; } a.filter-on { background-color:#ffcccc; color:#333333; text-decoration:line-through !important } a.filter-off { background-color:#ccffcc; color:#333333 } '; + const style = document.createElement('style'); + style.textContent = DEBUGGING ? site.cssDebug : site.css; style.type = 'text/css'; - document.querySelector('head').appendChild(style); + document.head.appendChild(style); } + function insertStatus() { - var p = document.querySelector('.col-sm-4'); - if(p) { - var status = document.createElement('span'); + const p = document.querySelector(site.filterStatusLocation); + if (p) { + const status = document.createElement('span'); status.className = 'filter-status'; p.appendChild(status); } } + + + function filterScripts() { - var activeFilters = []; - for(var filter in filters) { - if(filters.hasOwnProperty(filter) && GM_getValue(filter, 'on') == 'on') { - activeFilters.push(filters[filter]); + const activeFilters = []; + for (let filterType of Object.keys(filters)) { + if (configGetValue(filterType, 'on') === 'on') { + activeFilters.push(filters[filterType]); } } - var nodes = document.querySelectorAll('.col-sm-8 tbody tr'), - numActiveFilters = activeFilters.length, - numFiltered = 0; - for (var i = 0, numNodes = nodes.length, td = null; i < numNodes && (td = nodes[i]); i++) { - td.className = ''; - for(var j = 0; j < numActiveFilters; j++) { - if (td.innerText.match(activeFilters[j]) ) { - td.className = 'filtered'; + const nodes = document.querySelectorAll(site.itemsToCheck); + let numFiltered = 0; + for (let node of nodes) { + site.removeFilter(node); + for (let activeFilter of activeFilters) { + let filtered = site.applyFilter(node, activeFilter); + if (filtered) { numFiltered++; break; } } } - document.querySelector('.filter-status').textContent = document.querySelectorAll('.col-sm-8 tbody tr').length - numFiltered + ' scripts (' + numFiltered + ' filtered)'; + const filterStatus = document.querySelector('.filter-status'); + if (filterStatus) { + const numUnfiltered = document.querySelectorAll(site.itemsToCheck).length - numFiltered; + filterStatus.textContent = `${numUnfiltered} ${site.itemType} (${numFiltered} filtered)`; + } } + function insertSwitches() { - var span = document.createElement('span'); + const span = document.createElement('span'); span.className = 'filter-switches'; - for(var filter in filters) { - if(filters.hasOwnProperty(filter)) { - span.appendChild(createSwitch(filter, GM_getValue(filter, 'on') == 'on')); - } + for (let filterType of Object.keys(filters)) { + span.appendChild(createSwitch(filterType, configGetValue(filterType, 'on') === 'on')); + } + const filterStatus = document.querySelector('.filter-status'); + if (filterStatus) { + filterStatus.parentNode.appendChild(span); } - document.querySelector('.filter-status').parentNode.appendChild(span); } + function createSwitch(label, isOn) { - var a = document.createElement('a'); + const a = document.createElement('a'); a.className = isOn ? 'filter-on' : 'filter-off'; a.textContent = label; a.addEventListener('click', function(e) { - if(this.className == 'filter-on') { + if (this.className === 'filter-on') { this.className = 'filter-off'; - GM_setValue(this.textContent, 'off'); + configSetValue(this.textContent, 'off'); } else { this.className = 'filter-on'; - GM_setValue(this.textContent, 'on'); + configSetValue(this.textContent, 'on'); } filterScripts(); e.preventDefault(); }, false); return a; } - function my_GM_setValue(name, value) { + + function configSetValue(name, value) { localStorage.setItem(name, value); } - function my_GM_getValue(name, defaultValue) { - var value; - if (!(value = localStorage.getItem(name))) { - return defaultValue; - } - return value; + + function configGetValue(name, defaultValue) { + const value = localStorage.getItem(name); + return value ? value : defaultValue; } -})(); \ No newline at end of file + +})(); diff --git a/OpenUserJS_Bullshit_Filter/README.md b/OpenUserJS_Bullshit_Filter/README.md index ad88df6..79aef93 100644 --- a/OpenUserJS_Bullshit_Filter/README.md +++ b/OpenUserJS_Bullshit_Filter/README.md @@ -3,12 +3,13 @@ i.e. it filters any/all of these 4 categories: * **Games**: scripts for browser games like Kingdoms of Camelot, Mafia Wars and Ikariam * **Social Networks**: scripts for general purpose social networking sites like Facebook, studiVZ and VKontakte * **Non-ASCII**: scripts that use non-English characters in description (accents, umlauts, cyrillic letters, ...) -* **Clutter**: obvious spam, titles like "asdasdasd", description = title, title < 6 characters, "just a test". +* **Clutter**: obvious spam, titles like "asdasdasd", description = title, title < 6 characters, "just a test", scripts for themes/dark/night mode (because they are, in effect, userstyles). The filters list appears just below the "Announcements" table (i.e. on the right). -![image](https://i.imgur.com/BYQ5WfA.gif) +![screenshot](https://i.imgur.com/uPvFcSS.gif) *Note: you may uncomment line 37 (and comment out line 38), in order the filtered scripts to be highlighted khaki -instead of hiding them- so that you can check which scripts have been filtered.* This is a modified version of this script: [userscripts.org Bullshit Filter](http://userscripts-mirror.org/scripts/show/97145) (by kuehlschrank). -Thanks a lot to kuehlschrank for making another great script. \ No newline at end of file +Thanks a lot to kuehlschrank for making another great script. +Thanks a lot to valacar for [the refactoring](https://greasyfork.org/en/forum/discussion/42803/refactored). diff --git a/ProtonMail_-_remove_forced_signature/ProtonMail_-_remove_forced_signature.user.js b/ProtonMail_-_remove_forced_signature/ProtonMail_-_remove_forced_signature.user.js new file mode 100644 index 0000000..0e79958 --- /dev/null +++ b/ProtonMail_-_remove_forced_signature/ProtonMail_-_remove_forced_signature.user.js @@ -0,0 +1,79 @@ +// ==UserScript== +// @name ProtonMail - remove forced signature +// @namespace darkred +// @version 2023.6.1 +// @description Removes the forced ProtonMail signature from the 'New message' textboxes +// @author darkred +// @license MIT +// @include https://mail.protonmail.com/* +// @include https://mail.proton.me/* +// @include https://protonirockerxow.onion/* +// @include https://protonmailrmez3lotccipshtkleegetolb73fuirgj7r4o4vfu7ozyd.onion/* +// @grant none +// @require https://greasyfork.org/scripts/21927-arrive-js/code/arrivejs.js +// @supportURL https://github.com/darkred/Userscripts/issues +// @icon https://proton.me/favicons/favicon.ico +// ==/UserScript== + +const elementToWatch = 'iframe[title="Email composer"]'; +document.arrive(elementToWatch, function () { + let iframe = this.contentDocument; // refers to the newly created element + + const config = { + childList: true, + subtree: true + }; + + const callback = function(mutationList, observer) { + mutationList.forEach( (mutation) => { + mutation.addedNodes.forEach( (node) => { + + const refNode = 'protonmail_signature_block'; + + if (node.className === refNode) { + + // DOM STRUCTURE: + // + // The 2 previous element siblings of the main signature element, '.protonmail_signature_block', both contain a
element with a
inside, i.e.
=
\
) : + //
\
|
\
| .protonmail_signature_block + // + // The '.protonmail_signature_block' itself has either 3 or 2
children which can be: + // + // (when user signature doesn't exist) the (empty) user signature , and the proton signature + // .protonmail_signature_block-user.protonmail_signature_block-empty | .protonmail_signature_block-proton + // + // (when user signature exists) the user signature , 1
\
, and the signature itself + // .protonmail_signature_block-user |
\
| .protonmail_signature_block-proton + // + // The script's functionality is: + // 1a. If user signature exists(=it's not empty), to remove the
\
element before the last element ('.protonmail_signature_block-proton') ... + // 1b. ... otherwise to remove the 2
\
elements before the main/reference '.protonmail_signature_block' element. + // 2. To remove the last element ('.protonmail_signature_block-proton') itself. + // + // See DOM screenshots: https://imgur.com/a/VEI4nDQ + + + const signatureProton = '.protonmail_signature_block-proton'; + + + if (!node.firstElementChild.classList.contains('protonmail_signature_block-empty')){ + node.querySelector(signatureProton).previousElementSibling.remove(); + } else { + node.previousElementSibling.remove(); + node.previousElementSibling.remove(); + } + + node.querySelector(signatureProton).remove(); + + + observer.disconnect(); + } + }); + + }); + }; + + const observer = new MutationObserver(callback); + observer.observe(iframe, config); + +}); diff --git a/ProtonMail_-_remove_forced_signature/README.md b/ProtonMail_-_remove_forced_signature/README.md new file mode 100644 index 0000000..0bcf3ab --- /dev/null +++ b/ProtonMail_-_remove_forced_signature/README.md @@ -0,0 +1,9 @@ +This userscript applies to https://mail.protonmail.com +*(after the recent layout update there's no `beta` subdomain anymore (`beta.protonmail.com` ) --- enabling 'beta' features is just a toggle button now (Settings | 'Beta Access' )*. +It automatically removes the ProtonMail signature from the 'New message' textboxes, +which is appended by default to each mail body and cannot be modified via Settings in free accounts. + +It uses the excellent library [arrive.js](https://github.com/uzairfarooq/arrive) + +The script only works in Chrome, not Firefox - see [here](https://github.com/darkred/Userscripts/issues/13#issuecomment-739492052) and [here](https://github.com/darkred/Userscripts/issues/43#issuecomment-893362520). +Tampermonkey and Violentmonkey are supported - Greasemonkey is not supported. diff --git a/RARBG_-_convert_torrent_timestamps_to_relative_format/RARBG_-_convert_torrent_timestamps_to_relative_format.user.js b/RARBG_-_convert_torrent_timestamps_to_relative_format/RARBG_-_convert_torrent_timestamps_to_relative_format.user.js index 4889f1e..2dfb259 100644 --- a/RARBG_-_convert_torrent_timestamps_to_relative_format/RARBG_-_convert_torrent_timestamps_to_relative_format.user.js +++ b/RARBG_-_convert_torrent_timestamps_to_relative_format/RARBG_-_convert_torrent_timestamps_to_relative_format.user.js @@ -1,18 +1,41 @@ // ==UserScript== // @name RARBG - convert torrent timestamps to relative format // @namespace darkred -// @license MIT +// @version 2021.11.9 // @description Converts torrent upload timestamps to relative format -// @version 2017.2.15 -// @include /^https?:\/\/(www\.)?rarbg\.(to|com)\/torrents.php.*/ -// @include /^https?:\/\/(www\.)?rarbg\.(to|com)\/top10$/ +// @author darkred +// @license MIT +// @include /^(https?:)?\/\/(www\.)?(proxy|unblocked)?rarbg((2018|2019|2020|2021)?|access(ed)?|cdn|core|data|enter|get|go|index|mirror(ed)?|p2p|prox(ied|ies|y)|prx|to(r|rrents)?|unblock(ed)?|way|web)\.(to|com|org|is)\/(torrents\.php.*|catalog\/.*|s\/.*|tv\/.*|top10)$/ // @grant none -// @require https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js -// @require https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.6/moment-timezone-with-data-2010-2020.js -// @require https://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.6/jstz.min.js +// @require https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.25.0/moment.min.js +// @require https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.28/moment-timezone-with-data-10-year-range.min.js +// @require https://greasyfork.org/scripts/21927-arrive-js/code/arrivejs.js +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== -/* global jstz, moment */ +'use strict'; +/* global moment */ + + +// Based on the timestamp on the footer of each RARBG page --> "Sat, 01 May 2020 20:14:56 +0200", the script takes that the server time is GMT+2 and that it doesn't take DST. +// Otherwise, when it's e.g. --> "Mon, 08 Nov 2021 21:26:11 +0100", it takes that the server time is GMT+1 and that it doesn't take DST. +// Also, the script uses the 'moment-timezone' library as it takes DST offsets into account when converting the timestamps to user/local timezone. + +/* +// This is no typo: +// const serverTimezone = 'Etc/GMT+2'; // -02:00 -02:00 (=no DST) +// const serverTimezone = 'Etc/GMT-2'; // +02:00 +02:00 (=no DST) +const serverTimezone = 'Etc/GMT-1'; // +01:00 +01:00 (=no DST) +*/ +let serverTimezone; +$('div:contains("SUPPORT :")').contents().last().text().trim().slice(-5) === '+0200' ? serverTimezone = 'Etc/GMT-2' : serverTimezone = 'Etc/GMT-1'; + + +const localTimezone = moment.tz.guess(); // In my case ----> +02:00 +03:00 (DST) + +// const format = 'MM/DD/YYYY HH:mm:ss'; +// const format = 'YYYY-MM-DD HH:mm:ss'; +const format = 'YYYY-MM-DD HH:mm:ss'; // Customize the strings in the locale to display "1 minute ago" instead of "a minute ago" (https://github.com/moment/moment/issues/3764#issuecomment-279928245) moment.updateLocale('en', { @@ -33,22 +56,50 @@ moment.updateLocale('en', { } }); -var localTimezone = jstz.determine().name(); -var serverTimezone = 'Europe/Berlin'; // GMT+1 - -function convertDates() { - var dates = document.querySelectorAll('tr.lista2 td:nth-child(3)'); - for (var i = 0; i < dates.length; i++) { - // if (moment(dates[i].innerText, 'YYYY-MM-DD HH:mm:ss', true).isValid()) { // As of moment.js v2.3.0, you may specify a boolean for the last argument to make Moment use strict parsing. Strict parsing requires that the format and input match exactly, including delimeters. - if (moment(dates[i].innerText, 'YYYY-MM-DD HH:mm:ss').isValid()) { - var temp2 = moment.tz(dates[i].innerText, serverTimezone).tz(localTimezone); - dates[i].innerText = temp2.fromNow(); - - var format = 'MM/DD/YYYY HH:mm:ss'; - dates[i].title = temp2.format(format); +function convertToLocalTimezone(timestamps) { + for (let i = 0; i < timestamps.length; i++) { + let initialTimestamp = timestamps[i].textContent; + if (moment(initialTimestamp, format, true).isValid()) { // As of moment.js v2.3.0, you may specify a boolean for the last argument to make Moment use strict parsing. Strict parsing requires that the format and input match exactly, including delimeters. + let convertedToLocalTimezone = moment.tz(initialTimestamp, format, serverTimezone).tz(localTimezone); + timestamps[i].textContent = convertedToLocalTimezone.fromNow(); + timestamps[i].title = convertedToLocalTimezone.format(format); + // timestamps[i].title = convertedToLocalTimezone.toISOString(); // Display timestamps in tooltips in ISO 8601 format, combining date and time (https://stackoverflow.com/questions/25725019/how-do-i-format-a-date-as-iso-8601-in-moment-js/) + // timestamps[i].title = convertedToLocalTimezone.format(); } } + + // recalculate the relative dates every 1 min + (function(){ + for (let i = 0; i < timestamps.length; i++) { + timestamps[i].textContent = moment(timestamps[i].title).fromNow(); + } + // setTimeout(arguments.callee, 10 * 1000); // 10 * 1000 msec = 10 sec = 1/6 min + setTimeout(arguments.callee, 60 * 1000); // 60 * 1000 msec = 1 min + })(); + } -convertDates(); + + +// Per request: https://greasyfork.org/en/scripts/21550-rarbg-convert-torrent-timestamps-to-relative-format/discussions/91794 +const isOnTV = window.location.href.includes('/tv/'); // example link: https://rarbgproxy.org/tv/tt1720601/ + +if (isOnTV) { + + // document.querySelectorAll('.tvshowClick').forEach((element) => { + document.querySelectorAll('div[id^="episode_"]').forEach((element) => { + element.addEventListener('click', function(){ + document.arrive('div[id^="tvcontent_"] .lista2t', function () { + convertToLocalTimezone(document.querySelectorAll('td[width="150px"]')); + }); + }); + }); + +} else { + + // const timestamps = document.querySelectorAll('tr.lista2 td:nth-child(3)'); + const timestamps = document.querySelectorAll('td[width="150px"]'); + convertToLocalTimezone(timestamps); + +} diff --git a/RARBG_-_convert_torrent_timestamps_to_relative_format/README.md b/RARBG_-_convert_torrent_timestamps_to_relative_format/README.md index 8caf4cc..b5ee053 100644 --- a/RARBG_-_convert_torrent_timestamps_to_relative_format/README.md +++ b/RARBG_-_convert_torrent_timestamps_to_relative_format/README.md @@ -1,9 +1,22 @@ -This script applies to rarbg.to. +This script applies to RARBG lists: +- it converts torrent timestamps to relative format in local timezone. Also, it recalculates them every 1 min. +- The initial timestamps are still available as tooltips (on mouse hover), also converted to local timezone. -It converts torrent timestamps to relative format. +Note: there's a timestamp on the footer of each RARBG page e.g. `Sun, 28 Mar 2021 18:26:22 +0200`. +Based on that, the script takes that for the server the UTC/UTC DST offsets are `+02:00 +02:00` (=no DST), +therefore the timezone in the above case `GMT-2`. -*Note: if you use it in conjunction with my script: [RARBG - torrent and magnet links](https://greasyfork.org/scripts/23493) -make sure in your script manager that that this script runs* **before** *that one*. +Examples: +> +01:00 +01:00 (=no DST) ---> 'Etc/GMT-1'; +> +02:00 +02:00 (=no DST) ---> 'Etc/GMT-2'; -It uses [moment.js](http://momentjs.com/), [moment-timezone.js](http://momentjs.com/timezone/) and [jsTimezoneDetect](https://bitbucket.org/pellepim/jstimezonedetect) \ No newline at end of file +It uses [moment.js](http://momentjs.com/) and [moment-timezone.js](http://momentjs.com/timezone/). + +Screenshot comparison: +Initial: +![](https://i.imgur.com/vdv2xjR.jpg) +With the script: +![](https://i.imgur.com/iTuWa4d.jpg) + +[Hosted in GitHub](https://github.com/darkred/Userscripts) diff --git a/RARBG_-_convert_torrent_timestamps_to_relative_format/jquery-2.1.4.min.js b/RARBG_-_convert_torrent_timestamps_to_relative_format/jquery-2.1.4.min.js deleted file mode 100644 index 49990d6..0000000 --- a/RARBG_-_convert_torrent_timestamps_to_relative_format/jquery-2.1.4.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */ -!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)+1>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b="length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+K.uid++}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){ -return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,ba=/<([\w:]+)/,ca=/<|&#?\w+;/,da=/<(?:script|style|link)/i,ea=/checked\s*(?:[^=]|=\s*.checked.)/i,fa=/^$|\/(?:java|ecma)script/i,ga=/^true\/(.*)/,ha=/^\s*\s*$/g,ia={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ia.optgroup=ia.option,ia.tbody=ia.tfoot=ia.colgroup=ia.caption=ia.thead,ia.th=ia.td;function ja(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function ka(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function la(a){var b=ga.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function ma(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function na(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function oa(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pa(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=oa(h),f=oa(a),d=0,e=f.length;e>d;d++)pa(f[d],g[d]);if(b)if(c)for(f=f||oa(a),g=g||oa(h),d=0,e=f.length;e>d;d++)na(f[d],g[d]);else na(a,h);return g=oa(h,"script"),g.length>0&&ma(g,!i&&oa(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(ca.test(e)){f=f||k.appendChild(b.createElement("div")),g=(ba.exec(e)||["",""])[1].toLowerCase(),h=ia[g]||ia._default,f.innerHTML=h[1]+e.replace(aa,"<$1>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=oa(k.appendChild(e),"script"),i&&ma(f),c)){j=0;while(e=f[j++])fa.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(oa(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&ma(oa(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(oa(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!da.test(a)&&!ia[(ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(aa,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(oa(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(oa(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&ea.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(oa(c,"script"),ka),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,oa(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,la),j=0;g>j;j++)h=f[j],fa.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(ha,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qa,ra={};function sa(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function ta(a){var b=l,c=ra[a];return c||(c=sa(a,b),"none"!==c&&c||(qa=(qa||n("