From 4b0ca55eb79e963523eb6c8197825e9e8ae904e2 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Mon, 4 May 2015 15:53:29 +0800 Subject: First commit, version 0.2.7 --- public/js/unused.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 public/js/unused.js (limited to 'public/js/unused.js') diff --git a/public/js/unused.js b/public/js/unused.js new file mode 100644 index 00000000..4ff5b280 --- /dev/null +++ b/public/js/unused.js @@ -0,0 +1,45 @@ + + //parse Youtube + result.find(".youtube").each(function (key, value) { + if (!$(value).attr('videoid')) return; + setSizebyAttr(this, this); + var icon = ''; + $(this).append(icon); + var videoid = $(value).attr('videoid'); + var thumbnail_src = '//img.youtube.com/vi/' + videoid + '/hqdefault.jpg'; + $(value).css('background-image', 'url(' + thumbnail_src + ')'); + $(this).click(function () { + imgPlayiframe(this, '//www.youtube.com/embed/'); + }); + }); + //parse vimeo + result.find(".vimeo").each(function (key, value) { + if (!$(value).attr('videoid')) return; + setSizebyAttr(this, this); + var icon = ''; + $(this).append(icon); + var videoid = $(value).attr('videoid'); + $.ajax({ + type: 'GET', + url: 'http://vimeo.com/api/v2/video/' + videoid + '.json', + jsonp: 'callback', + dataType: 'jsonp', + success: function (data) { + var thumbnail_src = data[0].thumbnail_large; + $(value).css('background-image', 'url(' + thumbnail_src + ')'); + } + }); + $(this).click(function () { + imgPlayiframe(this, '//player.vimeo.com/video/'); + }); + }); + //todo list + var lis = result[0].getElementsByTagName('li'); + for (var i = 0; i < lis.length; i++) { + var html = lis[i].innerHTML; + if (/^\s*\[[x ]\]\s*/.test(html)) { + lis[i].innerHTML = html.replace(/^\s*\[ \]\s*/, '') + .replace(/^\s*\[x\]\s*/, ''); + lis[i].setAttribute('class', 'task-list-item'); + } + } \ No newline at end of file -- cgit v1.2.3