]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #2812 from Hypolite/fix-browser-notifications
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Thu, 29 Sep 2016 05:40:59 +0000 (07:40 +0200)
committerGitHub <noreply@github.com>
Thu, 29 Sep 2016 05:40:59 +0000 (07:40 +0200)
Add HTML entity decoding to browser notifications

js/main.js

index 2d0b2da36ac533b8da509b88f987294b011589cd..72bef8849038894b10b82dad76be4aad8e9617a6 100644 (file)
                }
        }
 
-  function openClose(theID) {
-    if(document.getElementById(theID).style.display == "block") {
-      document.getElementById(theID).style.display = "none"
-    }
-    else {
-      document.getElementById(theID).style.display = "block"
-    }
-  }
+       function openClose(theID) {
+               if(document.getElementById(theID).style.display == "block") {
+                       document.getElementById(theID).style.display = "none"
+               }
+               else {
+                       document.getElementById(theID).style.display = "block"
+               }
+       }
 
-  function openMenu(theID) {
-      document.getElementById(theID).style.display = "block"
-  }
+       function openMenu(theID) {
+               document.getElementById(theID).style.display = "block"
+       }
 
-  function closeMenu(theID) {
-      document.getElementById(theID).style.display = "none"
-  }
+       function closeMenu(theID) {
+               document.getElementById(theID).style.display = "none"
+       }
 
+       function decodeHtml(html) {
+               var txt = document.createElement("textarea");
+               txt.innerHTML = html;
+               return txt.value;
+       }
 
 
        var src = null;
                                        if (notification_lastitem!== null && notification_id > notification_lastitem) {
                                                if (getNotificationPermission()==="granted") {
                                                        var notification = new Notification(document.title, {
-                                                                                         body: e.text().replace('&rarr; ','').format(e.attr('name')),
+                                                                                         body: decodeHtml(e.text().replace('&rarr; ','').format(e.attr('name'))),
                                                                                          icon: e.attr('photo'),
                                                                                         });
                                                        notification['url'] = e.attr('href');
                        $(".comment-edit-form  textarea").editor_autocomplete(baseurl+"/acl");
                        /* autocomplete bbcode */
                        $(".comment-edit-form  textarea").bbco_autocomplete('bbcode');
-                       
+
                        // setup videos, since VideoJS won't take care of any loaded via AJAX
                        if(typeof videojs != 'undefined') videojs.autoSetup();
                });