diff --git a/CoubDownload-Bridge-Userscript/dist/coub-bridge.user.js b/CoubDownload-Bridge-Userscript/dist/coub-bridge.user.js index 4f60d0c..c36a840 100644 --- a/CoubDownload-Bridge-Userscript/dist/coub-bridge.user.js +++ b/CoubDownload-Bridge-Userscript/dist/coub-bridge.user.js @@ -1,5 +1,5 @@ -// ==UserScript== -// @name coubdownload-bridge-userscript +/*! // ==UserScript== +// @name Coub Bridge // @namespace https://github.com/Venipa/coubdl-bridge // @copyright 2021, coubdownload-bridge-userscript (https://github.com/Venipa/coubdl-bridge) // @version 0.2.3 @@ -12,5 +12,5 @@ // ==/UserScript== // ==OpenUserJS== // @author Venipa -// ==/OpenUserJS== +// ==/OpenUserJS== */ (()=>{"use strict";const r=function(r,e){for(var n=-1,t=e.length,o=r.length;++n0&&o(u)?t>1?e(u,t-1,o,a,c):r(c,u):a||(c[c.length]=u)}return c};const S=function(r){return(null==r?0:r.length)?A(r,1):[]};function O(r){return function(r){if(Array.isArray(r))return j(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||function(r,e){if(!r)return;if("string"==typeof r)return j(r,e);var n=Object.prototype.toString.call(r).slice(8,-1);"Object"===n&&r.constructor&&(n=r.constructor.name);if("Map"===n||"Set"===n)return Array.from(r);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return j(r,e)}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(r,e){(null==e||e>r.length)&&(e=r.length);for(var n=0,t=new Array(e);n0&&n.forEach((function(e,n){e.classList.contains("coubdl-seperator")||e.classList.add("coubdl-button-group-item"),r.appendChild(e)})),r}function L(r,e){for(var n=0;n1?n-1:0),o=1;o1?n-1:0),o=1;o1?n-1:0),o=1;o2?t-2:0),a=2;ar.length)&&(e=r.length);for(var n=0,t=new Array(e);n0})).reduce((function(r,e){return[].concat(C(r),C(e))}),[]).forEach((function(r){if(r&&r.querySelectorAll&&0===r.querySelectorAll("#"+i).length){var e=r.getAttribute("data-permalink"),n=_("Download",{padding:"4px 6px",position:"absolute",top:"0",right:"0",marginTop:"8px",marginRight:"8px",zIndex:"9999"});n.id=i,n.href="coubdl-bridge://"+e,r.prepend(n)}}))},d=new MutationObserver((function(r){var e;if((e=r.filter((function(r){return r.addedNodes&&r.addedNodes.length>0})).map((function(r){return r.addedNodes})).reduce((function(r,e){return[].concat(C(r),C(e))}),[])).length>0&&e){console.log(e);var n=e.filter((function(r){return["coub","coub-page","viewer__video","page","coub--normal-card"].filter((function(e){var n;return null===(n=r.classList)||void 0===n?void 0:n.contains(e)}))}));n.length>0&&(l(n),u(b))}})),s=new MutationObserver((function(r){d.disconnect();var e=Array.from(document.querySelectorAll(".coub.coub--page-card,.coub.coub--timeline,.coubs-list__inner .page, .cobb-page .suggests--page"));l(e),u(e),r.filter((function(r){var e;return null===(e=r.addedNodes)||void 0===e?void 0:e.length})).map((function(r){return Array.from(r.addedNodes)})).reduce((function(r,e){return[].concat(C(r),C(e))}),[]).forEach((function(r){d.observe(r,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}))}));s.observe(document.documentElement,{attributes:!0,characterData:!0,childList:!0,subtree:!0});var f,b=Array.from(document.querySelectorAll(".coub.coub--page-card,.coub.coub--timeline,.coubs-list__inner .page"));l(b),u(b),window.addEventListener("keydown",(function(r){var e,n,t,o;if(r.ctrlKey&&"s"===r.key.toLowerCase()&&(null===(e=getSelection())||void 0===e?void 0:e.anchorNode)&&(n=document.querySelector(".coubs-list .coub.active[data-id][data-permalink]"))&&n.dataset.permalink){r.preventDefault();var a=n.dataset.permalink;t="coubdl-bridge://"+a+"/video",(o=document.createElement("a")).href=t,o.style.height="0",o.style.width="0",o.style.position="fixed",o.click(),o.remove()}})),f=function(){var r,e;c.debug("style add",a.style),r=a.style,(e=k("style")).innerText=r,e.dataset.type="coubdl_bridge.custom_style",document.head.appendChild(e)},c.debug("ready",document.readyState),"loading"!==document.readyState?f():window.addEventListener("DOMContentLoaded",f)}var P={name:"coubdownload-bridge-userscript",description:"Bridge between the desktop and webbrowser to download and merge video & audio from coub",repository:"https://github.com/Venipa/coubdl-bridge",production:!0,version:"0.2.3",style:".coubdl-button {\r\n padding: 8px 12px;\r\n color: #fff;\r\n background: #000;\r\n line-height: 1;\r\n font-size: 0.875rem;\r\n align-self: center;\r\n border-radius: 4px;\r\n position: relative;\r\n}\r\n.coubdl-button:hover,\r\n.coubdl-button:active,\r\n.coubdl-button:focus {\r\n color: #e0e0e0;\r\n text-decoration: none;;\r\n\r\n}\r\n.coubdl-button-group {\r\n color: #fff;\r\n background: #000;\r\n line-height: 1;\r\n font-size: 0.875rem;\r\n display: flex;\r\n align-self: center;\r\n border-radius: 4px;\r\n flex-direction: row;\r\n align-items: center;\r\n overflow: hidden;\r\n box-shadow: 0.7px 3px 0.8px rgba(0, 0, 0, 0.071),\r\n 1px 4.4px 2.7px rgba(0, 0, 0, 0.065), 2px 9px 12px rgba(0, 0, 0, 0.07);\r\n}\r\n\r\n.coubdl-button-group-item {\r\n margin: 0 0.125rem;\r\n}\r\n.coubdl-seperator {\r\n width: 2px;\r\n background-color: rgba(255, 255, 255, 0.185);\r\n border-radius: 18px;\r\n height: 18px;\r\n}\r\n"};Node.prototype.findAncestor=function(r){for(var e=this;(e=e.parentElement)&&!e.matches.call(e,r););return e},T({env:Object.assign({dev:!P.production},P)})})(); \ No newline at end of file diff --git a/CoubDownload-Bridge-Userscript/package.json b/CoubDownload-Bridge-Userscript/package.json index f12fa04..8535ab9 100644 --- a/CoubDownload-Bridge-Userscript/package.json +++ b/CoubDownload-Bridge-Userscript/package.json @@ -6,6 +6,10 @@ "repository": "https://github.com/Venipa/coubdl-bridge", "author": "Venipa", "license": "MIT", + "userscript": { + "name": "Coub Bridge", + "source": "coub-bridge.user.js" + }, "scripts": { "dev": "mix watch", "prod": "mix --production" diff --git a/CoubDownload-Bridge-Userscript/src/banner.template b/CoubDownload-Bridge-Userscript/src/banner.template index 72be886..88196c2 100644 --- a/CoubDownload-Bridge-Userscript/src/banner.template +++ b/CoubDownload-Bridge-Userscript/src/banner.template @@ -1,5 +1,5 @@ // ==UserScript== -// @name {{name}} +// @name {{displayName}} // @namespace {{repository}} // @copyright 2021, {{name}} ({{repository}}) // @version {{version}} diff --git a/CoubDownload-Bridge-Userscript/webpack.mix.js b/CoubDownload-Bridge-Userscript/webpack.mix.js index cb25753..44adc31 100644 --- a/CoubDownload-Bridge-Userscript/webpack.mix.js +++ b/CoubDownload-Bridge-Userscript/webpack.mix.js @@ -20,6 +20,7 @@ const createHashVersion = () => let varContext = { ...pkg, grant: "none", + displayName: pkg.userscript.name }; if (isDev) varContext.version = createHashVersion(); bannerContent = replaceVariables(