From e8c5246645c2d09ddbe6b1e85d0ebcc1478e7e30 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Fri, 12 Apr 2019 09:31:05 -0500 Subject: [PATCH] Fix share button --- assets/css/videojs-share.css | 4 ++-- assets/js/videojs-share.min.js | 4 ++-- src/invidious/views/components/player.ecr | 4 ++-- src/invidious/views/licenses.ecr | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/assets/css/videojs-share.css b/assets/css/videojs-share.css index 33b1eda7..9fc8bce6 100644 --- a/assets/css/videojs-share.css +++ b/assets/css/videojs-share.css @@ -1,7 +1,7 @@ /** * videojs-share * @version 3.0.0 - * @copyright 2018 Mikhail Khazov + * @copyright 2019 Mikhail Khazov * @license MIT */ -.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-modal-dialog-content{display:flex;align-items:center;padding:0;background-image:linear-gradient(to bottom, rgba(0,0,0,0.77), rgba(0,0,0,0.75))}.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button{position:absolute;right:0;top:5px;width:30px;height:30px;color:#fff;cursor:pointer;opacity:0.9;transition:opacity 0.25s ease-out}.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button:before{content:'×';font-size:20px;line-height:15px}.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button:hover{opacity:1}.video-js .vjs-share{display:flex;flex-direction:column;justify-content:space-around;align-items:center;width:100%;height:100%;max-height:400px}.video-js .vjs-share__top,.video-js .vjs-share__middle,.video-js .vjs-share__bottom{display:flex}.video-js .vjs-share__top,.video-js .vjs-share__middle{flex-direction:column;justify-content:space-between}.video-js .vjs-share__middle{padding:0 25px}.video-js .vjs-share__title{align-self:center;font-size:22px;color:#fff}.video-js .vjs-share__subtitle{width:100%;margin:0 auto 12px;font-size:16px;color:#fff;opacity:0.7}.video-js .vjs-share__short-link-wrapper{position:relative;display:block;width:100%;height:40px;margin:0 auto;margin-bottom:15px;border:0;color:rgba(255,255,255,0.65);background-color:#363636;outline:none;overflow:hidden;flex-shrink:0}.video-js .vjs-share__short-link{display:block;width:100%;height:100%;padding:0 40px 0 15px;border:0;color:rgba(255,255,255,0.65);background-color:#363636;outline:none}.video-js .vjs-share__btn{position:absolute;right:0;bottom:0;height:40px;width:40px;display:flex;align-items:center;padding:0 11px;border:0;color:#fff;background-color:#2e2e2e;background-size:18px 19px;background-position:center;background-repeat:no-repeat;cursor:pointer;outline:none;transition:width 0.3s ease-out, padding 0.3s ease-out}.video-js .vjs-share__btn svg{flex-shrink:0}.video-js .vjs-share__btn span{position:relative;padding-left:10px;opacity:0;transition:opacity 0.3s ease-out}.video-js .vjs-share__btn:hover{justify-content:center;width:100%;padding:0 40px;background-image:none}.video-js .vjs-share__btn:hover span{opacity:1}.video-js .vjs-share__socials{display:flex;flex-wrap:wrap;justify-content:center;align-content:flex-start;transition:width 0.3s ease-out, height 0.3s ease-out}.video-js .vjs-share__social{display:flex;justify-content:center;align-items:center;flex-shrink:0;width:32px;height:32px;margin-right:6px;margin-bottom:6px;cursor:pointer;font-size:8px;transition:transform 0.3s ease-out, filter 0.2s ease-out;border:none;outline:none}.video-js .vjs-share__social:hover{filter:brightness(115%)}.video-js .vjs-share__social svg{overflow:visible;max-height:24px}.video-js .vjs-share__social_vk{background-color:#5d7294}.video-js .vjs-share__social_ok{background-color:#ed7c20}.video-js .vjs-share__social_mail{background-color:#134785}.video-js .vjs-share__social_tw{background-color:#76aaeb}.video-js .vjs-share__social_reddit{background-color:#ff4500}.video-js .vjs-share__social_fbFeed{background-color:#475995}.video-js .vjs-share__social_messenger{background-color:#0084ff}.video-js .vjs-share__social_gp{background-color:#d53f35}.video-js .vjs-share__social_linkedin{background-color:#0077b5}.video-js .vjs-share__social_viber{background-color:#766db5}.video-js .vjs-share__social_telegram{background-color:#4bb0e2}.video-js .vjs-share__social_whatsapp{background-color:#78c870}.video-js .vjs-share__bottom{justify-content:center}@media (max-height: 220px){.video-js .vjs-share .hidden-xs{display:none}}@media (max-height: 350px){.video-js .vjs-share .hidden-sm{display:none}}@media (min-height: 400px){.video-js .vjs-share__title{margin-bottom:15px}.video-js .vjs-share__short-link-wrapper{margin-bottom:30px}}@media (min-width: 320px){.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button{right:5px;top:10px}}@media (min-width: 660px){.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button{right:20px;top:20px}.video-js .vjs-share__social{width:40px;height:40px}} +.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-modal-dialog-content{display:flex;align-items:center;padding:0;background-image:linear-gradient(to bottom, rgba(0,0,0,0.77), rgba(0,0,0,0.75))}.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button{position:absolute;right:0;top:5px;width:30px;height:30px;color:#fff;cursor:pointer;opacity:0.9;transition:opacity 0.25s ease-out}.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button:before{content:'×';font-size:20px;line-height:15px}.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button:hover{opacity:1}.video-js .vjs-share{display:flex;flex-direction:column;justify-content:space-around;align-items:center;width:100%;height:100%;max-height:400px}.video-js .vjs-share__top,.video-js .vjs-share__middle,.video-js .vjs-share__bottom{display:flex}.video-js .vjs-share__top,.video-js .vjs-share__middle{flex-direction:column;justify-content:space-between}.video-js .vjs-share__middle{padding:0 25px}.video-js .vjs-share__title{align-self:center;font-size:22px;color:#fff}.video-js .vjs-share__subtitle{width:100%;margin:0 auto 12px;font-size:16px;color:#fff;opacity:0.7}.video-js .vjs-share__short-link-wrapper{position:relative;display:block;width:100%;height:40px;margin:0 auto;margin-bottom:15px;border:0;color:rgba(255,255,255,0.65);background-color:#363636;outline:none;overflow:hidden;flex-shrink:0}.video-js .vjs-share__short-link{display:block;width:100%;height:100%;padding:0 40px 0 15px;border:0;color:rgba(255,255,255,0.65);background-color:#363636;outline:none}.video-js .vjs-share__btn{position:absolute;right:0;bottom:0;height:40px;width:40px;display:flex;align-items:center;padding:0 11px;border:0;color:#fff;background-color:#2e2e2e;background-size:18px 19px;background-position:center;background-repeat:no-repeat;cursor:pointer;outline:none;transition:width 0.3s ease-out, padding 0.3s ease-out}.video-js .vjs-share__btn svg{flex-shrink:0}.video-js .vjs-share__btn span{position:relative;padding-left:10px;opacity:0;transition:opacity 0.3s ease-out}.video-js .vjs-share__btn:hover{justify-content:center;width:100%;padding:0 40px;background-image:none}.video-js .vjs-share__btn:hover span{opacity:1}.video-js .vjs-share__socials{display:flex;flex-wrap:wrap;justify-content:center;align-content:flex-start;transition:width 0.3s ease-out, height 0.3s ease-out}.video-js .vjs-share__social{display:flex;justify-content:center;align-items:center;flex-shrink:0;width:32px;height:32px;margin-right:6px;margin-bottom:6px;cursor:pointer;font-size:8px;transition:transform 0.3s ease-out, filter 0.2s ease-out;border:none;outline:none}.video-js .vjs-share__social:hover{filter:brightness(115%)}.video-js .vjs-share__social svg{overflow:visible;max-height:24px}.video-js .vjs-share__social_vk{background-color:#5d7294}.video-js .vjs-share__social_ok{background-color:#ed7c20}.video-js .vjs-share__social_mail,.video-js .vjs-share__social_email{background-color:#134785}.video-js .vjs-share__social_tw{background-color:#76aaeb}.video-js .vjs-share__social_reddit{background-color:#ff4500}.video-js .vjs-share__social_fbFeed{background-color:#475995}.video-js .vjs-share__social_messenger{background-color:#0084ff}.video-js .vjs-share__social_gp{background-color:#d53f35}.video-js .vjs-share__social_linkedin{background-color:#0077b5}.video-js .vjs-share__social_viber{background-color:#766db5}.video-js .vjs-share__social_telegram{background-color:#4bb0e2}.video-js .vjs-share__social_whatsapp{background-color:#78c870}.video-js .vjs-share__bottom{justify-content:center}@media (max-height: 220px){.video-js .vjs-share .hidden-xs{display:none}}@media (max-height: 350px){.video-js .vjs-share .hidden-sm{display:none}}@media (min-height: 400px){.video-js .vjs-share__title{margin-bottom:15px}.video-js .vjs-share__short-link-wrapper{margin-bottom:30px}}@media (min-width: 320px){.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button{right:5px;top:10px}}@media (min-width: 660px){.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button{right:20px;top:20px}.video-js .vjs-share__social{width:40px;height:40px}} diff --git a/assets/js/videojs-share.min.js b/assets/js/videojs-share.min.js index b157cbdf..9c3e7c4e 100644 --- a/assets/js/videojs-share.min.js +++ b/assets/js/videojs-share.min.js @@ -1,7 +1,7 @@ /** * videojs-share * @version 3.0.0 - * @copyright 2018 Mikhail Khazov + * @copyright 2019 Mikhail Khazov * @license MIT */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],e):t.videojsShare=e(t.videojs)}(this,function(t){"use strict";function e(t,e){return e={exports:{}},t(e,e.exports),e.exports}function n(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var i=window.getSelection(),o=document.createRange();o.selectNodeContents(t),i.removeAllRanges(),i.addRange(o),e=i.toString()}return e}function i(){}function o(t,e){for(;t&&t.nodeType!==J;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}function r(t,e,n,i,o){var r=l.apply(this,arguments);return t.addEventListener(n,r,o),{destroy:function(){t.removeEventListener(n,r,o)}}}function a(t,e,n,i,o){return"function"==typeof t.addEventListener?r.apply(null,arguments):"function"==typeof n?r.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,function(t){return r(t,e,n,i,o)}))}function l(t,e,n,i){return function(n){n.delegateTarget=Q(n.target,e),n.delegateTarget&&i.call(t,n)}}function s(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!G.string(e))throw new TypeError("Second argument must be a String");if(!G.fn(n))throw new TypeError("Third argument must be a Function");if(G.node(t))return c(t,e,n);if(G.nodeList(t))return u(t,e,n);if(G.string(t))return h(t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function c(t,e,n){return t.addEventListener(e,n),{destroy:function(){t.removeEventListener(e,n)}}}function u(t,e,n){return Array.prototype.forEach.call(t,function(t){t.addEventListener(e,n)}),{destroy:function(){Array.prototype.forEach.call(t,function(t){t.removeEventListener(e,n)})}}}function h(t,e,n){return Z(document.body,t,e,n)}function d(t){return Object.keys(t).filter(function(e){return void 0!==t[e]&&""!==t[e]}).map(function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])}).join("&")}function f(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.fbAppId,n=t.url,i=t.redirectUri;if(!e)throw new Error("fbAppId is not defined");var o=d({app_id:e,display:"popup",redirect_uri:i,link:n});return window.open("https://www.facebook.com/dialog/feed?"+o,"_blank",et)}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.fbAppId,n=t.url,i=t.hashtag,o=t.redirectUri;if(!e)throw new Error("fbAppId is not defined");var r=d({app_id:e,display:"popup",redirect_uri:o,href:n,hashtag:i});return window.open("https://www.facebook.com/dialog/share?"+r,"_blank",et)}function v(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).url;if(!t)throw new Error("url is not defined");var e=d({kid_directed_site:"0",sdk:"joey",u:t,display:"popup",ref:"plugin",src:"share_button"});return window.open("https://www.facebook.com/sharer/sharer.php?"+e,"_blank",et)}function g(){var t=d({url:(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).url});return window.open("https://plus.google.com/share?"+t,"_blank",et)}function m(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=d({share_url:t.url,title:t.title,description:t.description,imageurl:t.image});return window.open("http://connect.mail.ru/share?"+e,"_blank",et)}function w(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.url,n=t.title,i=t.description,o=(n||"")+"\r\n"+(i||"")+"\r\n"+(e||""),r="mailto:?body="+encodeURIComponent(o);return window.location.assign(r)}function y(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=d({"st.cmd":"addShare","st._surl":t.url,title:t.title});return window.open("https://ok.ru/dk?"+e,"_blank",et)}function b(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=d({url:t.url,text:t.title});return window.open("https://t.me/share/url?"+e,"_blank",et)}function k(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.title,n=t.url,i=t.hashtags,o=d({text:e,url:n,hashtags:(void 0===i?[]:i).join(",")});return window.open("https://twitter.com/intent/tweet?"+o,"_blank",et)}function _(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=d({url:t.url,title:t.title});return window.open("https://www.reddit.com/submit?"+e,"_blank",et)}function C(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.description,n=d({url:t.url,description:e,media:t.media});return window.open("https://pinterest.com/pin/create/button/?"+n,"_blank",et)}function x(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.url,n=t.title,i=t.caption,o=t.tags,r=void 0===o?[]:o,a=t.posttype,l=void 0===a?"link":a,s=d({canonicalUrl:e,title:n,caption:i,tags:r.join(","),posttype:l});return window.open("https://www.tumblr.com/widgets/share/tool?"+s,"_blank",et)}function E(){return!!window.navigator.userAgent.match(/Version\/[\d.]+.*Safari/)}function j(t){return E()?window.open(t):window.location.assign(t)}function S(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.url,n=t.title;if(!e&&!n)throw new Error("url and title not specified");return j("viber://forward?"+d({text:[n,e].filter(function(t){return t}).join(" ")}))}function F(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.url,n=t.image,i=t.isVkParse,o=t.description,r=t.title;o&&o.length>nt&&(o=o.substr(0,nt)+"..."),r&&r.length>nt&&(r=r.substr(0,nt)+"...");return"https://vk.com/share.php?"+d(i?{url:e}:{url:e,title:r,description:o,image:n,noparse:!0})}function A(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return window.open(F(t),"_blank",et)}function T(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.phone,n=d({text:[t.title,t.url].filter(function(t){return t}).join(" "),phone:e});return window.open("https://api.whatsapp.com/send?"+n,"_blank",et)}function z(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.title,n=t.url,i=d({title:e,summary:t.description,url:n});return window.open("https://www.linkedin.com/shareArticle?mini=true&"+i,"_blank",et)}function M(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.fbAppId,n=t.url;if(!e)throw new Error("fbAppId is not defined");var i=d({app_id:e,link:n});return window.location.assign("fb-messenger://share?"+i)}function O(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.title,n=t.url;if(!n)throw new Error("url is not defined");var i=encodeURIComponent(""+n);return e&&(i=""+encodeURIComponent(e+" ")+i),window.open("https://line.me/R/msg/text/?"+i,"_blank",et)}function L(){return"ontouchstart"in window||navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0}function V(){return/Android/.test(window.navigator.userAgent)||/iP(hone|ad|od)/i.test(window.navigator.userAgent)}function H(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?V()?t:t.filter(function(t){return!ot.includes(t)}):t}t="default"in t?t.default:t;var I=function(){return window.location.href}(),P={mobileVerification:!0,title:"Video",url:I,socials:["fbFeed","tw","reddit","gp","messenger","linkedin","vk","ok","mail","telegram","whatsapp","viber"],embedCode:function(){return""}(),redirectUri:function(){return I+"#close_window"}()},R=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},U=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.container=t.container,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var t=this,e="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px";var n=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=n+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,i.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=(0,i.default)(this.target),this.copyText()}},{key:"copyText",value:function(){var t=void 0;try{t=document.execCommand(this.action)}catch(e){t=!1}this.handleResult(t)}},{key:"handleResult",value:function(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(t){if(void 0!==t){if(!t||"object"!==(void 0===t?"undefined":o(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function(){return this._target}}]),t}();t.exports=a})});i.prototype={on:function(t,e,n){var i=this.e||(this.e={});return(i[t]||(i[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){function i(){o.off(t,i),e.apply(n,arguments)}var o=this;return i._=e,this.on(t,i,n)},emit:function(t){var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),i=0,o=n.length;for(i;i0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===d(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=(0,h.default)(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new c.default({action:this.action(e),target:this.target(e),text:this.text(e),container:this.container,trigger:e,emitter:this})}},{key:"defaultAction",value:function(t){return s("action",t)}},{key:"defaultTarget",value:function(t){var e=s("target",t);if(e)return document.querySelector(e)}},{key:"defaultText",value:function(t){return s("text",t)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],e="string"==typeof t?[t]:t,n=!!document.queryCommandSupported;return e.forEach(function(t){n=n&&!!document.queryCommandSupported(t)}),n}}]),e}(u.default);t.exports=p})})),et="scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0",nt=80,it=(Object.freeze||Object)({fbFeed:f,fbShare:p,fbButton:v,gp:g,mail:m,email:w,ok:y,telegram:b,tw:k,reddit:_,pinterest:C,tumblr:x,viber:S,getVkUrl:F,vk:A,whatsapp:T,linkedin:z,messenger:M,line:O}),ot=["whatsapp","viber","messenger"],rt={fbFeed:'\n \n\n',tw:'\n \n\n',reddit:'\n \n\n',gp:'\n \n\n',messenger:'\n \n \n\n',linkedin:'\n \n\n',vk:'\n \n\n',ok:'\n \n\n',mail:'\n \n\n',telegram:'\n \n\n',whatsapp:'\n \n\n',viber:'\n \n\n'},at=function(){function t(e,n){R(this,t),this.player=e,this.options=n,this.socials=H(n.socials,n.mobileVerification),this.copyBtnTextClass="vjs-share__btn-text",this.socialBtnClass="vjs-share__social",this._createContent(),this._initToggle(),this._initClipboard(),this._initSharing()}return t.prototype.getContent=function(){return this.content},t.prototype._createContent=function(){var t='\n \n \n \n '+this.player.localize("Copy")+"\n ",e=document.createElement("div"),n="";this.options.embedCode&&(n='\n \n "),e.innerHTML='
\n \n\n
\n \n \n \n "+n+'\n
\n\n
\n
\n '+this._getSocialItems().join("")+"\n
\n
\n
",this.content=e.firstChild},t.prototype._initClipboard=function(){var t=this;new tt(".vjs-share__btn",{target:function(t){return t.previousElementSibling}}).on("success",function(e){var n=e.trigger.querySelector("."+t.copyBtnTextClass),i=function(){n.innerText=t.player.localize("Copy"),e.clearSelection()};n.innerText=t.player.localize("Copied"),L()?setTimeout(i,1e3):n.parentElement.addEventListener("mouseleave",function(){setTimeout(i,300)})})},t.prototype._initSharing=function(){var t=this,e=this.content.querySelectorAll("."+this.socialBtnClass);Array.from(e).forEach(function(e){e.addEventListener("click",function(e){var n=e.currentTarget.getAttribute("data-social");"function"==typeof it[n]&&it[n](t.socialOptions)})})},t.prototype._initToggle=function(){var t=this.content.querySelector(".vjs-share__socials");this.socials.length>10||window.innerWidth<=180&&this.socials.length>6?t.style.height="calc((2em + 5px) * 2)":t.classList.add("horizontal")},t.prototype._getSocialItems=function(){var t=[];return this.socials.forEach(function(e){rt[e]&&t.push('\n \n ")}),t},U(t,[{key:"socialOptions",get:function(){var t=this.options;return{url:t.url,title:t.title,description:t.description,image:t.image,fbAppId:t.fbAppId,isVkParse:t.isVkParse,redirectUri:t.redirectUri}}}]),t}(),lt=function(t){function e(n,i){R(this,e);var o=B(this,t.call(this,n,i));return o.player=n,o.options=i,o}return N(e,t),e.prototype._createModal=function(){var t=new at(this.player,this.options).getContent();this.modal=new D(this.player,{content:t,temporary:!0}),this.el=this.modal.contentEl(),this.player.addChild(this.modal)},e.prototype.open=function(){this._createModal(),this.modal.open()},e}(videojs.getComponent("Component")),st=function(e){function n(i,o){R(this,n);var r=B(this,e.call(this,i));return r.options=t.mergeOptions(P,o),r.player.ready(function(){r.player.addClass("vjs-share"),i.addClass("vjs-videojs-share"),i.getChild("controlBar").addChild("ShareButton",o),i.addChild("ShareOverlay",o)}),r}return N(n,e),n}(t.getPlugin("plugin"));return st.defaultState={},st.VERSION="3.0.0",t.registerComponent("ShareButton",q),t.registerComponent("ShareOverlay",lt),t.registerPlugin("share",st),st}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],e):t.videojsShare=e(t.videojs)}(this,function(t){"use strict";function e(t,e){return e={exports:{}},t(e,e.exports),e.exports}function n(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var i=window.getSelection(),o=document.createRange();o.selectNodeContents(t),i.removeAllRanges(),i.addRange(o),e=i.toString()}return e}function i(){}function o(t,e){for(;t&&t.nodeType!==G;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}function r(t,e,n,i,o){var r=l.apply(this,arguments);return t.addEventListener(n,r,o),{destroy:function(){t.removeEventListener(n,r,o)}}}function a(t,e,n,i,o){return"function"==typeof t.addEventListener?r.apply(null,arguments):"function"==typeof n?r.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,function(t){return r(t,e,n,i,o)}))}function l(t,e,n,i){return function(n){n.delegateTarget=K(n.target,e),n.delegateTarget&&i.call(t,n)}}function s(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!X.string(e))throw new TypeError("Second argument must be a String");if(!X.fn(n))throw new TypeError("Third argument must be a Function");if(X.node(t))return c(t,e,n);if(X.nodeList(t))return u(t,e,n);if(X.string(t))return h(t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function c(t,e,n){return t.addEventListener(e,n),{destroy:function(){t.removeEventListener(e,n)}}}function u(t,e,n){return Array.prototype.forEach.call(t,function(t){t.addEventListener(e,n)}),{destroy:function(){Array.prototype.forEach.call(t,function(t){t.removeEventListener(e,n)})}}}function h(t,e,n){return Q(document.body,t,e,n)}function d(t){return Object.keys(t).filter(function(e){return void 0!==t[e]&&""!==t[e]}).map(function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])}).join("&")}function f(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.fbAppId,n=t.url,i=t.redirectUri;if(!e)throw new Error("fbAppId is not defined");var o=d({app_id:e,display:"popup",redirect_uri:i,link:n});return window.open("https://www.facebook.com/dialog/feed?"+o,"_blank",tt)}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.fbAppId,n=t.url,i=t.hashtag,o=t.redirectUri;if(!e)throw new Error("fbAppId is not defined");var r=d({app_id:e,display:"popup",redirect_uri:o,href:n,hashtag:i});return window.open("https://www.facebook.com/dialog/share?"+r,"_blank",tt)}function v(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).url;if(!t)throw new Error("url is not defined");var e=d({kid_directed_site:"0",sdk:"joey",u:t,display:"popup",ref:"plugin",src:"share_button"});return window.open("https://www.facebook.com/sharer/sharer.php?"+e,"_blank",tt)}function g(){var t=d({url:(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).url});return window.open("https://plus.google.com/share?"+t,"_blank",tt)}function w(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=d({share_url:t.url,title:t.title,description:t.description,imageurl:t.image});return window.open("http://connect.mail.ru/share?"+e,"_blank",tt)}function m(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.url,n=t.title,i=t.description,o=(n||"")+"\r\n"+(i||"")+"\r\n"+(e||""),r="mailto:?body="+encodeURIComponent(o);return window.location.assign(r)}function y(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=d({"st.cmd":"addShare","st._surl":t.url,title:t.title});return window.open("https://ok.ru/dk?"+e,"_blank",tt)}function b(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=d({url:t.url,text:t.title});return window.open("https://t.me/share/url?"+e,"_blank",tt)}function k(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.title,n=t.url,i=t.hashtags,o=d({text:e,url:n,hashtags:(void 0===i?[]:i).join(",")});return window.open("https://twitter.com/intent/tweet?"+o,"_blank",tt)}function _(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=d({url:t.url,title:t.title});return window.open("https://www.reddit.com/submit?"+e,"_blank",tt)}function C(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.description,n=d({url:t.url,description:e,media:t.media});return window.open("https://pinterest.com/pin/create/button/?"+n,"_blank",tt)}function x(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.url,n=t.title,i=t.caption,o=t.tags,r=void 0===o?[]:o,a=t.posttype,l=void 0===a?"link":a,s=d({canonicalUrl:e,title:n,caption:i,tags:r.join(","),posttype:l});return window.open("https://www.tumblr.com/widgets/share/tool?"+s,"_blank",tt)}function E(){return!!window.navigator.userAgent.match(/Version\/[\d.]+.*Safari/)}function S(t){return E()?window.open(t):window.location.assign(t)}function j(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.url,n=t.title;if(!e&&!n)throw new Error("url and title not specified");return S("viber://forward?"+d({text:[n,e].filter(function(t){return t}).join(" ")}))}function F(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.url,n=t.image,i=t.isVkParse,o=t.description,r=t.title;o&&o.length>et&&(o=o.substr(0,et)+"..."),r&&r.length>et&&(r=r.substr(0,et)+"...");return"https://vk.com/share.php?"+d(i?{url:e}:{url:e,title:r,description:o,image:n,noparse:!0})}function A(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return window.open(F(t),"_blank",tt)}function T(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.phone,n=d({text:[t.title,t.url].filter(function(t){return t}).join(" "),phone:e});return window.open("https://api.whatsapp.com/send?"+n,"_blank",tt)}function z(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.title,n=t.url,i=d({title:e,summary:t.description,url:n});return window.open("https://www.linkedin.com/shareArticle?mini=true&"+i,"_blank",tt)}function M(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.fbAppId,n=t.url;if(!e)throw new Error("fbAppId is not defined");var i=d({app_id:e,link:n});return window.location.assign("fb-messenger://share?"+i)}function O(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.title,n=t.url;if(!n)throw new Error("url is not defined");var i=encodeURIComponent(""+n);return e&&(i=""+encodeURIComponent(e+" ")+i),window.open("https://line.me/R/msg/text/?"+i,"_blank",tt)}function L(){return"ontouchstart"in window||navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0}function V(){return/Android/.test(window.navigator.userAgent)||/iP(hone|ad|od)/i.test(window.navigator.userAgent)}function H(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?V()?t:t.filter(function(t){return!it.includes(t)}):t}t=t&&t.hasOwnProperty("default")?t.default:t;var I=function(){return window.location.href}(),P={mobileVerification:!0,title:"Video",url:I,socials:["fbFeed","tw","reddit","gp","messenger","linkedin","vk","ok","mail","email","telegram","whatsapp","viber"],embedCode:function(){return""}(),redirectUri:function(){return I+"#close_window"}()},R=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},U=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.container=t.container,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var t=this,e="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px";var n=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=n+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,i.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=(0,i.default)(this.target),this.copyText()}},{key:"copyText",value:function(){var t=void 0;try{t=document.execCommand(this.action)}catch(e){t=!1}this.handleResult(t)}},{key:"handleResult",value:function(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(t){if(void 0!==t){if(!t||"object"!==(void 0===t?"undefined":o(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function(){return this._target}}]),t}();t.exports=a})});i.prototype={on:function(t,e,n){var i=this.e||(this.e={});return(i[t]||(i[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){function i(){o.off(t,i),e.apply(n,arguments)}var o=this;return i._=e,this.on(t,i,n)},emit:function(t){var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),i=0,o=n.length;for(i;i0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===d(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=(0,h.default)(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new c.default({action:this.action(e),target:this.target(e),text:this.text(e),container:this.container,trigger:e,emitter:this})}},{key:"defaultAction",value:function(t){return s("action",t)}},{key:"defaultTarget",value:function(t){var e=s("target",t);if(e)return document.querySelector(e)}},{key:"defaultText",value:function(t){return s("text",t)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],e="string"==typeof t?[t]:t,n=!!document.queryCommandSupported;return e.forEach(function(t){n=n&&!!document.queryCommandSupported(t)}),n}}]),e}(u.default);t.exports=p})})),tt="scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0",et=80,nt=(Object.freeze||Object)({fbFeed:f,fbShare:p,fbButton:v,gp:g,mail:w,email:m,ok:y,telegram:b,tw:k,reddit:_,pinterest:C,tumblr:x,viber:j,getVkUrl:F,vk:A,whatsapp:T,linkedin:z,messenger:M,line:O}),it=["whatsapp","viber","messenger"],ot={fbFeed:'\n \n\n',tw:'\n \n\n',reddit:'\n \n\n',gp:'\n \n\n',messenger:'\n \n \n\n',linkedin:'\n \n\n',vk:'\n \n\n',ok:'\n \n\n',mail:'\n \n\n',email:'\n \n\n',telegram:'\n \n\n',whatsapp:'\n \n\n',viber:'\n \n\n'},rt=function(){function t(e,n){R(this,t),this.player=e,this.options=n,this.socials=H(n.socials,n.mobileVerification),this.copyBtnTextClass="vjs-share__btn-text",this.socialBtnClass="vjs-share__social",this._createContent(),this._initToggle(),this._initClipboard(),this._initSharing()}return t.prototype.getContent=function(){return this.content},t.prototype._createContent=function(){var t='\n \n \n \n '+this.player.localize("Copy")+"\n ",e=document.createElement("div"),n="";this.options.embedCode&&(n='\n \n "),e.innerHTML='
\n \n\n
\n \n \n\n "+n+'\n
\n\n
\n
\n '+this._getSocialItems().join("")+"\n
\n
\n
",this.content=e.firstChild},t.prototype._initClipboard=function(){var t=this;new $(".vjs-share__btn",{target:function(t){return t.previousElementSibling}}).on("success",function(e){var n=e.trigger.querySelector("."+t.copyBtnTextClass),i=function(){n.innerText=t.player.localize("Copy"),e.clearSelection()};n.innerText=t.player.localize("Copied"),L()?setTimeout(i,1e3):n.parentElement.addEventListener("mouseleave",function(){setTimeout(i,300)})})},t.prototype._initSharing=function(){var t=this,e=this.content.querySelectorAll("."+this.socialBtnClass);Array.from(e).forEach(function(e){e.addEventListener("click",function(e){var n=e.currentTarget.getAttribute("data-social"),i=nt[n];"function"==typeof i&&i(t.socialOptions)})})},t.prototype._initToggle=function(){var t=this.content.querySelector(".vjs-share__socials");this.socials.length>10||window.innerWidth<=180&&this.socials.length>6?t.style.height="calc((2em + 5px) * 2)":t.classList.add("horizontal")},t.prototype._getSocialItems=function(){var t=[];return this.socials.forEach(function(e){ot[e]&&t.push('\n \n ")}),t},U(t,[{key:"socialOptions",get:function(){var t=this.options;return{url:t.url,title:t.title,description:t.description,image:t.image,fbAppId:t.fbAppId,isVkParse:t.isVkParse,redirectUri:t.redirectUri,subject:t.subject}}}]),t}(),at=function(t){function e(n,i){R(this,e);var o=B(this,t.call(this,n,i));return o.playerClassName="vjs-videojs-share_open",o}return N(e,t),e.prototype.open=function(){var e=this.player();e.addClass(this.playerClassName),t.prototype.open.call(this),e.trigger("sharing:opened")},e.prototype.close=function(){var e=this.player();e.removeClass(this.playerClassName),t.prototype.close.call(this),e.trigger("sharing:closed")},e}(t.getComponent("ModalDialog")),lt=function(t){function e(n,i){R(this,e);var o=B(this,t.call(this,n,i));return o.player=n,o.options=i,o}return N(e,t),e.prototype._createModal=function(){var t=new rt(this.player,this.options).getContent();this.modal=new at(this.player,{content:t,temporary:!0}),this.el=this.modal.contentEl(),this.player.addChild(this.modal)},e.prototype.open=function(){this._createModal(),this.modal.open()},e}(t.getComponent("Component")),st=function(e){function n(i,o){R(this,n);var r=B(this,e.call(this,i));return r.options=t.mergeOptions(P,o),r.player.ready(function(){r.player.addClass("vjs-share"),i.addClass("vjs-videojs-share"),i.getChild("controlBar").addChild("ShareButton",o),i.addChild("ShareOverlay",o)}),r}return N(n,e),n}(t.getPlugin("plugin"));return st.defaultState={},st.VERSION="3.0.0",t.registerComponent("ShareButton",q),t.registerComponent("ShareOverlay",lt),t.registerPlugin("share",st),st}); \ No newline at end of file diff --git a/src/invidious/views/components/player.ecr b/src/invidious/views/components/player.ecr index 5609da98..b9158e39 100644 --- a/src/invidious/views/components/player.ecr +++ b/src/invidious/views/components/player.ecr @@ -63,9 +63,9 @@ var options = { }; var shareOptions = { - socials: ["fb", "tw", "reddit", "mail"], + socials: ["fbFeed", "tw", "reddit", "email"], - url: "<%= host_url %>/<%= video.id %>?<%= host_params %>", + url: window.location.href, title: "<%= video.title.dump_unquoted %>", description: "<%= description %>", image: "<%= thumbnail %>", diff --git a/src/invidious/views/licenses.ecr b/src/invidious/views/licenses.ecr index a6f13dca..dda42ea8 100644 --- a/src/invidious/views/licenses.ecr +++ b/src/invidious/views/licenses.ecr @@ -117,7 +117,7 @@ - <%= translate(locale, "source") %> + <%= translate(locale, "source") %>