Last active
August 29, 2015 13:56
-
-
Save cloneko/8970193 to your computer and use it in GitHub Desktop.
Facebookでアプリ認証時にブロックするリンクとホームに戻るボタンを表示するスクリプト。要 selfxss有効化 https://www.facebook.com/selfxss
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
//dialog/oauth?の時に動作させる。 | |
// Get app_id | |
var app_id = ''; | |
for(var i in document.getElementById('platformDialogForm').childNodes){ | |
if(document.getElementById('platformDialogForm').childNodes[i].name == 'app_id'){ | |
app_id = document.getElementById('platformDialogForm').childNodes[i].value; | |
} | |
} | |
var elmBlock = document.createElement('a'); | |
elmBlock.rel = 'dialog-post'; | |
elmBlock.setAttribute('ajaxify','/ajax/apps/block_app.php?app_id=' + app_id + '&type_index=0&source=about&confirm_id=block_app_link'); | |
elmBlock.href = '#'; | |
elmBlock.setAttribute('role','button'); | |
elmBlock.innerHTML = 'Block'; | |
if(app_id != ''){ | |
document.getElementsByClassName("uiOverlayFooterMessage")[0].appendChild(elmBlock); | |
} | |
var elmBack = document.createElement('button'); | |
elmBack.setAttribute('class', document.getElementsByClassName("uiOverlayFooterButtons")[0].childNodes[0].className); | |
elmBack.setAttribute('onClick','document.location.href="https://www.facebook.com/"'); | |
elmBack.innerHTML = 'Go Home'; | |
document.getElementsByClassName("uiOverlayFooterButtons")[0].insertBefore(elmBack,document.getElementsByClassName("uiOverlayFooterButtons")[0].firstChild); | |
selfxss有効化してればChromeでそのままBookmarkletとして動作した。
アプリの認証画面でこのjsを実行すれば左下にBlockのリンク、右下に「Go Home」のボタンが出てきます。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Developer Consoleから起動してね。
要 selfxss の有効化 https://www.facebook.com/selfxss
selfxss有効化による不具合とかJSの実行によって変なことになっても責任取れませんのであしからず。