cutt.ly URL shorten button

set a URL-shorten button at the bottom left corner

Versão de: 20/04/2020. Veja: a última versão.

// ==UserScript==
// @name		cutt.ly URL shorten button
// @name:zh-TW		cutt.ly 縮短網址按鈕
// @name:zh-CN		cutt.ly 缩短网址按钮
// @description		set a URL-shorten button at the bottom left corner
// @description:zh-TW	在頁面左下角設置一個縮短網址的按鈕
// @description:zh-CN	在页面左下角设置一个缩短网址的按钮
// @namespace		https://greasyforks.org/zh-TW/users/393133-evan-tseng
// @version		0.1
// @author		Evan Tseng
// @include		*://*
// @exclude		*://cutt.ly/*
// @grant		none
// ==/UserScript==

(async function() {
	'use strict';

	const CuttURL = 'https://cutt.ly/?shortenit='+encodeURIComponent(location.href);

	let strWindowFeatures = 'width=500, height=874, menubar=no, location=yes, resizable=no, status=no';
	var shortenWrap = null,
		shortenButton = null;
	const css = '.__shorten_wrap__ {position: fixed; bottom:20mm; left:-33px; z-index:2147483647}'+
		  '.__shorten_url__ {font: 400 11pt sans-serif; color:#555; background:#eee; padding: 1mm 2mm 2mm; margin:0; line-height:1.1; border:1px solid #555; border-radius:5px; cursor:pointer; transform:rotate(90deg)}'+
		  '.__shorten_url__:hover {color:#448; background:#fff; box-shadow:0 0 2mm rgba(0,0,0,.5)}'+
		  '.__shorten_url__:active {color:#333; background:#eee; box-shadow:inset 0 0 5px rgba(0,0,0,.5)}',
		  cssStyle = document.createElement('style');
	if(cssStyle.styleSheet)	cssStyle.styleSheet.cssText = css;
	else	cssStyle.appendChild(document.createTextNode(css));
	document.querySelector('head').appendChild(cssStyle);

	shortenWrap = document.createElement('div');
	shortenWrap.setAttribute("class", "__shorten_wrap__");
	document.body.appendChild(shortenWrap);

	shortenButton = document.createElement('button');
	shortenButton.setAttribute("class", "__shorten_url__");
	shortenButton.innerText="Cutt URL";
	shortenWrap.appendChild(shortenButton);
	shortenButton.addEventListener("click", function(){
		window.open(CuttURL, "Cuttly URL", strWindowFeatures);
	});

})();
长期地址
遇到问题?请前往 GitHub 提 Issues。