+ Pleer.com via server-side

* param is selfclosed tag
This commit is contained in:
Nokita Kaze 2014-11-16 13:27:54 +03:00
parent 185339769f
commit e3f5358ad0
5 changed files with 51 additions and 14 deletions

View File

@ -181,3 +181,7 @@ div#markItUpText-input {
background: #f2eceb; background: #f2eceb;
} }
/* Embeded audio */
audio.embeded_audio{
display: block;
}

View File

@ -22,6 +22,8 @@ var ppOptions = [
// SoundCloud // SoundCloud
'option_embedding_soundcloud', 'option_embedding_soundcloud',
'option_embedding_soundcloud_orig_link', 'option_embedding_soundcloud_orig_link',
// Pleer.com
'option_embedding_pleercom',
// Fluid layout // Fluid layout
'option_fluid_layout', 'option_fluid_layout',
// Visual editor for posts // 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_videos_parse_webm = $('#option-videos-parse-webm').prop('checked');
ppOptions.option_embedding_soundcloud = $('#option-embedding-soundcloud').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_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.option_visual_editor_post = $('#option-visual-editor-post').prop('checked');
ppOptions.checkbox_search_with_google = $('#option-search-with-google').prop('checked'); ppOptions.checkbox_search_with_google = $('#option-search-with-google').prop('checked');
ppOptions.option_ws = $('#option-ws').prop('checked'); ppOptions.option_ws = $('#option-ws').prop('checked');

View File

@ -12,13 +12,14 @@ $(document).ready(function() {
// Embedding // Embedding
if (options.option_embedding == true) { if (options.option_embedding == true) {
// Load pictures from Booru, Tumblr and some other sites // 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(); load_all_booru_images();
} }
// Parse webm-links and create video instead // Parse webm-links and create video instead
if (options.option_videos_parse_webm == true){ if (options.option_videos_parse_webm == true) {
parse_webm(); parse_webm();
} }
// Soundcloud // Soundcloud
if (options.option_embedding_soundcloud == true) { if (options.option_embedding_soundcloud == true) {
// Injecting JS API // Injecting JS API
@ -26,22 +27,22 @@ $(document).ready(function() {
type: 'injectJSFile', type: 'injectJSFile',
file: 'js/soundcloud/soundcloud.player.api.js' file: 'js/soundcloud/soundcloud.player.api.js'
}); });
// Processing links // 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)); console.log($(this));
$player = $('<div class="pp-soundcloud">\ $player = $('<div class="pp-soundcloud">\
<object height="81" width="100%" id="pp-soundcloud-' + index + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">\ <object height="81" width="100%" id="pp-soundcloud-' + index + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">\
<param name="movie" value="http://player.soundcloud.com/player.swf?url=' + encodeURIComponent($(this).prop('href')) <param name="movie" value="http://player.soundcloud.com/player.swf?url=' + encodeURIComponent($(this).prop('href'))
+ '&enable_api=true&object_id=pp-soundcloud-' + index + '"></param>\ + '&enable_api=true&object_id=pp-soundcloud-' + index + '"></param>\
<param name="allowscriptaccess" value="always"></param>\ <param name="allowscriptaccess" value="always">\
<embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url=' <embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url='
+ encodeURIComponent($(this).prop('href')) + '&enable_api=true&object_id=pp-soundcloud-' + index + encodeURIComponent($(this).prop('href')) + '&enable_api=true&object_id=pp-soundcloud-' + index
+ '" type="application/x-shockwave-flash" width="100%" name="pp-soundcloud-' + index + '"></embed>\ + '" type="application/x-shockwave-flash" width="100%" name="pp-soundcloud-' + index + '"></embed>\
</object>\ </object>\
</div>'); </div>');
// Replace or prepend // Replace or prepend
if (options.option_embedding_soundcloud_orig_link == true) { if (options.option_embedding_soundcloud_orig_link == true) {
// Before // Before
@ -51,6 +52,11 @@ $(document).ready(function() {
$(this).replaceWith($player); $(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);
}
});
}

View File

@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "Point+", "name": "Point+",
"version": "1.10.0", "version": "1.10.1",
"author": "Alexey Skobkin", "author": "Alexey Skobkin",
"homepage_url": "https://bitbucket.org/skobkin/chrome_point_plus", "homepage_url": "https://bitbucket.org/skobkin/chrome_point_plus",
"description": "More features for point.im", "description": "More features for point.im",

View File

@ -52,7 +52,7 @@
<div class="option"> <div class="option">
<input type="checkbox" id="option-videos-parse-webm"><label for="option-videos-parse-webm">Parse webm-links and create video instead</label> <input type="checkbox" id="option-videos-parse-webm"><label for="option-videos-parse-webm">Parse webm-links and create video instead</label>
</div> </div>
<div class="option"> <div class="option">
<input type="checkbox" id="option-embedding-soundcloud"><label for="option-embedding-soundcloud">Soundcloud &#9660;</label> <input type="checkbox" id="option-embedding-soundcloud"><label for="option-embedding-soundcloud">Soundcloud &#9660;</label>
@ -60,6 +60,10 @@
<input type="checkbox" id="option-embedding-soundcloud-orig-link"><label for="option-embedding-soundcloud-orig-link">Leave original link</label> <input type="checkbox" id="option-embedding-soundcloud-orig-link"><label for="option-embedding-soundcloud-orig-link">Leave original link</label>
</div> </div>
</div> </div>
<div class="option">
<input type="checkbox" id="option-embedding-pleercom"><label for="option-embedding-pleercom">Pleer.com</label>
</div>
</div> </div>
</div> </div>