From e3f5358ad0c053d2ada21228bc9b6f8cb849f1f0 Mon Sep 17 00:00:00 2001 From: Nokita Kaze Date: Sun, 16 Nov 2014 13:27:54 +0300 Subject: [PATCH] + Pleer.com via server-side * param is selfclosed tag --- chrome_point_plus/css/point-plus.css | 4 +++ chrome_point_plus/js/options.js | 3 ++ chrome_point_plus/js/point-plus.js | 50 +++++++++++++++++++++------- chrome_point_plus/manifest.json | 2 +- chrome_point_plus/options.html | 6 +++- 5 files changed, 51 insertions(+), 14 deletions(-) diff --git a/chrome_point_plus/css/point-plus.css b/chrome_point_plus/css/point-plus.css index f301c67..702a25a 100644 --- a/chrome_point_plus/css/point-plus.css +++ b/chrome_point_plus/css/point-plus.css @@ -181,3 +181,7 @@ div#markItUpText-input { background: #f2eceb; } +/* Embeded audio */ +audio.embeded_audio{ + display: block; +} diff --git a/chrome_point_plus/js/options.js b/chrome_point_plus/js/options.js index 9ec456d..8890c3a 100644 --- a/chrome_point_plus/js/options.js +++ b/chrome_point_plus/js/options.js @@ -22,6 +22,8 @@ var ppOptions = [ // SoundCloud 'option_embedding_soundcloud', 'option_embedding_soundcloud_orig_link', + // Pleer.com + 'option_embedding_pleercom', // Fluid layout 'option_fluid_layout', // Visual editor for posts @@ -60,6 +62,7 @@ function pp_save_options() { ppOptions.option_videos_parse_webm = $('#option-videos-parse-webm').prop('checked'); ppOptions.option_embedding_soundcloud = $('#option-embedding-soundcloud').prop('checked'); ppOptions.option_embedding_soundcloud_orig_link = $('#option-embedding-soundcloud-orig-link').prop('checked'); + ppOptions.option_embedding_pleercom = $('option-embedding-pleercom').prop('checked'); ppOptions.option_visual_editor_post = $('#option-visual-editor-post').prop('checked'); ppOptions.checkbox_search_with_google = $('#option-search-with-google').prop('checked'); ppOptions.option_ws = $('#option-ws').prop('checked'); diff --git a/chrome_point_plus/js/point-plus.js b/chrome_point_plus/js/point-plus.js index 519a613..35a6edf 100644 --- a/chrome_point_plus/js/point-plus.js +++ b/chrome_point_plus/js/point-plus.js @@ -12,13 +12,14 @@ $(document).ready(function() { // Embedding if (options.option_embedding == true) { // Load pictures from Booru, Tumblr and some other sites - if (options.option_images_load_booru == true){ + if (options.option_images_load_booru == true) { load_all_booru_images(); } // Parse webm-links and create video instead - if (options.option_videos_parse_webm == true){ + if (options.option_videos_parse_webm == true) { parse_webm(); } + // Soundcloud if (options.option_embedding_soundcloud == true) { // Injecting JS API @@ -26,22 +27,22 @@ $(document).ready(function() { type: 'injectJSFile', file: 'js/soundcloud/soundcloud.player.api.js' }); - + // Processing links - $('.post .post-content a[href*="\\:\\/\\/soundcloud\\.com\\/"]').each(function(index) { + $('.post .post-content a[href*="\\:\\/\\/soundcloud\\.com\\/"]').each(function (index) { console.log($(this)); - + $player = $('
\ \ - \ - \ - \ + \ + \ + \ \
'); - + // Replace or prepend if (options.option_embedding_soundcloud_orig_link == true) { // Before @@ -51,6 +52,11 @@ $(document).ready(function() { $(this).replaceWith($player); } }); + + } + // Parse webm-links and create video instead + if (options.option_embedding_pleercom == true) { + parse_pleercom_links(); } } @@ -589,3 +595,23 @@ function set_posts_count_label() { }) } + +function parse_pleercom_links() { + $('a').each(function (num, obj) { + var href = obj.href; + var n = null; + + if (n = href.match(new RegExp('^https?:\\/\\/pleer\\.com\\/tracks\\/([0-9a-z]+)', 'i'))) { + var player = document.createElement('audio'); + $(player).attr({ + 'src': 'https://api.kanaria.ru/point/get_pleer_file.php?id=' + n[1], + 'controls': 'controls', + 'preload': 'none' + }).addClass('embeded_audio'); + + obj.parentElement.insertBefore(player, obj); + } + }); + + +} diff --git a/chrome_point_plus/manifest.json b/chrome_point_plus/manifest.json index 0bc612b..30e0d54 100644 --- a/chrome_point_plus/manifest.json +++ b/chrome_point_plus/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Point+", - "version": "1.10.0", + "version": "1.10.1", "author": "Alexey Skobkin", "homepage_url": "https://bitbucket.org/skobkin/chrome_point_plus", "description": "More features for point.im", diff --git a/chrome_point_plus/options.html b/chrome_point_plus/options.html index ef604bb..bf6127d 100644 --- a/chrome_point_plus/options.html +++ b/chrome_point_plus/options.html @@ -52,7 +52,7 @@
- +
@@ -60,6 +60,10 @@
+ +
+ +