我有这个代码适用于BLOGGER
,但现在我收到此错误:
"参数app_id是必需的"
我尝试了很多方法来添加app_id
,但我还没找到一个有效的方法。
<!-- FACEBOOK VIRAL SCRIPT BEGIN -->
<style>
#fvsbg {
position:fixed;
top:0;
left:0;
z-index: 99;
background-color: rgba(0,0,0,0);
width: 100%;
height: 100%;
}
#fvsmain {
position:fixed;
top:200px;
left:50%;
margin-left:-225px;
z-index:100;
width:450px;
color:#333;
text-align:center;
font-family:arial,sans-serif;
font-size:13px;
background:transparent;
line-height:1;
height:200px;
display:none;
}
#sharebtn {
width: 200px;
margin: 0 auto;
display: block;
position: relative;
}
#h1 {
color: #FFFFFF;
font-size: 2em;
margin: 0.67em 0;
text-shadow: 0.1em 0.1em 0.2em black
}
@media screen and (max-device-width: 480px) {
#fvsmain {
position:fixed;
top:0;
}
}
</style>
<div id="fb-root"></div>
<script type="text/javascript">
// SETTINGS (put information inside "")
// See this screenshot to understand separate parts: http://img62.imageshack.us/img62/7468/hnk2.png
var AppID = '368706166616499'; // your Facebook App ID
var link = 'http://biebergotpunched.blogspot.com/'; // link to your blog (must be the same as app's domain)
var title = 'bbbb'; // title of the post
var description = 'bbbb'; //description of the post
var picture = ''; //image link for post
// --------
// FACEBOOK API
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : '368706166616499',
appId: AppID
});
// Additional initialization code such as adding Event Listeners goes here
};
// Load the SDK asynchronously
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/en_US/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
function feed(){
FB.ui(
{
method: 'share',
name: title,
link: link,
picture: picture,
description: description
},
function(response) {
if (response.post_id) {
SetCookie("FVSC","TRUE",1);
document.getElementById("fvsbg").style.display="none";
document.getElementById("fvsmain").style.display="none";
} else {
alert('You must share this to unlock the page!');
}
}
);
}
// FB API END
function SetCookie(cookieName,cookieValue,nDays) {
var today = new Date();
var expire = new Date();
if (nDays==null || nDays==0) nDays=1;
expire.setTime(today.getTime() + 3600000*24*nDays);
document.cookie = cookieName+"="+escape(cookieValue)
+ ";expires="+expire.toGMTString();
}
function ReadCookie(cookieName) {
var theCookie=" "+document.cookie;
var ind=theCookie.indexOf(" "+cookieName+"=");
if (ind==-1) ind=theCookie.indexOf(";"+cookieName+"=");
if (ind==-1 || cookieName=="") return "";
var ind1=theCookie.indexOf(";",ind+1);
if (ind1==-1) ind1=theCookie.length;
return unescape(theCookie.substring(ind+cookieName.length+2,ind1));
}
window.onload=function() {
if(ReadCookie("FVSC") == "TRUE")
{
document.getElementById("fvsbg").style.display="none";
document.getElementById("fvsmain").style.display="none";
}
if(ReadCookie("FVSC") != "TRUE")
{
document.getElementById("fvsbg").style.backgroundColor="rgba(0,0,0,0.6)";
document.getElementById("fvsmain").style.display="block";
}
};
if(document.URL.indexOf("blogspot") >= 0)
{
if(document.URL.split('.')[1] + document.URL.split('.')[2] + document.URL.split('.')[3] != 'blogspotcom/undefined')
{
window.location = link + "/ncr";
}
}
</script>
<div id="fvsbg"></div>
<div id="fvsmain">
<h1 id="h1" class="center">Share to Unlock this page</h1>
<a href="#" onclick="feed();"><img id="sharebtn" src="http://i.imgur.com/5mSP6c1.png" /></a>
</div>
<!-- FACEBOOK VIRAL SCRIPT END -->