]> git.mxchange.org Git - friendica.git/blobdiff - js/main.js
Improve pagination on frio theme
[friendica.git] / js / main.js
index 13bd50bd8fcdbe4471f30ca025a98a271f216772..aaeef00cf731a03c12de3d6e8a5e95d1ee98695e 100644 (file)
        }
 
        function openMenu(theID) {
-               document.getElementById(theID).style.display = "block"
+               var el = document.getElementById(theID)
+               if (el) {
+                       el.style.display = "block";
+               }
        }
 
        function closeMenu(theID) {
-               document.getElementById(theID).style.display = "none"
+               var el = document.getElementById(theID)
+               if (el) {
+                       el.style.display = "none";
+               }
        }
 
        function decodeHtml(html) {
                /* setup comment textarea buttons */
                /* comment textarea buttons needs some "data-*" attributes to work:
                 *              data-role="insert-formatting" : to mark the element as a formatting button
-                *              data-comment="<string>" : string for "Comment", used by insertFormatting() function
                 *              data-bbcode="<string>" : name of the bbcode element to insert. insertFormatting() will insert it as "[name][/name]"
                 *              data-id="<string>" : id of the comment, used to find other comment-related element, like the textarea
                 * */
                $('body').on('click','[data-role="insert-formatting"]', function(e) {
                        e.preventDefault();
                        var o = $(this);
-                       var comment = o.data('comment');
                        var bbcode  = o.data('bbcode');
                        var id = o.data('id');
                        if (bbcode=="img") {
                                Dialog.doImageBrowser("comment", id);
                                return;
                        }
-                       insertFormatting(comment, bbcode, id);
+                       insertFormatting(bbcode, id);
                });
 
                /* event from comment textarea button popups */