1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-22 12:22:08 +01:00

Add try-catch to followed tags obtaining

Just in case.
This commit is contained in:
Dmitriy Bogdanov 2016-07-17 14:12:33 +04:00
parent 0072f22845
commit 568d542df5
No known key found for this signature in database
GPG key ID: F396CC2653B8F64D

View file

@ -91,12 +91,14 @@ public class Helpers {
" if (typeof gon !== 'undefined' && typeof gon.user !== 'undefined') {" + " if (typeof gon !== 'undefined' && typeof gon.user !== 'undefined') {" +
" var followed_tags = document.getElementById(\"followed_tags\");" + " var followed_tags = document.getElementById(\"followed_tags\");" +
" if(followed_tags != null) {" + " if(followed_tags != null) {" +
" try {" +
" var links = followed_tags.nextElementSibling.children[0].children;" + " var links = followed_tags.nextElementSibling.children[0].children;" +
" var tags = [];" + " var tags = [];" +
" for(var i = 0; i < links.length - 1; i++) {" + // the last element is "Manage followed tags" link " for(var i = 0; i < links.length - 1; i++) {" + // the last element is "Manage followed tags" link
" tags.push(links[i].innerText.substring(1));" + " tags.push(links[i].innerText.substring(1));" +
" }" + " }" +
" gon.user[\"android_app.followed_tags\"] = tags;" + " gon.user[\"android_app.followed_tags\"] = tags;" +
" } catch(e) {}" +
" }" + " }" +
" var userProfile = JSON.stringify(gon.user);" + " var userProfile = JSON.stringify(gon.user);" +
" AndroidBridge.setUserProfile(userProfile.toString());" + " AndroidBridge.setUserProfile(userProfile.toString());" +