code
分類:
程式
最近玩遊戲發現 FB 好像改了 導航欄….
這兩天有點空,把 Facebook Account Multi Login (多帳號快速切換) 給更新了一下
其實 2.0 版老早就做好了,但是卡在一登入 會跳來跳去的問題,就沒有專心開發了,想說1.5 能用就好
這次剛好 在研究 jQuery for chrome 的方法,搞了很久….
用了很多方法才搞定
2.0 先修正出來 因為全部重寫了,所以先不做多國語言版本,並且正名修改為 Facebook Switch Accounts
腳本位置為:
http://userscripts.org/scripts/show/63761
這次用到了 物件寫法,對我來說有點難….
2.0 可以支援 chrome ,因為我把 jquery 整個程式碼給包進去了
所以姑且還能用
感謝以下部落格的教學報導:
- 分身術!一鍵切換多個 Facebook 帳號(T客邦 – 我只推薦好東西)
- 快速切換 Facebook 使用者帳號 : Facebook Account Multi Login(@ 風月無邊 :: 痞客邦 PIXNET ::)
- Facebook Account Multi Login (多帳號快速切換)(fREE2SW4U | fREE2 Software 4 You)
- [GreaseMonkey] Facebook Account Multi Login ~ 讓你在多個Facebook帳號中快速切換(海芋小站)
if(!function_exists('json_decode')){ include("json.php"); $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); function json_decode($arr){ global $json; return $json->decode($arr); } function json_encode($arr){ global $json; return $json->encodeUnsafe($arr); } }
JSON Class 的名稱為 Services_JSON
* @category * @package Services_JSON * @author Michal Migurski <[email protected]> * @author Matt Knapp <mdknapp[at]gmail[dot]com> * @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com> * @copyright 2005 Michal Migurski * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $ * @license http://www.opensource.org/licenses/bsd-license.php * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
下載 function ,google 搜尋到的 修正 IE 中文檔名會錯誤的問題
使用用法,檔名可不加,不加即為路徑檔名
dl_file("路徑","檔名")
function dl_file($file,$fname=""){ //First, see if the file exists if (!is_file($file)) { die("<strong>404 File not found!</strong>"); } //Gather relevent info about file $filename = ($fname)? $fname:basename($file); if(strpos($_SERVER['HTTP_USER_AGENT'] ,"MSIE")){ $filename = urlencode ($filename); } //Gather relevent info about file $len = filesize($file); $file_extension = strtolower(getExtension($file)); //This will set the Content-Type to the appropriate setting for the file switch( $file_extension ) { case "pdf": $ctype="application/pdf"; break; case "exe": $ctype="application/octet-stream"; break; case "zip": $ctype="application/zip"; break; case "doc": $ctype="application/msword"; break; case "xls": $ctype="application/vnd.ms-excel"; break; case "ppt": $ctype="application/vnd.ms-powerpoint"; break; case "gif": $ctype="image/gif"; break; case "png": $ctype="image/png"; break; case "jpeg": case "jpg": $ctype="image/jpg"; break; case "mp3": $ctype="audio/mpeg"; break; case "wav": $ctype="audio/x-wav"; break; case "mpeg": case "mpg": case "mpe": $ctype="video/mpeg"; break; case "mov": $ctype="video/quicktime"; break; case "avi": $ctype="video/x-msvideo"; break; //The following are for extensions that shouldn't be downloaded (sensitive stuff, like php files) case "php": case "htm": case "html": case "txt": $ctype="application/octet-stream"; break; default: $ctype="application/force-download"; } //Use the switch-generated Content-Type //Force the download header('Pragma: public'); header('Expires: 0'); header('Last-Modified: ' . gmdate('D, d M Y H:i ') . ' GMT'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header("Cache-Control: public"); header("Content-Type: $ctype"); header("Content-Description: File Transfer"); header('Content-Disposition: attachment; Filename="'.$filename.'"'); header('Content-Transfer-Encoding: binary'); header("Content-Length: ".$len); @readfile($file); exit; }