document.domain = ‘vnexpress.net’;
var _siteId = “30”;
function showidmflash() {
window.parent.postMessage(‘showpopupidmflash’, ‘*’);
}
function reloadPage(videoLink) {
window.parent.location.href = decodeURIComponent(videoLink);
}
var _gaq = _gaq || [];
var ua = window.navigator.userAgent;
var msie = ua.indexOf(“MSIE “);
(function() {
var ga = document.createElement(‘script’);
ga.type = ‘text/javascript’;
ga.async = true;
//ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
ga.src = (‘https:’ == document.location.protocol ? ‘https://’ : ‘http://’) + ‘stats.g.doubleclick.net/dc.js’;
var s = document.getElementsByTagName(‘script’)[0];
s.parentNode.insertBefore(ga, s);
})();
var DEVICE_ENV = 4;
// detect html5 case
var sizedata = ‘activemode={active_mode}&data360=http://news.video.vnecdn.net/video/web/mp4/360p/2016/01/23/bang-gia-o-mau-son-1453531100.mp4&data720=http://news.video.vnecdn.net/video/web/mp4/2016/01/23/bang-gia-o-mau-son-1453531100.mp4&data480=http://news.video.vnecdn.net/video/web/mp4/480p/2016/01/23/bang-gia-o-mau-son-1453531100.mp4’;
var html5_support = false;
if ((Modernizr.video && Modernizr.video.h264 == “probably” && DEVICE_ENV == 4) || (Modernizr.video && DEVICE_ENV != 4)) {
html5_support = true;
sizedata = ‘ active-mode=”{active_mode}”‘;
}
// define zone
var share_url = ”;
if (share_url.trim() == ” && typeof(window.parent.location.href) != ‘undefined’) {
share_url = window.parent.location.href;
}
var _cdomain = share_url.replace(‘http://’, ”).split(‘/’);
_cdomain = _cdomain[0];
_clocation = share_url,
zoneIDListArr = [];
zoneIDListArr.vnexpress = 1880;
zoneIDListArr.video = 1880;
zoneIDListArr.nhacso = 881;
zoneIDListArr.sohoa = 893;
zoneIDListArr.ione = 904;
zoneIDListArr.kinhdoanh = 906;
zoneIDListArr.thethao = 1203;
zoneIDListArr.doisong = 903;
zoneIDListArr.dulich = 1138;
zoneIDListArr.giaitri = 882;
zoneIDListArr.missngoisao = 1913;
zoneIDListArr.ngoisao = 883;
zoneIDListArr.vitalk = 2121;
zoneIDListArr.giadinh = 903;
zoneIDListArr.suckhoe = 903;
zoneIDListArr.test = 2121;
zoneIDListArr.demo = 1880;
// get zone
function getZoneID(a) {
return zoneIDListArr[a] ? zoneIDListArr[a] : 0
}
// get domain
function getDomain() {
var a = _cdomain.replace(“www.”, “”).toLowerCase().split(“.”),
b;
if (parseInt(a[0]) == 180) return ‘test’;
return a[0];
}
// get zone id from domain
var d = getZoneID(getDomain());
var slot = [];
slot.type = ‘pre-roll’;
var request = “http://g.eclick.vn/video.xml?id=” + d + “&url=” + _clocation + “&fd=&fh=&fl=&t=” + String(Math.round(Math.random() * 100000));
body
{
border:0 none; margin: 0; padding: 0; overflow: hidden;
}
.parser_body
{
width:100%; height:100%;
}
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
if(isMobile.Android() || isMobile.iOS() || !isMobile.any())
{
$(‘head’).append($(”).attr(‘href’, ‘http://st.f2.vnecdn.net/responsive/j/v9/parser/fp-style.css’));
}
var siteId = 1000000;
var id = 77639;
var videoId = 77639;
var videoSource = ‘http://news.video.vnecdn.net/video/web/mp4/360p/2016/01/23/bang-gia-o-mau-son-1453531100.mp4’;
var mutilsize = 1;
if(mutilsize == 1)
{
videoSource = ‘http://news.video.vnecdn.net/video/web/mp4/360p/2016/01/23/bang-gia-o-mau-son-1453531100.mp4’;
}
var flash_url = ‘http://st.f4.vnecdn.net/responsive/f/v16’;
var thumbnail_url = ‘http://news.img.video.vnecdn.net/web/2016/01/23/bang-gia-o-mau-son-1453531100_490x294.jpg’;
var video_info = {“77639”:{“category_id”:”1003004″,”url”:”http://news.video.vnecdn.net/video/web/mp4/360p/2016/01/23/bang-gia-o-mau-son-1453531100.mp4″,”thumbnail_url”:”http://news.img.video.vnecdn.net/web/2016/01/23/bang-gia-o-mau-son-1453531100_490x294.jpg”,”share_url”:””,”title_format”:”Bu0103ng giu00e1 u1edf Mu1eabu Su01a1n”,”show_ads”:1,”have_license”:”0″}};
var videoPlayerId = ‘77639_29552’;
var typevideo = 2;
var suggestion_url = ‘http://vnexpress.net/detail/suggest/id/’;
var adsZone = ”;
adsZone = ‘880’;
var autoplay = ‘true’;
var ishome = 0;
var articlelink = ‘http%3A%2F%2Fwww.phunuvagiadinh.vn%2Fxa-hoi-168%2Fmau-son-trong-bang-gia-am-2-do-c-32318’;
if(typeof(share_url) == ‘undefined’) {
var share_url = ”;
}
if (ishome == 1)
{
var articleid = ‘1000000’;
}
else
{
curl = /([d]+)(-p([d]+))?.html/.exec(articlelink);
if (curl == null)
{
var articleid = 0;
}
else
{
var articleid = curl[1];
}
}
var fileFlash = ‘vneplayer.swf’;
var asset = ‘assetv3.swf’;
//Get track data
var trackData = ”;
if(mutilsize == 1)
{
trackData += sizedata+’&’
}
//Check data to push param
trackData += ‘xmlPath=&mAuto=’ + autoplay + ‘&autoHide=true&tracktype=video&asseturl=’ + flash_url + ‘/’+asset+’&playerid=video_’ + videoPlayerId + ‘&typeview=1’;
//Track url
trackData += ‘&trackurl=’ + video_info[id].url;
//Track thumb
trackData += ‘&thumburl=’ + video_info[id].thumbnail_url;
//Track link
trackData += ‘&tracklink=’ + share_url;
//Track link
trackData += ‘&articleid=’ + articleid + ‘&articlelink=’ + articlelink;
//Suggestion url
if (typevideo != 2) {
trackData += ‘&suggestionurl=’ + suggestion_url + id + ‘/type/1/exclude/’ + id;
}
//Track id
trackData += ‘&videoid=’ + videoId;
//Track type
// trackData += ‘&videotype=’ + ((typevideo == 2) ? 200 : 201);
trackData += ‘&videotype=200&siteid=30&player=1’;
//Ads zone
var isShowAds = typeof (video_info[id].show_ads) != ‘undefined’ ? video_info[id].show_ads : 0;
trackData += ‘&adszoneid=’;
if (isShowAds == 1 && adsZone != ”) {
trackData += adsZone;
}
if (ishome == 1)
{
//Track title
trackData += ‘&tracktitle=’;
}
else
{
//Track title
trackData += ‘&tracktitle=’ + video_info[id].title_format;
}
var html = ”;
var flashDetectInstalled = FlashDetect.installed;
// detect speed
var startTime, endTime;
var imageAddr = “http://spt.video.vnecdn.net/small.jpg”;
var downloadSize = 227475; //bytes
var download = new Image();
var checkSpeedDone = false;
if (html5_support == true)
{
var adsConfig = request;
var videourl = videoSource;
var activemode = ‘360’;
if(d == 0||isShowAds==0)
{
adsConfig = ”;
}
var videoSource240p = false;
var videoSource360p = ‘http://news.video.vnecdn.net/video/web/mp4/360p/2016/01/23/bang-gia-o-mau-son-1453531100.mp4’;
var videoSource480p = ‘http://news.video.vnecdn.net/video/web/mp4/480p/2016/01/23/bang-gia-o-mau-son-1453531100.mp4’;
var videoSource720p = ‘http://news.video.vnecdn.net/video/web/mp4/2016/01/23/bang-gia-o-mau-son-1453531100.mp4’;
if(DEVICE_ENV == 1){
if(videoSource240p != false)
{
videourl = videoSource240p;
activemode = “240”;
}
else if(videoSource360p != false)
{
videourl = videoSource360p;
activemode = “360”;
}
else if(videoSource480p != false)
{
videourl = videoSource480p;
activemode = “480”;
}
else if(videoSource720p != false)
{
videourl = videoSource720p;
activemode = “720”;
}
if(sizedata)
{
sizedata = sizedata.replace(‘{active_mode}’, activemode);
}
else
{
sizedata = ‘ active-mode=”360″‘;
}
var html = ‘
html += ‘
‘;
html += ‘
‘;
html += ‘
‘;
$(‘.parser_body’).append(html);
checkSpeedDone = true;
}
/*else if(DEVICE_ENV > 1){//for tablet and pc
if(videoSource480p != false)
{
videourl = videoSource480p;
activemode = “480”;
}
else if(videoSource360p != false)
{
videourl = videoSource360p;
activemode = “360”;
}
else if(videoSource240p != false)
{
videourl = videoSource240p;
activemode = “240”;
}
else if(videoSource720p != false)
{
videourl = videoSource720p;
activemode = “720”;
}
if(sizedata)
{
sizedata = sizedata.replace(‘{active_mode}’, activemode);
}
else
{
sizedata = ‘ active-mode=”360″‘;
}
var html = ‘
html += ‘
‘;
html += ‘
‘;
html += ‘
‘;
$(‘.parser_body’).append(html);
checkSpeedDone = true;
}*/
else{
// fix trắng video trên chorme
$(‘.block_video_parser’).css(‘overflow’, ‘visible’);
setTimeout(function(){ $(‘.block_video_parser’).css(‘overflow’, ‘hidden’); }, 500);
// detect success
download.onload = function () {
endTime = (new Date()).getTime();
var duration = (endTime – startTime) / 1000;
var bitsLoaded = downloadSize * 8;
var speedBps = (bitsLoaded / duration).toFixed(2);
var speedKbps = (speedBps / 1024).toFixed(2);
var speedMbps = (speedKbps / 1024).toFixed(2);
//log speed
(new Image).src = “http://l.saas.vnexpress.net/speedlog?ts=” + duration + “&bw=” + speedKbps + “&vid=” + videoId + “&ub=” + window.navigator.userAgent +”&fisp=&fip=&faid=&fc=&fl=&flz=&de=”;
//set source
/*if(DEVICE_ENV == 1){
if(speedKbps > 2500 && videoSource360p != false)
{
videourl = videoSource360p;
activemode = “360”;
}
else if(videoSource240p != false)
{
videourl = videoSource240p;
activemode = “240”;
}
else if(videoSource360p != false)
{
videourl = videoSource360p;
activemode = “360”;
}
else if(videoSource480p != false)
{
videourl = videoSource480p;
activemode = “480”;
}
else if(videoSource720p != false)
{
videourl = videoSource720p;
activemode = “720”;
}
}
else
{*/
if(speedKbps > 5000 && videoSource720p != false)
{
videourl = videoSource720p;
activemode = “720”;
}
else if(speedKbps > 3500 && videoSource480p != false)
{
videourl = videoSource480p;
activemode = “480”;
}
else if(speedKbps > 2500 && videoSource360p != false)
{
videourl = videoSource360p;
activemode = “360”;
}
else if(videoSource240p != false)
{
videourl = videoSource240p;
activemode = “240”;
}
else if(videoSource360p != false)
{
videourl = videoSource360p;
activemode = “360”;
}
else if(videoSource480p != false)
{
videourl = videoSource480p;
activemode = “480”;
}
else if(videoSource720p != false)
{
videourl = videoSource720p;
activemode = “720”;
}
//}
// replace trackdata
if(sizedata)
{
sizedata = sizedata.replace(‘{active_mode}’, activemode);
}
else
{
sizedata = ‘ active-mode=”360″‘;
}
checkSpeedDone = true;
var html = ‘
html += ‘
‘;
html += ‘
‘;
html += ‘
‘;
$(‘.parser_body’).append(html);
}
// detect fail
download.onerror = function (err, msg) {
endTime = (new Date()).getTime();
var duration = (endTime – startTime) / 1000;
//log speed error
(new Image).src = “http://l.saas.vnexpress.net/speedlog?ts=” + duration + “&bw=0&vid=” + videoId + “&ub=” + window.navigator.userAgent +”&fisp=&fip=&faid=&fc=&fl=&flz=&de=”;
// replace trackdata
trackData = trackData.replace(‘{active_mode}’, activemode);
sizedata = sizedata.replace(‘{active_mode}’, activemode);
checkSpeedDone = true;
var html = ‘
html += ‘
‘;
html += ‘
‘;
html += ‘
‘;
$(‘.parser_body’).append(html);
}
// get speed with image
startTime = (new Date()).getTime();
var cacheBuster = “?nnn=” + startTime;
download.src = imageAddr + cacheBuster;
// end detect speed
}
//add click event
$(‘.parser_’ + id).bind(‘click’, function() {
// postMessage
var message = [‘play’, ‘597873’];
window.parent.postMessage(message, ‘*’);
// call update status player
if(typeof(window.parent.common) != ‘undefined’)
{
window.parent.common.updateStatusParser(‘597873’);
}
if(!checkSpeedDone){
return false;
}
else
{
//just hide this div and show player div
$(this).hide();
$(‘#parser_player_’ + id).show();
//Add script tracking click play
var d = new Date();
var t = d.getTime();
var h = document.createElement(‘script’);
h.setAttribute(‘src’, ‘http://l.a.eclick.vn/media/video?ac=play&id=’+videoId+’&type=200&siteId=30&player=2&articleId=’+articleid+’&url=’+articlelink+’&showads=’+isShowAds+’&t=’+t);
h.setAttribute(‘type’, ‘text/javascript’);
h.setAttribute(‘charset’, ‘utf-8’);
document.getElementsByTagName(‘head’)[0].appendChild(h);
if (ishome == 1)
{
var trackUrl = share_url.split(‘vnexpress.net’);
//Push pageview
_gaq.push([‘_trackEvent’, ‘Home’, ‘Click tin video’, ‘Box video’]);
if (trackUrl[1] != undefined && trackUrl[1])
{
_gaq.push([‘_setAccount’, ‘UA-249346-5’]);
_gaq.push([‘_trackPageview’, trackUrl[1]]);
_gaq.push([‘c._setAccount’, ‘UA-249346-1’]);
_gaq.push([‘c._trackPageview’, trackUrl[1]]);
}
//Track eclick
var _siteId = “30”;
// track cu trang con
(function() {
var e = document.createElement(“script”);
e.type = “text/javascript”, e.async = !0, e.src = “http://st.l.a.eclick.vn/ea.js”;
var t = document.getElementsByTagName(“script”)[0];
t.parentNode.insertBefore(e, t)
})();
}
if(isMobile.Android() || isMobile.iOS() || !isMobile.any())
{
initPlayer(‘video_’ + videoPlayerId, true, false);
}
else
{
var video = document.getElementById(‘video_’ + videoPlayerId);
var att = document.createAttribute(“controls”);
att.value = “controls”;
video.setAttributeNode(att);
video.load();
video.play();
}
}
});
}
else if(html5_support == false || flashDetectInstalled == true)
{
// detect speed
var startTime, endTime;
var imageAddr = “http://spt.video.vnecdn.net/small.jpg”;
var downloadSize = 227475; //bytes
var download = new Image();
// detect success
download.onload = function () {
endTime = (new Date()).getTime();
var duration = (endTime – startTime) / 1000;
var bitsLoaded = downloadSize * 8;
var speedBps = (bitsLoaded / duration).toFixed(2);
var speedKbps = (speedBps / 1024).toFixed(2);
var speedMbps = (speedKbps / 1024).toFixed(2);
var activemode = ‘360’;
var videourl = videoSource;
var videoSource240p = false;
var videoSource360p = ‘http://news.video.vnecdn.net/video/web/mp4/360p/2016/01/23/bang-gia-o-mau-son-1453531100.mp4’;
var videoSource480p = ‘http://news.video.vnecdn.net/video/web/mp4/480p/2016/01/23/bang-gia-o-mau-son-1453531100.mp4’;
var videoSource720p = ‘http://news.video.vnecdn.net/video/web/mp4/2016/01/23/bang-gia-o-mau-son-1453531100.mp4’;
//set source
if(DEVICE_ENV == 1){
if(speedKbps > 2500 && videoSource360p != false)
{
videourl = videoSource360p;
activemode = “360”;
}
else if(videoSource240p != false)
{
videourl = videoSource240p;
activemode = “240”;
}
else if(videoSource360p != false)
{
videourl = videoSource360p;
activemode = “360”;
}
else if(videoSource480p != false)
{
videourl = videoSource480p;
activemode = “480”;
}
else if(videoSource720p != false)
{
videourl = videoSource720p;
activemode = “720”;
}
}
else
…
Nguồn: Theo Vnexpress
Bài viết được thành viên sưu tầm và đăng tại:
ChaMeCuaCon.com – Trang web chia sẻ kinh nghiệm về sức khỏe và làm đẹp.