关于数据整理和海外分享的总结
制作页面经常遇到编辑丢一份表格或者word文档过来,这时就需要我们整理数据,为了方便后续的修改,整理成以下数据:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | var arr = { 'my' : { 'name' : '【回合】' , 'example' : '我的回合,我的回合,时间是一条不能倒流的河。' , 'from' : '《梦幻西游》手游' }, 'dtws' :{ 'name' : '【PK】' , 'example' : '物资pk:为团而生,为团而死。, ' from ':' 《大唐无双零》 ' }, ' dtyxj ':{ ' name ':' 【三刀】 ', ' example ':' 三界来个排行三刀 ', ' from ':' 《大唐游仙记》 ' } } //调用 console.log(arr[' my '][' name']) //【回合】 |
海外官网分享相关代码
HTML
1 2 3 4 5 6 | < div id = "share_content" style = "display:none" > < div id = "share_title" >本格幻想RPG「陰陽師」事前登録受付中!</ div > < div id = "share_desc" >いざ、美と妖の平安世界へ。全世界で1000万ダウンロードを突破した、本格幻想RPG。 「陰陽師」事前登録 受付中!</ div > < img id = "share_pic" data-src = "../img/gw/share.jpg" > </ div > |
JS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | var share_config = { 'title' : $( '#share_title' ).html(), 'desc' : $( '#share_desc' ).html(), 'url' : $( '#share_url' ).html(), 'pic' : $( "#share_pic" ).attr( "data-src" ) }; // twitter分享 $( "#Jtwitter" ).on( "click" , function () { window.open( "http://twitter.com/home/?status=" + share_config.title + encodeURIComponent(share_config.url), "twiiter" , "height=300, width=600, top=" + (document.body.offsetHeight / 2 - 150) + ", left=" + (document.body.offsetWidth / 2 - 300) + ", toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no" ) }) // facebook分享 $( "#Jfacebook" ).on( "click" , function () { + "&picture=" + encodeURIComponent(share_config.pic) + "&description=" + encodeURIComponent(share_config.desc) + "&title=" + encodeURIComponent(share_config.title) + "&display=popup&ref=plugin&src=share_button" , "facebook" , "height=500, width=750, top=" + ($(window).height() / 2 - 250) + ", left=" + (document.body.offsetWidth / 2 - 375) + ", toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no" ) }) |
一般来说是到这里已经完成分享设置了,如果需求要求去掉分享来源,需要在HTML的head中添加以下代码
1 2 | < meta name = "author" content = "" > < meta name = "copyright" content = "" > |
以上是PC端页面设置,移动端因为没有window.open方法,可以改成window.location.href = url的方式跳去分享页面
手机阅读请扫描下方二维码:
12345678

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
12345678

12345678
12345678
12345678
12345678

12345678

12345678

12345678

12345678

12345678

12345678

1

1

555
1

1

1

1

1

1

1

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1