+ Pleer.com embeding

This commit is contained in:
Nokita Kaze 2014-11-16 02:55:13 +03:00
parent 3a756b7452
commit 23a6897289
5 changed files with 36 additions and 2 deletions

View file

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

View file

@ -19,6 +19,8 @@ var ppOptions = [
'option_images_load_booru',
// Wrap WEBM videos into the <video> tag
'option_videos_parse_webm',
// Pleer.com
'option_embedding_pleercom',
// Fluid layout
'option_fluid_layout',
// Visual editor for posts
@ -55,6 +57,7 @@ function pp_save_options() {
ppOptions.option_embedding = document.getElementById('option-embedding').checked;
ppOptions.option_images_load_booru = document.getElementById('option-images-load-booru').checked;
ppOptions.option_videos_parse_webm = document.getElementById('option-videos-parse-webm').checked;
ppOptions.option_embedding_pleercom = document.getElementById('option-embedding-pleercom').checked;
ppOptions.option_visual_editor_post = document.getElementById('option-visual-editor-post').checked;
ppOptions.checkbox_search_with_google = document.getElementById('option-search-with-google').checked;
ppOptions.option_ws = document.getElementById('option-ws').checked;

View file

@ -19,6 +19,10 @@ $(document).ready(function() {
if (options.option_videos_parse_webm == true){
parse_webm();
}
// Parse webm-links and create video instead
if (options.option_embedding_pleercom == true){
parse_pleercom_links();
}
}
// Fancybox
@ -556,3 +560,22 @@ 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'
}).addClass('embeded_audio');
obj.parentElement.insertBefore(player, obj);
}
});
}

View file

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

View file

@ -56,6 +56,10 @@
<div class="option">
<input type="checkbox" id="option-embedding-soundcloud" disabled="disabled"><label for="option-embedding-soundcloud">Soundcloud</label>
</div>
<div class="option">
<input type="checkbox" id="option-embedding-pleercom"><label for="option-embedding-pleercom">Pleer.com</label>
</div>
</div>
</div>