+ 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;
}
/* Embeded audio */
audio.embeded_audio{
display: block;
}

View file

@ -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');

View file

@ -19,6 +19,7 @@ $(document).ready(function() {
if (options.option_videos_parse_webm == true) {
parse_webm();
}
// Soundcloud
if (options.option_embedding_soundcloud == true) {
// Injecting JS API
@ -35,7 +36,7 @@ $(document).ready(function() {
<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'))
+ '&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='
+ encodeURIComponent($(this).prop('href')) + '&enable_api=true&object_id=pp-soundcloud-' + index
+ '" type="application/x-shockwave-flash" width="100%" name="pp-soundcloud-' + index + '"></embed>\
@ -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);
}
});
}

View file

@ -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",

View file

@ -60,6 +60,10 @@
<input type="checkbox" id="option-embedding-soundcloud-orig-link"><label for="option-embedding-soundcloud-orig-link">Leave original link</label>
</div>
</div>
<div class="option">
<input type="checkbox" id="option-embedding-pleercom"><label for="option-embedding-pleercom">Pleer.com</label>
</div>
</div>
</div>