Last active
April 27, 2017 12:44
-
-
Save matin0728/e5df230aa453b99253acfceb2f07e6b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getPostContent() { | |
var a = $('<div></div>').html($('#content').html()); | |
a.find('.video-link').each(function(index, obj){$(obj).removeClass('video-box').removeClass('own-video').removeClass('loading').html('')}); | |
return a.html() | |
} | |
window.getPostContent = getPostContent; | |
$('.video-link').each(function(index, link){ | |
if ($(link).data("lens-id")) { | |
var v = $(link) | |
var img = v.data("poster"); // thumbnail. | |
var title = v.data("name"); | |
v.addClass("video-box").addClass("own-video").addClass('loading').html(['<div class="loading" style="background:url(\'', img, '\') no-repeat 50% 50%;background-size:100% 100%;overflow:hidden;"><div class="wrap"><div class="normal"></div></div></div><div class="content"><span class="title">', title, '</span></div>'].join('')); | |
} | |
}); | |
//显示逻辑,转化 video-box | |
$('.video-box').each(function(index, obj){ | |
if ($(obj).data('lens-id') && $(obj).data('lens-id') != "None") { | |
var v = $(obj) | |
var img = v.data("poster"); // thumbnail. | |
var title = v.data("name"); | |
v.addClass("own-video").addClass('loading').html(['<div class="loading" style="background:url(\'', img, '\') no-repeat 50% 50%;background-size:100% 100%;overflow:hidden;"><div class="wrap"><div class="normal"></div></div></div><div class="content"><span class="title">', title, '</span></div>'].join('')); | |
} | |
}) | |
$(document).on('click', 'a.video-box', function(){ | |
if ($(this).data('lens-id') && $(this).data('lens-id') != "None") { | |
window.location.href = ['zhihuinternal://openvideo?video_id=', $(this).data('lens-id')].join(''); | |
return false | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment