jackun / VLCTube

The Unlicense
16 stars 4 forks source link

Request: add custom button #39

Closed feboss closed 9 years ago

feboss commented 9 years ago

I have a simple request. Is not an issue so i'm sorry if i'm writing in the wrong place. Can i have a supplementary download button with another protocol? example download button 1: https://googlevideo.com......... download button 2: custom://googlevideo.com.....

i try to change a little bit the code but i just lost 3h and i'm not able to do...can you paste a little snippet for do that? thank you

jackun commented 9 years ago

Url is signed to the link here and link itself is created here. Copy/paste the link creation code and change element id to something else etc.

Add somewhere around line 3215:

var link = this.doc.createElement("A");
link.id = "customlink";
link.className = "yt-uix-button yt-uix-button-default";
link.title = _("LINKSAVE");
link.setAttribute("href", "#");
link.setAttribute("target", "_new");
link.innerHTML = '<i class="fa fa-lg fa-download"></i>'; //just the download icon
buttons.appendChild(link);

and around line 1396 add:

this.$('customlink').href = "custom://" + src.replace(/https?:\/\//i, "");