`
johnnywww
  • 浏览: 21057 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
最近访客 更多访客>>
社区版块
存档分类
最新评论

maxthon2.0 delicious sidebar验证失败

 
阅读更多

最近安装maxthon2.0,用来其delicious sidebar插件,原来工作正常,现在出现问题,卸载house重新安装sidebar,出现验证无法通过。检查其Delicious.js代码,由于原有网址http://del.icio.us,改为http://delicious.com/,所以无法验证,验证时必须有http://delicious.com/yourname网页打开,而且添加网址时标题不能超过255个字节。修改js如下:

  1. /**************************
  2. Del.icio.usSidebar
  3. ByNeo101
  4. Version1.2.1
  5. **************************/
  6. checkSettingsFile()
  7. varauthUser=readSetting('authUser')
  8. varsplit=authUser.split('%20')
  9. varuserName=split?split[0]:''
  10. varshowTooltip=readSetting('showTooltip','1')
  11. varautoUpdateTime=parseInt(readSetting('autoUpdateTime','0'))
  12. if(isNaN(autoUpdateTime)){
  13. autoUpdateTime=0
  14. }
  15. varsortTags=readSetting('sortTags','1')
  16. varsortFavorites=readSetting('sortFavorites','1')
  17. varuseBundles=readSetting('useBundles','1')
  18. varbaseURL='https://api.del.icio.us/v1/'
  19. varfavoritesCache='cache/favorites.html'
  20. varfavoritesHTML=''
  21. varposts=newArray()
  22. varbundleArray=newArray()
  23. varbranch=0
  24. varxmlhttp
  25. vareditElement
  26. varisAddFavorite=true
  27. varTRUE='1'
  28. varFALSE='0'
  29. //vardeliciousURL='http://del.icio.us/';
  30. vardeliciousURL='http://delicious.com/'
  31. vardeliciousSettingURL='https://secure.delicious.com/settings/'
  32. window.onload=function(){
  33. if(authUser==''){
  34. displaySettings()
  35. document.getElementById('settingsLinks').style.display='none'
  36. document.getElementById('mainSettings').style.display='none'
  37. document.getElementById('links').style.display='none'
  38. document.getElementById('aboutDelicious').style.display=''
  39. }else{
  40. viewFavorites()
  41. getLastUpdateTime()
  42. setLinks()
  43. }
  44. setAutoUpdate()
  45. //cleanoldlogindata
  46. if(readSetting('userName','')!=''){
  47. writeSetting('userName','')
  48. writeSetting('password','')
  49. }
  50. }
  51. functionsetLinks(){
  52. document.getElementById('yourFavoritesLink').href=deliciousURL+userName
  53. document.getElementById('yourNetworkLink').href=deliciousURL+'network/'+userName
  54. document.getElementById('importBookmarksLink').href=deliciousSettingURL+userName+'/bookmarks/import'
  55. document.getElementById('exportBookmarksLink').href=deliciousSettingURL+userName+'/bookmarks/export'
  56. document.getElementById('editBundleLink').href=deliciousSettingURL+userName+'/tags/bundle?noredir'
  57. }
  58. functionsetAutoUpdate(){
  59. if(autoUpdateTime<5){
  60. return
  61. }
  62. vartime=autoUpdateTime*1000*60
  63. window.setInterval(getLastUpdateTime,time)
  64. }
  65. functionloadXMLDoc(url,type,stateChange,data){
  66. if(authUser==''){
  67. showError('Userinformationnotdefined!')
  68. return
  69. }
  70. try{
  71. xmlhttp=external.max_activex(SECURITY_ID,"Microsoft.XMLHTTP")
  72. }
  73. catch(err){
  74. try{
  75. xmlhttp=newActiveXObject("Microsoft.XMLHTTP")
  76. }
  77. catch(err){
  78. showError('CouldnotloadActiveXobject')
  79. }
  80. }
  81. xmlhttp.onreadystatechange=stateChange
  82. xmlhttp.open("POST",url,true,'cookie','cookie')
  83. xmlhttp.setRequestHeader('User-Agent','Maxthondel.icio.ussidebarplugin')
  84. xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded')
  85. xmlhttp.setRequestHeader('Referrer','Maxthondel.icio.ussidebarplugin')
  86. vardata='_user='+authUser
  87. xmlhttp.send(data)
  88. }
  89. functioncheckReadyState(obj){
  90. if(obj.readyState==4){
  91. //alert(obj.responseText)
  92. if(obj.status==200||obj.status==201){
  93. returntrue;
  94. }
  95. elseif(obj.status==401||obj.status==403){
  96. varmessage='Couldnotlogin.Pleasecheckyour'+
  97. '<ahref="#"onclick="displaySettings()"style="color:red;text-decoration:underline">logininformation!</a>'
  98. showError(message)
  99. document.getElementById('favorites').innerHTML=message
  100. writeFile(favoritesCache,'')
  101. }
  102. elseif(obj.status==503){
  103. showError('Error503:Pleasetryagaininacoupleofminutes..')
  104. }
  105. else{
  106. showError(obj.status+''+obj.responseText);
  107. }
  108. }
  109. }
  110. functiongetLastUpdateTime(){
  111. varurl=baseURL+'posts/update?'+Math.round(Math.random()*1000)
  112. showError('Checkingforupdates...')
  113. loadXMLDoc(url,'getLastUpdateTime',onResponseGetLastUpdateTime)
  114. }
  115. functiononResponseGetLastUpdateTime(){
  116. if(!checkReadyState(xmlhttp)){
  117. return
  118. }
  119. varresponseXML=xmlhttp.responseXML
  120. if(responseXML==null){
  121. showError('ErrorloadingXML')
  122. return
  123. }
  124. try{
  125. varlastUpdateTime=responseXML.getElementsByTagName("update")[0].getAttribute('time')
  126. }catch(err){
  127. showError('badresponsegettingtime...')
  128. alert(xmlhttp.responseText)
  129. return
  130. }
  131. varpreviousUpdateTime=readSetting('UpdateTime')
  132. if(previousUpdateTime!=lastUpdateTime){
  133. showError('Updateavailable')
  134. writeSetting('UpdateTime',lastUpdateTime)
  135. window.setTimeout(updateFavorites,1000)
  136. }else{
  137. showError('Nofavoriteupdates')
  138. }
  139. }
  140. functionviewFavorites(){
  141. varhtml=unescape(readFile(favoritesCache))
  142. if(html==null||html==''){
  143. writeSetting('UpdateTime','')
  144. return
  145. }
  146. favoritesHTML=html
  147. currentlyOpenFolder=null
  148. document.getElementById('favorites').innerHTML=html
  149. }
  150. functiongetBundles(){
  151. varurl=baseURL+'tags/bundles/all?'+Math.round(Math.random()*1000)
  152. showError('Checkingforbundles...')
  153. loadXMLDoc(url,'getBundles',onResponseGetBundles)
  154. }
  155. functiononResponseGetBundles(){
  156. if(!checkReadyState(xmlhttp)){
  157. return
  158. }
  159. varresponseXML=xmlhttp.responseXML
  160. if(responseXML==null){
  161. showError('ErrorloadingBundleXML')
  162. return
  163. }
  164. bundleArray=newArray()
  165. varbundleTags=responseXML.getElementsByTagName("bundles")[0].childNodes
  166. for(vari=0;i<bundleTags.length;i++){
  167. bundleArray.push(newArray(bundleTags[i].getAttribute('name'),bundleTags[i].getAttribute('tags')))
  168. }
  169. window.setTimeout(downloadFavorites,1000)
  170. }
  171. functionupdateFavorites(){
  172. if(useBundles=='1'){
  173. getBundles()
  174. }else{
  175. downloadFavorites()
  176. }
  177. }
  178. functiondownloadFavorites(){
  179. varurl=baseURL+'posts/all?'+Math.round(Math.random()*1000)
  180. showError('Updating...')
  181. loadXMLDoc(url,'viewFavorites',onResponseViewFavorites)
  182. }
  183. functiononResponseViewFavorites(){
  184. if(!checkReadyState(xmlhttp)){
  185. return
  186. }
  187. varresponseXML=xmlhttp.responseXML
  188. if(responseXML==null){
  189. showError('ErrorloadingXML')
  190. return
  191. }
  192. varresponse=''
  193. posts=newArray()
  194. items=responseXML.getElementsByTagName("post");
  195. if(items&&items.length!=0){
  196. for(varj=0;j<items.length;j++){
  197. addPost(items[j],posts)
  198. }
  199. }
  200. else{
  201. response+='<b>Nofavoritesfound</b>'
  202. }
  203. vartags=newArray()
  204. addPostsToTags(posts,tags)
  205. if(sortTags=='1'){
  206. tags.sort()
  207. }
  208. response+=writeTree(tags)
  209. writeFile(favoritesCache,escape(response))
  210. favoritesHTML=response
  211. showError('FavoritesDownloaded')
  212. document.getElementById('favorites').innerHTML=response
  213. currentlyOpenFolder=null
  214. document.getElementById('searchbox').value=''
  215. }
  216. functiontitleSort(a,b){
  217. try{
  218. a=a.description.toLowerCase()
  219. b=b.description.toLowerCase()
  220. if(a<b){
  221. return-1
  222. }else{
  223. return1
  224. }
  225. }
  226. catch(err){
  227. return1
  228. }
  229. }
  230. functionaddPostsToTags(postsArray,tagsArray){
  231. for(vari=0;i<postsArray.length;i++){
  232. vartags=postsArray[i].tag.toLowerCase()
  233. vartagArray=tags.split('')
  234. for(varj=0;j<tagArray.length;j++){
  235. varposition=inArray(tagArray[j],tagsArray)
  236. if(position>=0){
  237. tagsArray[position][1].push(postsArray[i])
  238. }else{
  239. tagsArray.push(newArray(tagArray[j],newArray(postsArray[i])))
  240. }
  241. }
  242. }
  243. }
  244. functionwriteTree(tagsArray){
  245. varhtml=''
  246. varunfiledHtml=''
  247. for(vari=0;i<bundleArray.length;i++){
  248. varname=bundleArray[i][0]
  249. vartags=bundleArray[i][1].toLowerCase().split('')
  250. varbranchNumber=branch+10000
  251. html+=returnFolderHtml(branchNumber,name,true)
  252. html+=addTags(tags,tagsArray)
  253. html+='</div>/n'
  254. branch++
  255. }
  256. for(vari=0;i<tagsArray.length;i++){
  257. if(tagsArray[i][0]=='system:unfiled'){
  258. unfiledHtml=addLinks(tagsArray[i][1])
  259. continue
  260. }
  261. html+=returnTagHtml(tagsArray[i],true)
  262. }
  263. html+=unfiledHtml
  264. returnhtml
  265. }
  266. functionreturnFolderHtml(number,name,isBundle){
  267. if(isBundle!=null){
  268. varimageSrc='images/bundleClosed.gif'
  269. }else{
  270. varimageSrc='images/folderClosed.gif'
  271. }
  272. return'<divclass="trigger"onclick="expandCollapse('+number+')"oncontextmenu="showContextMenu(this);returnfalse"'+
  273. 'onmouseover="this.style.textDecoration=/'underline/'"onmouseout="this.style.textDecoration=/'none/'">'+
  274. '<imgsrc="'+imageSrc+'"border="0"id="folder'+number+'">'+
  275. name+
  276. '</div>/n<divclass="branch"id="branch'+number+'">'
  277. }
  278. functionaddTags(tags,tagsArray){
  279. varhtml=''
  280. for(vari=0;i<tags.length;i++){
  281. varposition=inArray(tags[i],tagsArray)
  282. if(position>-1){
  283. html+=returnTagHtml(tagsArray[position])
  284. }
  285. tagsArray.splice(position,1)
  286. }
  287. returnhtml
  288. }
  289. functionreturnTagHtml(tag,isHighBranch){
  290. if(isHighBranch!=null){
  291. varbranchNumber=branch+10000
  292. }else{
  293. varbranchNumber=branch
  294. }
  295. varhtml=returnFolderHtml(branchNumber,tag[0])
  296. html+=addLinks(tag[1])
  297. html+='</div>/n'
  298. branch++
  299. returnhtml
  300. }
  301. functionaddLinks(items){
  302. varhtml=''
  303. if(sortFavorites=='1'){
  304. items.sort(titleSort)
  305. }
  306. for(vari=0;i<items.length;i++){
  307. varitem=items[i]
  308. html+='<divclass=linkDivoncontextmenu="showContextMenu(this);returnfalse">'+
  309. '<aclass=linkhref="'+item.href+'"target=_blanktitle="'+item.tooltip+'"'+
  310. 'onmouseover="showLink(this.href)"onmouseout="hideLink()"'+
  311. 'extended="'+item.extended+'"tag="'+item.tag+'"hashCode="'+item.hash+'">'+
  312. '<imgsrc="images/page.gif">'+
  313. item.description+
  314. '</a>'+
  315. '</div>/n'
  316. }
  317. returnhtml
  318. }
  319. functionaddPost(item,array){
  320. varhref=item.getAttribute('href')
  321. vardescription=item.getAttribute('description')
  322. vartag=item.getAttribute('tag')
  323. vartime=item.getAttribute('time')//.substring(0,10)
  324. varhash=item.getAttribute('hash')
  325. varextended=item.getAttribute('extended')
  326. if(extended==null){
  327. extended=''
  328. }
  329. //timeslike2004-09-16T00:00:00Z
  330. vardate=newDate()
  331. date.setISO8601(time)
  332. time=date.toLocaleString()
  333. if(showTooltip=='1'){
  334. vartooltip='Added:'+time
  335. varMAX_DESCRIPTION_LENGTH=30
  336. if(description.length>MAX_DESCRIPTION_LENGTH){
  337. tooltip=description+'/n'+tooltip
  338. }
  339. if(extended){
  340. tooltip+='/nNote:'+extended
  341. }
  342. }else{
  343. vartooltip=''
  344. }
  345. array.push({'href':href,
  346. 'description':description,
  347. 'tag':tag,
  348. 'time':time,
  349. 'hash':hash,
  350. 'extended':extended,
  351. 'tooltip':tooltip
  352. })
  353. }
  354. functiononResponsePostFavorite(){
  355. if(!checkReadyState(xmlhttp)){
  356. return
  357. }
  358. varresponseXML=xmlhttp.responseXML
  359. if(responseXML==null){
  360. showError('ErrorloadingXML')
  361. return
  362. }
  363. try{
  364. varresponse=responseXML.getElementsByTagName("result")[0].getAttribute('code')
  365. }catch(err){
  366. showError('badresponsePosting...')
  367. alert(xmlhttp.responseText)
  368. return
  369. }
  370. if(response=='done'){
  371. showError('Favoriteadded!')
  372. window.setTimeout('getLastUpdateTime()',1000)
  373. }
  374. }
  375. functiondeleteFavorite(url){
  376. varurl=baseURL+'posts/delete?url='+encodeURIComponent(url)
  377. showError('deleting...')
  378. loadXMLDoc(url,'deleteFavorite',onResponseDeleteFavorite)
  379. }
  380. functiononResponseDeleteFavorite(){
  381. if(!checkReadyState(xmlhttp)){
  382. return
  383. }
  384. varresponseXML=xmlhttp.responseXML
  385. if(responseXML==null){
  386. showError('ErrorloadingXML')
  387. return
  388. }
  389. try{
  390. varresponse=responseXML.getElementsByTagName("result")[0].getAttribute('code')
  391. }catch(err){
  392. showError('badresponseDeleting...')
  393. alert(xmlhttp.responseText)
  394. return
  395. }
  396. if(response=='done'){
  397. showError('Favoritedeleted!')
  398. window.setTimeout('getLastUpdateTime()',1000)
  399. }else{
  400. showError('Error:'+response)
  401. }
  402. }
  403. functiongetCurrentWebsiteURL(){
  404. returnexternal.get_tab(SECURITY_ID,external.cur_sel).document.URL
  405. }
  406. functiongetCurrentWebsiteTitle(){
  407. returnexternal.get_tab(SECURITY_ID,external.cur_sel).document.title
  408. }
  409. functiongetEditWebsiteURL(){
  410. returneditElement.href
  411. }
  412. functiongetEditWebsiteTitle(){
  413. returneditElement.innerText
  414. }
  415. functiongetEditWebsiteNotes(){
  416. returneditElement.extended
  417. }
  418. functiongetEditWebsiteTags(){
  419. returneditElement.tag
  420. }
  421. functiondisplaySettings(){
  422. loadSettings()
  423. document.getElementById('favorites').style.display='none'
  424. document.getElementById('settings').style.display=''
  425. document.getElementById('message').style.display='none'
  426. document.getElementById('menu').style.display='none'
  427. document.getElementById('showSettings').onclick=function(){hideSettings()}
  428. }
  429. functiongetDeliciousCookie(){
  430. vardeliciousWindow=getDeliciousWindow()
  431. if(deliciousWindow==null){
  432. window.open(deliciousURL);
  433. }
  434. vardeliciousWindow=getDeliciousWindow()
  435. if(deliciousWindow){
  436. if(deliciousWindow.document.readyState=='complete'){
  437. saveCookie(deliciousWindow.document.cookie)
  438. }else{
  439. deliciousWindow.document.onreadystatechange=function(){
  440. if(deliciousWindow.document.readyState=='complete'){
  441. saveCookie(deliciousWindow.document.cookie)
  442. }
  443. }
  444. }
  445. }
  446. }
  447. functionsaveCookie(cookie){
  448. varmatch=cookie.match(/.*?_user=(.*?)(;|$)/)
  449. if(match){
  450. varuser=match[1]
  451. writeSetting('authUser',user)
  452. alert('Authenticated!')
  453. }else{
  454. writeSetting('authUser','')
  455. alert('Cookieproblem!/nCouldnotauthenticateyou./nMakesureyouareloggedintodelicious.com')
  456. }
  457. }
  458. functiongetDeliciousWindow(){
  459. varwin
  460. for(vari=0;i<external.tab_count;i++){
  461. win=external.get_tab(SECURITY_ID,i)
  462. if(win.document.URL.indexOf(deliciousURL)!=-1){
  463. returnwin
  464. }
  465. }
  466. returnnull
  467. }
  468. functionhideSettings(){
  469. document.getElementById('favorites').style.display=''
  470. document.getElementById('settings').style.display='none'
  471. document.getElementById('message').style.display='none'
  472. document.getElementById('menu').style.display=''
  473. document.getElementById('showSettings').onclick=function(){displaySettings()}
  474. }
  475. functioncancel(){
  476. hideSettings()
  477. if(authUser==''){
  478. varmessage='<ahref="javascript:displaySettings()">Loginfirst!</a>'
  479. document.getElementById('favorites').innerHTML=message
  480. }
  481. }
  482. functionsave(){
  483. /*if(userName!=userNameNew){
  484. writeFile(favoritesCache,'')
  485. }*/
  486. writeSetting('UpdateTime','')
  487. saveSettings()
  488. location.reload()
  489. }
  490. functioninArray(text,array){
  491. for(vari=0;i<array.length;i++){
  492. if(text==array[i][0]){
  493. returni
  494. }
  495. }
  496. return-1
  497. }
  498. functionloadSettings(){
  499. varallInputTags=document.getElementsByTagName('input')
  500. for(vari=0;i<allInputTags.length;i++){
  501. if(allInputTags[i].type=='checkbox'){
  502. if(readSetting(allInputTags[i].id+'')==TRUE){
  503. allInputTags[i].checked=true
  504. }
  505. else{
  506. allInputTags[i].checked=false
  507. }
  508. }
  509. if(allInputTags[i].type=='text'&&allInputTags[i].id!='searchbox'&&allInputTags[i].onkeydown==null){
  510. allInputTags[i].value=eval(allInputTags[i].id+'')
  511. }
  512. }
  513. }
  514. functionsaveSettings(){
  515. varallInputTags=document.getElementsByTagName('input');
  516. for(vari=0;i<allInputTags.length;i++){
  517. if(allInputTags[i].type=='checkbox'){
  518. if(allInputTags[i].checked==true){
  519. writeSetting(allInputTags[i].id+'',TRUE)
  520. }
  521. else{
  522. writeSetting(allInputTags[i].id+'',FALSE)
  523. }
  524. }
  525. if(allInputTags[i].type=='text'&&allInputTags[i].id!='searchbox'&&allInputTags[i].onkeydown==null){
  526. writeSetting(allInputTags[i].id+'',allInputTags[i].value)
  527. }
  528. }
  529. }
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics