mirror of
https://bitbucket.org/skobkin/chrome_point_plus.git
synced 2024-11-23 10:46:02 +00:00
+ Парсер coub.com
This commit is contained in:
parent
817ef68473
commit
4b13936dfa
|
@ -83,6 +83,9 @@
|
|||
"option_embedding_pleercom_nokita_server": {
|
||||
"message": "Use Nokita's server instead of AJAX to get mp3 link"
|
||||
},
|
||||
"option_embedding_coubcom": {
|
||||
"message": "Coub.com ▼"
|
||||
},
|
||||
"option_nsfw": {
|
||||
"message": "NSFW content filtering"
|
||||
},
|
||||
|
|
|
@ -83,6 +83,9 @@
|
|||
"option_embedding_pleercom_nokita_server": {
|
||||
"message": "Использовать сервер @NokitaKaze вместо AJAX-запроса для получения mp3"
|
||||
},
|
||||
"option_embedding_coubcom": {
|
||||
"message": "Coub.com ▼"
|
||||
},
|
||||
"option_nsfw": {
|
||||
"message": "Фильтрация NSFW-контента"
|
||||
},
|
||||
|
|
|
@ -28,8 +28,11 @@ $(document).ready(function() {
|
|||
var options = sync_data.options;
|
||||
|
||||
// Options debug
|
||||
console.debug('Options loaded: '+options);
|
||||
|
||||
try {
|
||||
console.debug('Options loaded: %O', current_options);
|
||||
}catch(e){
|
||||
console.error("Я идиот, убейте меня кто-нибудь: %O", e);
|
||||
}
|
||||
create_tag_system();
|
||||
|
||||
// Embedding
|
||||
|
@ -92,6 +95,11 @@ $(document).ready(function() {
|
|||
if (options.option_embedding_pleercom.value == true) {
|
||||
parse_pleercom_links();
|
||||
}
|
||||
|
||||
// Parse coub.com links and create iframe instead
|
||||
if (options.option_embedding_coubcom.value == true) {
|
||||
parse_coub_links();
|
||||
}
|
||||
}
|
||||
|
||||
// Fancybox
|
||||
|
@ -1016,3 +1024,32 @@ function draft_save_check() {
|
|||
}, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Парсим ссылки на coub
|
||||
function parse_coub_links() {
|
||||
$('.post-content a').each(function(num, obj) {
|
||||
var href = obj.href;
|
||||
var n = null;
|
||||
|
||||
if (n = href.match(new RegExp('^https?:\\/\\/coub\\.com\\/view\\/([0-9a-z]+)', 'i'))) {
|
||||
var player = document.createElement('iframe');
|
||||
var parent_width = $(obj.parentElement).width();
|
||||
$(player).attr({
|
||||
'src': 'https://coub.com/embed/' + n[1] + '?muted=false&autostart=false&originalSize=false&hideTopBar=false&startWithHD=true',
|
||||
'allowfullscreen': 'true'
|
||||
}).css({
|
||||
'max-width': '640px',
|
||||
'border': 'none',
|
||||
'width': Math.floor(parent_width * 0.9),
|
||||
'height': Math.ceil(parent_width * 0.9 * 480 / 640)
|
||||
}).addClass('embeded_video').addClass('embeded_video_' + n[1]);
|
||||
|
||||
obj.parentElement.insertBefore(player, obj);
|
||||
|
||||
if (current_options.option_embedding_coubcom_orig_link.value == false) {
|
||||
$(obj).hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -89,6 +89,14 @@
|
|||
<input type="checkbox" class="option-boolean" id="option-embedding-pleercom-orig-link"><label for="option-embedding-pleercom-orig-link" data-i18n="option_embedding_soundcloud_orig_link"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="option-node">
|
||||
<input type="checkbox" class="option-boolean" id="option-embedding-coubcom"><label for="option-embedding-coubcom" data-i18n="option_embedding_coubcom"></label>
|
||||
|
||||
<div class="option-node">
|
||||
<input type="checkbox" class="option-boolean" id="option-embedding-coubcom-orig-link"><label for="option-embedding-coubcom-orig-link" data-i18n="option_embedding_soundcloud_orig_link"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="option-node">
|
||||
|
|
Loading…
Reference in a new issue