UserScripts icon indicating copy to clipboard operation
UserScripts copied to clipboard

Linx Amender Rules Thread

Open TimidScript opened this issue 11 years ago • 37 comments

Post your exported rule suggestion here.

Script and Title rules are not allowed. Unless you have some amazing style, CSS rules would most likely be rejected.

TimidScript avatar Aug 21 '14 20:08 TimidScript

[beforeitsnews.com] remove external link redirects

{"id":"L1426704260084","name":"[beforeitsnews.com] remove external link redirects","URLs":"@http://beforeitsnews.com/","description":"remove external link redirects","sampleURL":"http://beforeitsnews.com/","nthNode":"0","type":1,"selectors":"a","regexes":[{"name":"href","search":"/r2/\\?url="}],"enabled":true,"timestamp":1426792784491}

atomGit avatar Mar 19 '15 19:03 atomGit

[morguefile.com] remove image overlay

{"id":"L1424377335073","name":"[morguefile.com] - remove image overlay","URLs":"@http://www.morguefile.com/\n@https://www.morguefile.com/","description":"remove social sharing overlay when previewing images","sampleURL":"http://www.morguefile.com/archive","nthNode":"0","type":1,"selectors":"div#imgAreaShare","regexes":[{"name":"-id","search":"imgAreaShare"}],"enabled":true,"timestamp":1426793654004}

atomGit avatar Mar 19 '15 19:03 atomGit

[generic] remove tracking params from URL's

{"id":"L1418997894597","name":"[generic] Remove tracking params from URLs","URLs":"*","description":"remove link tracking parameters from URL's - idea from: https://addons.mozilla.org/en-US/firefox/addon/pure-url/","nthNode":"0","type":1,"selectors":"a","regexes":[{"name":"href","search":"(&|%26|\\?)(?:utm_|ga_|_openstat|yclid|fb_|action_object_map|action_type_map|action_ref_map|hc_location).+?(?=&|%26|$)","replace":"$1"},{"name":"-ping"}],"enabled":true,"timestamp":1426793875264}

atomGit avatar Mar 19 '15 19:03 atomGit

Thank you :) I updated the list

TimidScript avatar Mar 21 '15 12:03 TimidScript

[generic] convert embed youtube video to iframe so video is playable without Adobe Flash (browser must support HTML5 video)

thanks for your help with this Timid! this is not heavily tested

{"id":"L1430836041895","name":"[generic] convert embed youtube video to iframe","URLs":"*","description":"Convert video embed code to iframe so it is playable without Adobe Flash Player (browser must support HTML5 video)","nthNode":"0","type":1,"selectors":"embed","regexes":[{"name":"=outerHTML","search":"<embed.+?src=\"(https?://www\\.youtube\\.com)/v/(\\S+?)[?\"].+?height=\"(\\d+).+?width=\"(\\d+)","replace":"<iframe src=\"$1/embed/$2?feature=oembed\" height=\"$3\" allowfullscreen=\"\" frameborder=\"0\" width=\"$4\"></iframe>"}],"enabled":true,"timestamp":1431947231578}

UPDATE: 18-MAY-2015 - better support of embed code

atomGit avatar May 11 '15 13:05 atomGit

You are welcome. Glad you got it working and thanks for sharing :)

TimidScript avatar May 12 '15 20:05 TimidScript

updated post: [generic] convert embed youtube video to iframe script will support more embed code

atomGit avatar May 18 '15 11:05 atomGit

Updated ages ago just forgot to reply. Thanks.

TimidScript avatar Jun 10 '15 11:06 TimidScript

UPDATE - small error corrected: [generic] convert embed youtube video to iframe so video is playable without Adobe Flash (browser must support HTML5 video)

{"id":"L1430836041895","name":"[generic] convert embed youtube video to iframe","URLs":"*","description":"Convert video embed code to iframe so it is playable without Adobe Flash Player (browser must support HTML5 video)","nthNode":"0","type":1,"selectors":"embed","regexes":[{"name":"=outerHTML","search":"<embed.+?src=\"(https?://www\\.youtube\\.com)/v/(\\S+?)[?\"].+?height=\"(\\d+).+?width=\"(\\d+).*?\">(</embed>)?","replace":"<iframe src=\"$1/embed/$2?feature=oembed\" allowfullscreen=\"\" frameborder=\"0\" height=\"$3\" width=\"$4\"></iframe>"}],"enabled":true,"timestamp":1434281736574}

atomGit avatar Jun 14 '15 11:06 atomGit

Thanks :)

TimidScript avatar Jun 14 '15 15:06 TimidScript

[generic] convert embed youtube video to iframe so video is playable without Adobe Flash (browser must support HTML5 video)

UPDATE: supports more embed methods

{"id":"L1430836041895","name":"[generic] convert embed youtube video to iframe","URLs":"*","description":"Convert video embed code to iframe so it is playable without Adobe Flash Player (browser must support HTML5 video)","nthNode":"0","type":1,"selectors":"embed","regexes":[{"name":"=outerHTML","search":"(?:<object.+?)?<embed.+?src=\"((?:https?:)?\\/\\/www\\.youtube\\.com)\\/v\\/(\\S+?)[?\"].+?height=\"(\\d+).+?width=\"(\\d+).*?\">(?:<\\/embed>|<\\/object>)?","replace":"<iframe src=\"$1/embed/$2?feature=oembed\" allowfullscreen=\"\" frameborder=\"0\" height=\"$3\" width=\"$4\"></iframe>"}],"enabled":true,"timestamp":1435170781176}

atomGit avatar Jun 24 '15 18:06 atomGit

Thanks you

TimidScript avatar Jun 25 '15 08:06 TimidScript

[generic] convert embed youtube video to iframe so video is playable without Adobe Flash (browser must support HTML5 video)

UPDATE: revised expressions so attribute order isn't as important (thanks Timid)

RegEx: https://www.regex101.com/r/sQ0gJ1/1

{"id":"L1430836041895","name":"[generic] convert embed youtube video to iframe","URLs":"*","description":"Convert video embed code to iframe so it is playable without Adobe Flash Player (browser must support HTML5 video)","nthNode":"0","type":1,"selectors":"embed","regexes":[{"name":"=outerHTML","search":"(?:<object.+?)?<embed.+?src=\"((?:https?:)?\\/\\/www\\.youtube\\.com)\\/v\\/(\\S+?)[?\"].+?((?:width|height)=\".*?\").*?((?:width|height)=\".*?\")>(?:<\\/embed>|<\\/object>)?","replace":"<iframe src=\"$1/embed/$2?feature=oembed\" allowfullscreen=\"\" frameborder=\"0\" $3 $4></iframe>"}],"enabled":true,"timestamp":1435452037960}

atomGit avatar Jun 28 '15 00:06 atomGit

Thanks :)

TimidScript avatar Jun 30 '15 12:06 TimidScript

@atomGit Updated the rule to make it work on object and on all Youtube TLDs.

{"id":"O1430836041895","name":"Youtube: On all sites, embeded YT Videos are played in HTML5 instead of Adobe Player","URLs":"*","description":"Convert embed/object (deprecated) nodes for Youtube videos to iframe. It allows the usage of the browser HTML5 Player instead of Adobe Flash Player. Works with all Youtube TLDs.","sampleURL":"http://www.w3schools.com/html/html_youtube.asp","nthNode":"0","type":1,"selectors":"object[data*=\"youtube.\"], embed[src*=\"youtube.\"]","regexes":[{"name":"=outerHTML","search":".+?(?:src|data)=\"((?:https?:)?\\/\\/(?:www\\.)?youtube\\.[a-z\\.]+)\\/v\\/(\\S+?)[?\"].+?((?:width|height)=\".*?\").*?((?:width|height)=\".*?\").+","replace":"<iframe src=\"$1/embed/$2?feature=oembed\" allowfullscreen=\"\" frameborder=\"0\" $3 $4></iframe>"}],"enabled":true,"timestamp":1435753186077}

TimidScript avatar Jul 01 '15 12:07 TimidScript

hi Timid see if you can import (paste) the rule above into LA in my case it does not appear in the UI, even after a browser restart, but if i try to import it a 2nd time i get an overwrite warning prompt

funny thing is, even if i import it multiple times, giving it a different ID each time, the database size never changes

atomGit avatar Jul 01 '15 13:07 atomGit

Hi I generally edit the rules in online mode and just copied it from online version. If you look at the "id":"O1430836041895" it starts with an O which implies online rule. Here it is again as local rule (L).

funny thing is, even if i import it multiple times, giving it a different ID each time, the database size never changes

What you've done is created duplicate online rules :). Just press alt+f9 to force update online rules to get a clean version of all online rules (Your Enabled and Run First settings are kept).

The database pre-allocates space for future usage, and it expands in stages. If it allocates space with each write it will be slow. I do not know how GM operates, but generally speaking such database do not release space after removal of records and only do so once you run a compact command.

{"id":"L1430836041895","name":"Youtube: On all sites, embeded YT Videos are played in HTML5 instead of Adobe Player","URLs":"*","description":"Convert embed/object (deprecated) nodes for Youtube videos to iframe. It allows the usage of the browser HTML5 Player instead of Adobe Flash Player. Works with all Youtube TLDs.","sampleURL":"http://www.w3schools.com/html/html_youtube.asp","nthNode":"0","type":1,"selectors":"object[data*=\"youtube.\"], embed[src*=\"youtube.\"]","regexes":[{"name":"=outerHTML","search":".+?(?:src|data)=\"((?:https?:)?\\/\\/(?:www\\.)?youtube\\.[a-z\\.]+)\\/v\\/(\\S+?)[?\"].+?((?:width|height)=\".*?\").*?((?:width|height)=\".*?\").+","replace":"<iframe src=\"$1/embed/$2?feature=oembed\" allowfullscreen=\"\" frameborder=\"0\" $3 $4></iframe>"}],"enabled":true,"timestamp":1435753186077}

TimidScript avatar Jul 01 '15 22:07 TimidScript

ah, gotchya! sorry for the trouble :)

if your new UI behaves in a similar fashion when importing rules, i might suggest displaying a confirmation notice to make it clear something was done - 'imported local rule!' or 'duplicated remote rule' or whatever

thanks!!!

atomGit avatar Jul 01 '15 22:07 atomGit

yw You can paste mixed content, which nullifies notification. In LA3, if you press ctrl when you copy, it forces converts the rule to online version. The ctrl is used on other buttons also like fitlers.

In LA4 you can force pasting in certain format by pressing ctrl (Online) or alt (local). Also in LA4 there's a paste replace confirmation dialog which allows you to compare the rules if the rule expressions and revision numbers are different. Then you can select to replace, create new version or neither.

Updated all online rules and removed broken content.

TimidScript avatar Jul 01 '15 23:07 TimidScript

Forget to say also in TSLA4 both local and online rules are on the same page which makes things easier. You can filter out all online, disabled or hidden rules. The interface allows users to interact with online rules better.

TimidScript avatar Jul 01 '15 23:07 TimidScript

i edited your revision of the YouTube embed rule so the "src" attrib always points to the SSL version of the video...

ref: https://www.regex101.com/r/tE3bH7/1

{"id":"O1430836041895","name":"[youtube] Convert embed/object nodes for YouTube videos to iframe","URLs":"*","description":"Convert embed/object (deprecated) nodes for Youtube videos to iframe. It allows the usage of the browser HTML5 Player instead of Adobe Flash Player. Works with all Youtube TLDs.","sampleURL":"http://www.w3schools.com/html/html_youtube.asp","nthNode":"0","type":1,"selectors":"object[data*=\"youtube.\"], embed[src*=\"youtube.\"]","regexes":[{"name":"=outerHTML","search":".+?(?:src|data)=\"((?:https?:)?\\/\\/(?:www\\.)?youtube\\.[a-z\\.]+)\\/v\\/(\\S+?)[?\"].+?((?:width|height)=\".*?\").*?((?:width|height)=\".*?\").+","replace":"<iframe src=\"$1/embed/$2?feature=oembed\" allowfullscreen=\"\" frameborder=\"0\" $3 $4></iframe>"}],"enabled":true,"timestamp":1435933927452}

atomGit avatar Jul 03 '15 14:07 atomGit

There's a few redundant operators but it works.

TimidScript avatar Jul 03 '15 22:07 TimidScript

i'm no expert with RegEx, that's for sure - if it needs cleaned up, please feel free - i just wanted the URLs to point to https

atomGit avatar Jul 05 '15 11:07 atomGit

Its works 100%. The redundancy is in extra usage of "?".

FYI: Thanks, partially this conversation, going to make major changes to TSLA4 online rules which makes a lot of new code redundant.

TimidScript avatar Jul 05 '15 14:07 TimidScript

@atomGit Below is code for direct outgoing links for Mozilla that you requested ages ago.

{"id":"L1415990867358","name":"Mozilla: Direct Outgoing Links","URLs":"@addons.mozilla.org","sampleURL":"https://addons.mozilla.org/en-US/firefox/addon/session-manager/","nthNode":"0","script":"(function ()\n{\n console.warn(\"TSLA Rule: Removing outgoing tracking by making clones.\");\n var links = document.querySelectorAll(\".support, .home, #addon-description a\");\n for (var i = 0; i < links.length; i++)\n { \n link = links[i].cloneNode(true);\n link.setAttribute(\"style\", \"background-color: #FBFFCC;\");\n links[i].parentElement.insertBefore(link, links[i]);\n links[i].parentElement.removeChild(links[i]);\n }\n console.warn(\"Cleaned links are highlighted in light blue\");\n})();","type":5,"selectors":"a","regexes":[],"enabled":true,"timestamp":1436260106887}

TimidScript avatar Jul 08 '15 20:07 TimidScript

thanks for that!
just got around to trying it now - also learning more stuff from your examples :)

atomGit avatar Jul 10 '15 15:07 atomGit

Since Linx Amender relies on a Free Software browser add-on known as Greasemonkey, in the spirit of freedom: Can you change the license to a free/libre license, so that I can recommend Linx Amender as a solution to the users of the Internet Archive? That way, IA users will be able to solve the forum problem using your amazing script and the rule below.

Creative Commons BY-NC-SA conflicts with Freedom 3, the ability to redistribute a copy at a price or gratis. Also, GitHub contains a link that recommends against using Creative Commons for software, titled: My project isn't software. GitHub maintains a license page to allow users to choose the license that best suits their work; I suggest choosing one of these licenses in order to eliminate confusion. I mainly bring this up, because I've learned that The JavaScript Trap is a real threat to online computing, and that it is ethical to grant users the freedom to have control of the software that runs on their computers. Thanks in advance for your consideration and hard work!


[archive.org] Fix Forum Links

{"id":"L1459362029321","name":"[archive.org] Fix Forum Links","URLs":"^https://archive.org/post/.*\n^https://archive.org/details/\@.*\n@https://archive.org/iathreads/forums.php\n^https://archive.org/iathreads/forum-display.php.*\n^https://archive.org/search.php\\?query=forumPost.*\n^https://archive.org/iathreads/posts-display-new.php.*","description":"1. Replace obsolete \"hash/anchors\" on any forum page\n2. Restore the link to the Wayback Machine Forum","sampleURL":"https://archive.org/iathreads/forums.php","nthNode":"0","type":1,"selectors":"a","regexes":[{"name":"href","search":"(.*\\/details\\/.*)(#forum)(.*)","replace":"$1&tab=forum$3"},{"name":"href","search":"web.php","replace":"hardware.php"}],"enabled":true,"timestamp":1459458633908}

EDIT: I added one more URL to the rule.

EDIT: Added another URL to the rule.

pegzmasta avatar Mar 30 '16 19:03 pegzmasta

Hello,

I see the issue. They are a company. For personal usage however, I see no problem for most users. I really do not like the idea of people charging others for free software and that's why I went fot he CC license. They are a lot of scrupleless people in our world and a lot of easy targets.

You are right. Would GPLv3 be acceptable? They can pretty much get away with anything, plus they are forced to carry on the GPLv3 license. Would that be acceptable to IA users?

TimidScript avatar Mar 31 '16 16:03 TimidScript

Yes, GPLv3 is an excellent choice! This type of license protects against technical measures being added into modified versions (like DRM), and will also ensure that proprietary versions are never made (my favourite part). After choosing one of these licenses, you would also have to delete All Rights Reserved from the Copyright Notice, or replace it with Some Rights Reserved (Creative Commons suggests this is OK). I understand what you mean about scrupleless people; syzygos brought this into perspective when he posted on IA that someone was selling free texts from archive.org. Let me know what you decide, and when you think the change can be made [on GitHub and on OpenUserJS]. Thanks!

pegzmasta avatar Mar 31 '16 20:03 pegzmasta

GPLv3 it is, with a side note of notification if re-distributing. I will try and update all my scripts this weekend.

posted on IA that someone was selling free texts from archive.org

Ouch. So cheap that you wouldn't think twice about purchasing if you wanted it. For me the most infamous is Blender re-branding. The fraudsters must be making good money, because they've been at it for years.

I have no worries of my scripts being abused like that. Just the principle of the matter, that's all.

TimidScript avatar Mar 31 '16 23:03 TimidScript