wiki-plugin-audio
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -1,17 +0,12 @@ | ||
/* | ||
* Federated Wiki : Audio Plugin | ||
* | ||
* Licensed under the MIT license. | ||
* https://github.com/fedwiki/wiki-plugin-audio/blob/master/LICENSE.txt | ||
*/ | ||
(function() { | ||
/* | ||
* Federated Wiki : Audio Plugin | ||
* | ||
* Licensed under the MIT license. | ||
* https://github.com/fedwiki/wiki-plugin-audio/blob/master/LICENSE.txt | ||
*/ | ||
var bind, embed, emit, parse; | ||
parse = function(text) { | ||
parse = function(text = '') { | ||
var firstLine, i, len, line, ref, result; | ||
if (text == null) { | ||
text = ''; | ||
} | ||
result = {}; | ||
@@ -33,6 +28,4 @@ firstLine = true; | ||
embed = function(arg) { | ||
var key; | ||
key = arg.key; | ||
return "<iframe\n srcdoc='<audio src=\"" + key + "\" preload=\"none\" controls style=\"width: 100%;\"><a href=\"" + key + "\">download audio</a></audio>'\n width=\"100%\" frameborder=0 seamless scrolling=\"no\" height=\"40px\">\n</iframe>"; | ||
embed = function({key}) { | ||
return `<iframe\n onload="this.height=this.contentWindow.document.body.clientHeight + 5 + 'px'"\n srcdoc='<audio src="${key}" preload="none" controls style="width: 100%;"><a href="${key}">download audio</a></audio>'\n width="100%" frameborder=0 seamless scrolling="no">\n</iframe>`; | ||
}; | ||
@@ -43,3 +36,3 @@ | ||
result = parse(item.text); | ||
return $item.append((embed(result)) + "\n<br>\n<i>" + (wiki.resolveLinks(result.caption || "(no caption)")) + "</i>"); | ||
return $item.append(`${embed(result)}\n<br>\n<i>${wiki.resolveLinks(result.caption || "(no caption)")}</i>`); | ||
}; | ||
@@ -54,13 +47,7 @@ | ||
if (typeof window !== "undefined" && window !== null) { | ||
window.plugins.audio = { | ||
emit: emit, | ||
bind: bind | ||
}; | ||
window.plugins.audio = {emit, bind}; | ||
} | ||
if (typeof module !== "undefined" && module !== null) { | ||
module.exports = { | ||
parse: parse, | ||
embed: embed | ||
}; | ||
module.exports = {parse, embed}; | ||
} | ||
@@ -67,0 +54,0 @@ |
{ | ||
"name": "wiki-plugin-audio", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Federated Wiki - Audio Plugin", | ||
@@ -22,3 +22,3 @@ "keywords": [ | ||
"grunt": "^1.0.1", | ||
"grunt-contrib-coffee": "^1.0.0", | ||
"grunt-contrib-coffee": "^2.0.0", | ||
"grunt-contrib-watch": "^1.0.0", | ||
@@ -25,0 +25,0 @@ "grunt-git-authors": "^3.0.0" |
Sorry, the diff of this file is not supported yet
28867
8
48