1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/dokuwiki_ynh.git synced 2024-09-03 18:26:20 +02:00
dokuwiki_ynh/sources/lib/plugins/vshare/script.js
2014-07-20 13:53:34 +02:00

35 lines
949 B
JavaScript

/**
* Append a toolbar button
*/
if(window.toolbar != undefined){
toolbar[toolbar.length] = {"type": "pluginvshare",
"title": LANG['plugins']['vshare']['button'],
"icon": DOKU_BASE+"lib/plugins/vshare/button.png",
"key": ""};
}
/**
* Try to determine the video service, extract the ID and insert
* the correct syntax
*/
function tb_pluginvshare(btn, props, edid) {
var text = prompt(LANG['plugins']['vshare']['prompt']);
if(!text) return;
// This includes the site patterns:
/* DOKUWIKI:include sites.js */
for (var key in sites){
var RE = new RegExp(sites[key],'i');
var match = text.match(RE);
if(match){
var code = '{{'+key+'>'+match[1]+'?medium}}';
insertAtCarret(edid, code);
return;
}
}
alert(LANG['plugins']['vshare']['notfound']);
}