');
this.setAttribute('src', url);
this.setAttribute('is-reset',0);
} else {
this.style.opacity = '1';
}
};
changeUrl('https://www.ithome.com.tw/news/166265');
if(navigator.userAgent.match(/iPad|iPhone/i))
{
var mouseY = 0;
var mouseX = 0;
$('#view_web').ready(function(){ //wait for iFrame to load
//remeber initial drag motition
$('#view_web').contents()[0].body.addEventListener('touchstart', function(e){
mouseY = e.targetTouches[0].pageY;
mouseX = e.targetTouches[0].pageX;
});
//update scroll position based on initial drag position
$('#view_web').contents()[0].body.addEventListener('touchmove', function(e){
e.preventDefault(); //prevent whole page dragging
var box = $('#cav_ifm');
box.scrollLeft(box.scrollLeft()+mouseX-e.targetTouches[0].pageX);
box.scrollTop(box.scrollTop()+mouseY-e.targetTouches[0].pageY);
//mouseX and mouseY don't need periodic updating, because the current position
//of the mouse relative to th iFrame changes as the mask scrolls it.
});
});
}
$.post("http://myshare.url.com.tw/ajax/get_rel_article",{aid:2200897},function(response){
if(response.error==0)
{
if(response.rel.length>=1)
{
if(response.rel[0].media==null)
{
html='
'+response.rel[0].title+'';
}
else
{
html='
'+response.rel[0].title+'';
}
$('#rel_0').html(html);
}
if(response.rel.length>=2)
{
if(response.rel[1].media==null)
{
html='
'+response.rel[1].title+'';
}
else
{
html='
'+response.rel[1].title+'';
}
$('#rel_1').html(html);
}
}
},'json');
$('#view_web').height(document.documentElement.clientHeight-$('#header_clt3').height()-$('#bottom_clt3').height());
request=$.ajax({async: true,url:"http://myshare.url.com.tw/ajax/update_share",type:'post',data:{aid:2200897},error:function(){request.abort()}});
//搜尋資料
$.post("http://myshare.url.com.tw/ajax/get_article_bottom_data",{aid:2200897},function(response){
if(response['err']==undefined)
{
$('#bottom_loading').remove();
$('.bottom_title').html(response['record_name']).attr({'href':response['record_url'],title:response['record_name']});
$('#btn_like').attr('src','//www.facebook.com/plugins/like.php?href='+encodeURIComponent(response['record_url'])+'&send=false&layout=button_count&width=20&show_faces=false&action=like&colorscheme=light&font&height=21');
$('#bottom_img').attr('src',response['record_img'])
if(response['record_comment']!="")
{
$('#txt_comment01').html(response['record_comment']).removeClass('add_kw').addClass('ak2');
}
else
{
$('.bottom_add_arr').remove();
$('#bottom_add').remove();
}
if(response['record_subscribe']==1)
{
$('#btn_sub').removeClass('sub3').addClass('sub3_off');
}
else
{
if(response['record_own']==1)
{
if(response['record_type']=='user')
{
$('#btn_sub').attr('data-id',2);
$('#btn_sub').attr('data',response['record_id']);
}
else
{
$('#btn_sub').attr('data-id',1);
$('#btn_sub').attr('data',response['record_id']);
}
}
else
{
$('#btn_sub').remove();
}
}
load_content=true;
}
else
{
$('#bottom_loading').html(response['msg']);
}
},'json');
$.post('/ajax/get_html_part',{url:'https://www.ithome.com.tw/news/166265'},function(response){
ar_guess=response;
},'json');
});
bottom_comment_show=false;
$('.bottom_title').live('mouseover',function(){
bottom_comment_show=true;
$('.bottom_add_arr').show();
$('#bottom_add').show();
});
$('#bottom_add').live('mouseover',function(){
bottom_comment_show=true;
});
$('#bottom_add').live('mouseout',function(){
bottom_comment_show=false;
setTimeout(close_botom_msg,400);
});
$('#bottom_add').live('mouseout',function(){
bottom_comment_show=false;
setTimeout(close_botom_msg,400);
});
function close_botom_msg()
{
if(bottom_comment_show==false)
{
$('.bottom_add_arr').hide();
$('#bottom_add').hide();
}
}
$(window).bind("resize",function(){
if(!navigator.userAgent.match(/iPad|iPhone/i))
{
$('#view_web').height(document.documentElement.clientHeight-$('#header_clt3').height()-$('#bottom_clt3').height());
}
});
setTimeout(on_resize,400);
function on_resize()
{
if(!navigator.userAgent.match(/iPad|iPhone/i))
{
$('#view_web').height(document.documentElement.clientHeight-$('#header_clt3').height()-$('#bottom_clt3').height());
setTimeout(on_resize,400);
}
}
add_atc_show=false;
function close_add_atc()
{
if(add_atc_show==false)
{
$('#adda_box').hide();
}
}
$('.myshare_btn').live({
'mouseover':function(){
$('.myshare').show();},
'mouseout':function(){
$('.myshare').hide();}});
$('.myshare').live({
'mouseout':function(){
$('.myshare').hide();},
'mouseover':function(){
$('.myshare').show();}
});
function onchangelike()
{
data=$('#maylike').val();
location.href="http://myshare.url.com.tw/show/"+data;
}
var windows_obj="";
$('.c_close').live('click',function(){
$('#dv_class').jqmHide();
});
$(document).delegate('.collect_a','click',function(){
$.post("http://myshare.url.com.tw/ajax/have_add_collect",{aid:2200897},function(response){
if(response['error']==true)
{
if(response['log_in']=='off')
{
onLogin();
}
else
{
AlertBox(response['msg']);
}
return ;
}
ctgy={"ctgy_id":4,"ctgy_name":'科技'}
$('#dv_class').jqm({onHide:function(e){e.w.hide();e.o.remove();}});
$('#dv_class').load("http://myshare.url.com.tw/dialog/category",{cur_ctgy:Array(ctgy)});//
$('#dv_class').css({"top":((window.screen.height-330)/2-89)+"px",left:((window.screen.width-480)/2-42)+"px"});
$('#dv_class').jqmShow();
},'JSON').error(function(){AlertBox('無法!伺服器忙線中!')});
});
function onClassSubmit()
{
//送出
var sel_ctgy=$('.in').html();
var is_purview=$('input[name=collect_purview]:checked').val();
var is_fb=$('#is_fb').is(':checked')==true ? "y" : "n";
var user_comment="";
if($('#txt_comment').hasClass('ak2') || $('#txt_comment').val()!='說點什麼...(可以讓你寫新聞評價,或網頁重點筆記喔!)')
user_comment=$('#txt_comment').val()
var data={comment:user_comment,is_purview:is_purview,is_fb:is_fb};
if(typeof(sel_ctgy)=="undefined")
{
AlertBox('請先選擇任一類別!');
return;
}
else
{
ctgy={"id":$('.in').attr('data-id'),"name":$('.in').attr('data')};
$.post("http://myshare.url.com.tw/ajax/add_collect",{aid:2200897,data:data,ctgy:ctgy},function(response){
$('#dv_class').jqmHide();
AlertBox('收藏成功!');
$('.add_atc').removeClass('add_atc').addClass('add_atc_a');
}).error(function(){AlertBox('收藏失敗!伺服器忙線中!')});
}
}
function onGuess()
{
url=$('#txt_url').val();
if($.trim(url)!="")
{
$.post("http://myshare.url.com.tw/ajax/get_guess_data",{url:url},function(response){
if(response['error']==true)
{
}
else
{
$('#txt_comment').val(response['msg']);
}
if($('#txt_comment').val()!="")
{
$('#txt_comment').removeClass('add_kw').addClass('ak2');
}
},'JSON');
}
else
{
AlertBox('請輸入網址!');
}
}
function onGuess01()
{
$('#txt_comment').val(ar_guess[guess_num]);
guess_num++;
if(guess_num>=ar_guess.length)
guess_num=0;
}
/*$('.open_head').live('click',function(){
});*/
close_head=true;
/*$('#header_clt').live('click',function(){
if(close_head==false)
{
close_head=true;
return;
}
});*/
//-->
$('.close_a').live('click',function(){
$('#adda_box').hide();
$('.close_a').fadeOut(500);
/*$('#header_clt3').stop().animate({height:0}, 2000,'easeOutBack');
$('.open_a').css({'width':'70px','height':'0px','overflow':'hidden'}).show().stop().animate({height:155}, 2000,'easeOutBounce',function(){$('.open_a').css({'width':'','height':'','overflow':''});});*/
$('#header_clt3').animate({height:"toggle"},400,function(){$('#header_clt3').css('height',0).hide();});
$('#bottom_clt3').animate({height:"toggle"},400,function(){$('#bottom_clt3').css('height',0).hide();$('#bottom_clt3_bg').hide();});
$('#view_web').css('margin-top',0);
//$('#cav_ifm').css('margin-top',0);
$('.open_a').fadeIn(500);
on_resize();
});
$('.reductive_a').live('click',function(){
/*$('#header_clt3').stop().animate({height:60}, 2000,'easeOutBounce');
$('.open_a').css({'width':'70px','overflow':''}).stop().animate({height:0}, 2000,'easeOutBack',function(){$('.open_a').hide();$('.close_a').fadeIn(1500);});
*/
$('#header_clt3').animate({height:"toggle"},400,function(){$('#header_clt3').css('height','').show();});
$('#bottom_clt3').animate({height:"toggle"},400,function(){$('#bottom_clt3').css('height','').show();$('#bottom_clt3_bg').show();});
$('#view_web').css('margin-top',56);
//$('#cav_ifm').css('margin-top',56);
$('.close_a').fadeIn(500);
$('.open_a').hide();
on_resize();
});
$('.share_a').live('click',function(){
if($('.my_share2').css('display')=='none')
{
$('.my_share2').show();
}
else
{
$('.my_share2').hide();
}
});
share_a_show=false;
$('.share_a').live('mouseover',function(){
share_a_show=true;
$('.my_share2').show();
});
$('.my_share2').live('mouseover',function(){
share_a_show=true;
});
$('.my_share2').live('mouseout',function(){
share_a_show=false;
setTimeout(on_share_a_show,400);
});
$('.share_a').live('mouseout',function(){
share_a_show=false;
setTimeout(on_share_a_show,400);
});
function on_share_a_show()
{
if(share_a_show==false)
{
$('.my_share2').hide();
}
}
search_a_show=false;
$('.search_a').live('mouseover',function(){
search_a_show=true;
$('.search_main').show();
$('.search_a').css({'background':'url("../images/search_a_.png") no-repeat scroll 0 0 transparent','opacity':1});
});
$('.search_main').live('mouseover',function(){
search_a_show=true;
});
$('.search_main').live('mouseout',function(){
search_a_show=false;
setTimeout(on_share_a_show,400);
});
$('.search_a').live('mouseout',function(){
search_a_show=false;
setTimeout(on_search_a_show,400);
});
function on_search_a_show()
{
if(search_a_show==false)
{
$('.search_main').hide();
$('.search_a').css({'background':'url("../images/search_a.png") no-repeat scroll 0 0 transparent','opacity':''});
}
}
$('.add_atc').live('click',function(){
onLogin();
});
//圖片產生
function create_img_obj(imgs,img_collect,coll_count)
{
inFind=true;
var img = new Image();
var obj_length=imgs.length;
var i=0;
img.onload = function() {
pic_rod=0;
if(this.width>this.height)
{
pic_rod=this.width/this.height;
}
else
{
pic_rod=this.height/this.width;
}
if(this.width>=210 && pic_rod<=2.5)
{
img_w=100;
img_h=this.height/(this.width/100);
img_left=img_w-15;
is_check='';
if(img_collect!=false)
{
if(img_collect[i-1]=='on')
{
is_check='checked';
}
}
if(imgTotal==0)
{
if(coll_count==0)
is_check='checked';
$('.view_img ul').html('收 藏放 大');
}
else
{
$('.view_img ul').append('收 藏放 大');
}
imgTotal=imgTotal+1;
$('#lbImgNum').html((imgPos+1)+"/"+(imgTotal));
}
if(imgTotal==1)
{
$('.load_img').hide();
$('#td_img').show();
}
if(i>(obj_length-1))
{
$('.load_img').hide();
img_model(3);
}
else
{
img.src=imgs[i];
i++;
}
}
img.onerror = function() {
if(i>(obj_length-1))
{
$('.load_img').hide();
if(imgTotal>0)
{
$('#td_img').show();
}
}
else
{
img.src=imgs[i];
i++;
}
}
img.src=imgs[i];
i++;
if(i>(obj_length-1))
{
$('.load_img').hide();
if(imgTotal>0)
{
$('#td_img').show();
}
}
}
$('.img_next').live('click',function(){
var no = $('.view_img ul li').filter('.selected').index();
if(no').attr('src',data).css({'max-width':800});
$('.lb-caption').find('a').html(own_name);
$('.media_display').html(img);
TINY.box.show({html:$(".media_box").html(),animate:true,fixed:false,width:800,openjs:function(){$('.tinner').css({width:'800px',height:'auto'});add_atc_show=true;$('#adda_box').show();}});
}
$('.lb-prev,.lb-next').live('click',function(){
//判斷位置
if($('.view_img ul li').filter('.selected').index()>=0)
{
if($(this).hasClass('lb-prev'))
new_index=$('.view_img ul li').filter('.selected').index()-1;
else
new_index=$('.view_img ul li').filter('.selected').index()+1;
$('.view_img ul li').eq(new_index).stop().fadeTo(fadeSpeed + 100, 1, function(){
}).addClass('selected').show().siblings().fadeTo(fadeSpeed, 0).removeClass('selected').hide();
data=$('.view_img ul li').filter('.selected').find('img').attr('src');
$('.lb-caption','.tcontent').find('a').html(own_name);
if($('.view_img ul li').filter('.selected').find('input').is(':checked')==true)
{
$('.lb-like-pic','.tcontent').hide();
}
else
{
$('.lb-like-pic','.tcontent').show();
}
cur_index=$('.view_img ul li').filter('.selected').index()+1;//目前位置
cur_max=$('.view_img ul li').size();//總數
on_nav(cur_index,cur_max)
$('.lb-number','.tcontent').html(cur_index+'/'+cur_max);
$('#lbImgNum').html(cur_index+'/'+cur_max);
var img=$('').attr('src',data).css({'max-width':800});
$('.tcontent').find('.lb-nav').height($('.view_img ul li').filter('.selected').find('img').attr('data-height'));
$('.media_display','.tcontent').html(img);
$('.tinner').css({width:'800px',height:'auto'});
}
});
function on_nav(cur_idx,max_idx)
{
if(max_idx<=1)
{
$('.lb-nav','.tcontent').hide();
$('.lb-nav').hide();
}
else
{
$('.lb-nav','.tcontent').show();
$('.lb-nav').show();
if(cur_idx>=max_idx)
{
$('.lb-next').hide();
$('.lb-next','.tcontent').hide();
}
else
{
$('.lb-next').show();
$('.lb-next','.tcontent').show();
}
if(cur_idx<=1)
{
$('.lb-prev').hide();
$('.lb-prev','.tcontent').hide();
}
else
{
$('.lb-prev').show();
$('.lb-prev','.tcontent').show();
}
}
}
$('.lb-like-pic').live('click',function(){
$('.view_img ul li').filter('.selected').find('input').attr('checked',true);
$(this).hide();
img_model(3);
});
function on_collect_img()
{
$('.view_img ul li').filter('.selected').find('input').attr('checked',true);
img_model(3);
}
$('#img_bg').live('click',function(){
if(isModule==false)
{
if(is_img_big)
{
is_img_big=false;
if($('#img_chk').is(':checked')==true)
{
$('.view_img ul li').filter('.selected').find('input').attr('checked',true);
}
else
{
$('.view_img ul li').filter('.selected').find('input').attr('checked',false);
}
img_model(3);
}
$('#img_bg').hide();
Gobj.hide();
}
});
$('.c_close').live('click',function(){
$('#img_bg').hide();
$('#dv_class').hide();
$('#dv_class').jqmHide();
});
$('.view_img ul li').live({
mouseout:
function ()
{
$(this).find('#btn_chk').hide();
$(this).find('#btn_zoom').hide();
}
,mouseover:
function ()
{
$(this).find('#btn_chk').show();
$(this).find('#btn_zoom').show();
}
});
$('.img_prev').live('click',function(){
var no = $('.view_img ul li').filter('.selected').index();
if(no>0)
{
no--;
$('.view_img ul li').eq(no).stop().fadeTo(fadeSpeed + 100, 1, function(){
}).addClass('selected').show().siblings().fadeTo(fadeSpeed, 0).removeClass('selected').hide();
$('#lbImgNum').html((no+1)+"/"+(imgTotal));
}
});
$('.love_kw_del_ad').live("click",function(){
$(this).parent().remove();
});
function onAddKw()
{
if($('.kw_list div').size()>=30)
{
AlertBox('關鍵字只能輸入30個字詞喔!');
return false;
}
kw=$('#txt_keyword').val();
if($('#txt_keyword').hasClass('add_kw'))
{
$('#txt_keyword').val('');
return ;
}
$('#txt_keyword').val('');
kw_list=[];
var regular = /^([^\`\+\.\~\!\#\$\%\^\&\*\(\)\|\}\{\=\"\'\!\¥\……\(\)\——]*[\+\~\!\#\$\%\^\&\*\(\)\|\}\{\=\"\'\`\!\?\:\<\>\•\“\”\;\‘\‘\〈\ 〉\¥\……\(\)\——\{\}\【\】\\\/\;\:\?\《\》\。\,\、\[\]\,\.]+.*)$/;
start=0;
for(i=0;i=30)
{
AlertBox('關鍵字只能輸入30個字詞喔!');
bleck;
}
$('.kw_list div').each(function(index,element){
if($(element).attr('data')==kw_list[i])
{
is_repeat=true;
return false;
}
});
if(is_repeat==false)
{
html='';
$('.kw_list').append(html);
}
}
}
}
function img_model(value)
{
if(value==3)
{
ck_count=0;
$('.view_img ul li').each(function(index,element){
if($(element).find('input').is(':checked'))
ck_count++;
});
$('#lbImgCollectNum').html('已收'+(ck_count)+'張');
if(ck_count==0)
{
$('#lbImgCollectNum').html('已收'+(1)+'張');
$('#no_pic').attr('checked',true);
}
else if(ck_count==$('.view_img ul li').size())
{
$('#all_pic').attr('checked',true);
}
else
{
$('#coll_pic').attr('checked',true);
}
}
else
{
if(value==0)
{
$('#lbImgCollectNum').html('已收'+0+'張');
}
else if(value==1)
{
$('#lbImgCollectNum').html('已收'+(1)+'張');
}
else
{
$('#lbImgCollectNum').html('已收'+($('.view_img ul li').size())+'張');
}
$('.view_img ul li').each(function(index,element)
{
if(value==0)
{
$('input',element).attr('checked',false);
}
else if(value==1)
{
if(index==0)
{
$('input',element).attr('checked',true);
}
else
{
$('input',element).attr('checked',false);
}
}
else
{
$('input',element).attr('checked',true);
}
});
}
}
$('#cp_link').live('click',function(){
var txt = $('#txt_url').val();;
var str = escape("請按鍵盤 Ctrl+C 及 Enter 複製連結。");
window.prompt (unescape(str), txt);
});
is_lock=false;
$('.btn_save_edit').live('click',function (){
if(load_content==false)
{
AlertBox('請等待資料載入完畢後,再作操作!');
return;
}
if(is_lock==true)
{
AlertBox('修改中!!您操作太快了!');
return;
}
is_lock=true;
$('#adda_box').hide();
ctgy={"id":$('#sel_ctgy').find(":selected").val(),"name":$('#sel_ctgy').find(":selected").html()};
keyword=[];
webData['user_title']=encodeURIComponent($('#txt_title').val())
if($('#txt_comment').hasClass('add_kw') || $('#txt_comment').val()=='說點什麼...(可以讓你寫新聞評價,或網頁重點筆記喔!)')
{
webData['comment']="";
}
else
{
webData['comment']=$('#txt_comment').val();
}
webData['is_purview']=0;
webData['is_fb']='false';
$('.kw_list div').each(function(index,element){
if($(element).attr('data')!="")
{
keyword.push($(element).attr('data'));
}
});
webData['keyword']=keyword;
imgs=[];
$('.view_img ul li').each(function(index,element){
imgs.push({'src':$(element).find('img').attr('src'),'ck':$(element).find('input').is(':checked')});
});
$.post("http://myshare.url.com.tw/news/save",{type:"n",data:webData,imgs:imgs,ctgy:ctgy,edit:true},function(response){AlertBox('修改成功!');is_lock=false;$('.add_atc').removeClass('add_atc').addClass('add_atc_a');},'json');
});
資料搜尋中......
Google推開發者計畫Premium會員,供開發者付費取得額外資源與服務
看過了這篇同時也看了......
|
Myshare粉絲團
|
|
|
|