Skip to content

Instantly share code, notes, and snippets.

@jeffrey4l
Last active October 24, 2022 01:52
Show Gist options
  • Save jeffrey4l/aa9cdae0453cdfd0891c06e6f0303c40 to your computer and use it in GitHub Desktop.
Save jeffrey4l/aa9cdae0453cdfd0891c06e6f0303c40 to your computer and use it in GitHub Desktop.

Revisions

  1. jeffrey4l revised this gist Oct 24, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Jeffrey4l-enhance.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Jeffrey4l Enhance
    // @namespace https://gist.github.com/jeffrey4l/aa9cdae0453cdfd0891c06e6f0303c40/raw/Jeffrey4l-enhance.user.js
    // @version 0.5.2
    // @version 0.5.3
    // @description try to take over the world!
    // @author Jeffrey4l
    // @homepage https://gist.github.com/jeffrey4l/aa9cdae0453cdfd0891c06e6f0303c40/
  2. jeffrey4l revised this gist Oct 24, 2022. No changes.
  3. jeffrey4l revised this gist Oct 24, 2022. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion Jeffrey4l-enhance.user.js
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,8 @@
    // @version 0.5.2
    // @description try to take over the world!
    // @author Jeffrey4l
    // @match *://baidu.com/*
    // @homepage https://gist.github.com/jeffrey4l/aa9cdae0453cdfd0891c06e6f0303c40/
    // @match *://*/*
    // @grant GM_registerMenuCommand
    // @grant GM_setClipboard
    // ==/UserScript==
  4. jeffrey4l revised this gist Oct 24, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Jeffrey4l-enhance.user.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    // ==UserScript==
    // @name Jeffrey4l Enhance
    // @namespace https://gist.github.com/jeffrey4l/aa9cdae0453cdfd0891c06e6f0303c40/raw
    // @namespace https://gist.github.com/jeffrey4l/aa9cdae0453cdfd0891c06e6f0303c40/raw/Jeffrey4l-enhance.user.js
    // @version 0.5.2
    // @description try to take over the world!
    // @author Jeffrey4l
  5. jeffrey4l revised this gist Oct 24, 2022. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Jeffrey4l-enhance.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Jeffrey4l Enhance
    // @namespace https://gist.github.com/jeffrey4l/aa9cdae0453cdfd0891c06e6f0303c40
    // @version 0.5.1
    // @namespace https://gist.github.com/jeffrey4l/aa9cdae0453cdfd0891c06e6f0303c40/raw
    // @version 0.5.2
    // @description try to take over the world!
    // @author Jeffrey4l
    // @match *://baidu.com/*
  6. jeffrey4l revised this gist Oct 24, 2022. 1 changed file with 7 additions and 20 deletions.
    27 changes: 7 additions & 20 deletions Jeffrey4l-enhance.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Jeffrey4l Enhance
    // @namespace https://gist.github.com/jeffrey4l/aa9cdae0453cdfd0891c06e6f0303c40
    // @version 0.5
    // @version 0.5.1
    // @description try to take over the world!
    // @author Jeffrey4l
    // @match *://baidu.com/*
    @@ -10,28 +10,16 @@
    // ==/UserScript==

    var _Enhance = {
    title: undefined,
    mappings: {},
    fullTitle(){
    var titleElement = document.getElementsByTagName('title')[0]
    this.title = titleElement.text
    if (titleElement === undefined){
    return
    }
    var host = window.location.host
    if (this.mappings[host] === undefined ){
    titleElement.text += " - " + host
    } else {
    titleElement.text += " - " + this.mappings[host]
    }
    },
    getPageInfo(md = false) {
    let url = document.location.href;
    var t = this.title
    var titleElement = document.getElementsByTagName('title')[0]
    var t = titleElement.text
    // drop html entity
    t = t.replace(/\&#.*;/, '');
    if (md){
    t = t.replace(/([_\[\]\|])/g, "");
    t = t.replace(/([_\[\]\|\n])/g, "");
    }
    return [this.title, url];
    return [t, url];
    },
    registerMenu(){
    GM_registerMenuCommand("Copy as Plain", () => {
    @@ -55,7 +43,6 @@ var _Enhance = {
    });
    },
    init(){
    this.fullTitle()
    this.registerMenu()
    }
    };
  7. jeffrey4l revised this gist May 8, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Jeffrey4l-enhance.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Jeffrey4l Enhance
    // @namespace https://gist.github.com/jeffrey4l/aa9cdae0453cdfd0891c06e6f0303c40
    // @version 0.4
    // @version 0.5
    // @description try to take over the world!
    // @author Jeffrey4l
    // @match *://baidu.com/*
  8. jeffrey4l revised this gist May 8, 2022. 2 changed files with 71 additions and 78 deletions.
    71 changes: 71 additions & 0 deletions Jeffrey4l-enhance.user.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,71 @@
    // ==UserScript==
    // @name Jeffrey4l Enhance
    // @namespace https://gist.github.com/jeffrey4l/aa9cdae0453cdfd0891c06e6f0303c40
    // @version 0.4
    // @description try to take over the world!
    // @author Jeffrey4l
    // @match *://baidu.com/*
    // @grant GM_registerMenuCommand
    // @grant GM_setClipboard
    // ==/UserScript==

    var _Enhance = {
    title: undefined,
    mappings: {},
    fullTitle(){
    var titleElement = document.getElementsByTagName('title')[0]
    this.title = titleElement.text
    if (titleElement === undefined){
    return
    }
    var host = window.location.host
    if (this.mappings[host] === undefined ){
    titleElement.text += " - " + host
    } else {
    titleElement.text += " - " + this.mappings[host]
    }
    },
    getPageInfo(md = false) {
    let url = document.location.href;
    var t = this.title
    if (md){
    t = t.replace(/([_\[\]\|])/g, "");
    }
    return [this.title, url];
    },
    registerMenu(){
    GM_registerMenuCommand("Copy as Plain", () => {
    const [title, url] = this.getPageInfo();
    GM_setClipboard(`${title}\n${url}\n`);
    });

    GM_registerMenuCommand("Copy as Markdown", () => {
    const [title, url] = this.getPageInfo(true);
    GM_setClipboard(`[${title}](${url})\n`);
    });

    GM_registerMenuCommand("Copy as TiddlyWiki", () => {
    const [title, url] = this.getPageInfo(true);
    GM_setClipboard(`[[${title}|${url}]]\n`);
    });

    GM_registerMenuCommand("Copy as TiddlyWiki List", () => {
    const [title, url] = this.getPageInfo(true);
    GM_setClipboard(`* [[${title}|${url}]]\n`);
    });
    },
    init(){
    this.fullTitle()
    this.registerMenu()
    }
    };

    (function() {
    'use strict';
    if (window.frames.length != parent.frames.length) {
    return false;
    }

    _Enhance.init()

    })();
    78 changes: 0 additions & 78 deletions keepass-enhance.user.js
    Original file line number Diff line number Diff line change
    @@ -1,78 +0,0 @@
    // ==UserScript==
    // @name Keepass Enhance
    // @namespace https://gist.github.com/jeffrey4l/aa9cdae0453cdfd0891c06e6f0303c40
    // @version 0.4
    // @description try to take over the world!
    // @author Jeffrey4l
    // @match *://baidu.com/*
    // @grant GM_registerMenuCommand
    // @grant GM_setClipboard
    // ==/UserScript==

    var Enhance = {

    }

    (function() {
    'use strict';
    if (window.frames.length != parent.frames.length) {
    return false;
    }
    var title = undefined;

    var mappings = {
    "abc.com": "abc site",
    };

    function fullTitle(){

    var titleElement = document.getElementsByTagName('title')[0]
    title = titleElement.text
    if (titleElement === undefined){
    return
    }
    var founded=false;
    for (var url in mappings) {
    if (window.location.host.indexOf(url) != -1) {
    titleElement.text += " - " + mappings[url]
    founded = true
    break;
    }
    }
    if (!founded){
    titleElement.text += " - " + window.location.host
    }
    }

    function fnGetInfo(md = false, tid=false) {
    let url = document.location.href;
    var t = title
    if (md){
    t = t.replace(/([_\[\]\|])/g, "");
    }
    return [title, url];
    }

    GM_registerMenuCommand("复制", () => {
    const [title, url] = fnGetInfo();
    GM_setClipboard(`${title}\n${url}\n`);
    });

    GM_registerMenuCommand("复制为Markdown", () => {
    const [title, url] = fnGetInfo(true);
    GM_setClipboard(`[${title}](${url})\n`);
    });

    GM_registerMenuCommand("复制为TiddlyWiki", () => {
    const [title, url] = fnGetInfo(true);
    GM_setClipboard(`[[${title}|${url}]]\n`);
    });

    GM_registerMenuCommand("复制为TiddlyWiki list", () => {
    const [title, url] = fnGetInfo(true);
    GM_setClipboard(`* [[${title}|${url}]]\n`);
    });

    fullTitle()

    })();
  9. jeffrey4l revised this gist May 8, 2022. 1 changed file with 62 additions and 17 deletions.
    79 changes: 62 additions & 17 deletions keepass-enhance.user.js
    Original file line number Diff line number Diff line change
    @@ -1,33 +1,78 @@
    // ==UserScript==
    // @name Keepass Enhance
    // @namespace https://gist.github.com/jeffrey4l/aa9cdae0453cdfd0891c06e6f0303c40
    // @version 0.3
    // @version 0.4
    // @description try to take over the world!
    // @author Jeffrey4l
    // @match http://*/*
    // @match https://*/*
    // @grant none
    // @match *://baidu.com/*
    // @grant GM_registerMenuCommand
    // @grant GM_setClipboard
    // ==/UserScript==

    var Enhance = {

    }

    (function() {
    'use strict';
    if (window.frames.length != parent.frames.length) {
    return false;
    }
    var title = undefined;

    var mappings = {
    "abc.com": "abc site"
    "abc.com": "abc site",
    };
    var titleDoc = document.getElementsByTagName('title')[0]
    if (titleDoc === undefined){
    return
    }
    var founded=false;
    for (var url in mappings) {
    if (window.location.host.indexOf(url) != -1) {
    titleDoc.text += " - " + mappings[url]
    founded = true
    break;

    function fullTitle(){

    var titleElement = document.getElementsByTagName('title')[0]
    title = titleElement.text
    if (titleElement === undefined){
    return
    }
    var founded=false;
    for (var url in mappings) {
    if (window.location.host.indexOf(url) != -1) {
    titleElement.text += " - " + mappings[url]
    founded = true
    break;
    }
    }
    if (!founded){
    titleElement.text += " - " + window.location.host
    }
    }
    if (!founded){
    titleDoc.text += " - " + window.location.host

    function fnGetInfo(md = false, tid=false) {
    let url = document.location.href;
    var t = title
    if (md){
    t = t.replace(/([_\[\]\|])/g, "");
    }
    return [title, url];
    }

    GM_registerMenuCommand("复制", () => {
    const [title, url] = fnGetInfo();
    GM_setClipboard(`${title}\n${url}\n`);
    });

    GM_registerMenuCommand("复制为Markdown", () => {
    const [title, url] = fnGetInfo(true);
    GM_setClipboard(`[${title}](${url})\n`);
    });

    GM_registerMenuCommand("复制为TiddlyWiki", () => {
    const [title, url] = fnGetInfo(true);
    GM_setClipboard(`[[${title}|${url}]]\n`);
    });

    GM_registerMenuCommand("复制为TiddlyWiki list", () => {
    const [title, url] = fnGetInfo(true);
    GM_setClipboard(`* [[${title}|${url}]]\n`);
    });

    fullTitle()

    })();
  10. jeffrey4l revised this gist Jan 31, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion keepass-enhance.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Keepass Enhance
    // @namespace https://gist.github.com/jeffrey4l/aa9cdae0453cdfd0891c06e6f0303c40
    // @version 0.2
    // @version 0.3
    // @description try to take over the world!
    // @author Jeffrey4l
    // @match http://*/*
  11. jeffrey4l revised this gist Jan 31, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions keepass-enhance.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Keepass Enhance
    // @namespace http://tampermonkey.net/
    // @version 0.1
    // @namespace https://gist.github.com/jeffrey4l/aa9cdae0453cdfd0891c06e6f0303c40
    // @version 0.2
    // @description try to take over the world!
    // @author Jeffrey4l
    // @match http://*/*
  12. jeffrey4l renamed this gist Jan 27, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  13. jeffrey4l renamed this gist Jan 27, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  14. jeffrey4l created this gist Jan 27, 2021.
    33 changes: 33 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    // ==UserScript==
    // @name Keepass Enhance
    // @namespace http://tampermonkey.net/
    // @version 0.1
    // @description try to take over the world!
    // @author Jeffrey4l
    // @match http://*/*
    // @match https://*/*
    // @grant none
    // ==/UserScript==

    (function() {
    'use strict';

    var mappings = {
    "abc.com": "abc site"
    };
    var titleDoc = document.getElementsByTagName('title')[0]
    if (titleDoc === undefined){
    return
    }
    var founded=false;
    for (var url in mappings) {
    if (window.location.host.indexOf(url) != -1) {
    titleDoc.text += " - " + mappings[url]
    founded = true
    break;
    }
    }
    if (!founded){
    titleDoc.text += " - " + window.location.host
    }
    })();