]> git.mxchange.org Git - friendica.git/commitdiff
filebrowser fixs, use it in comment textareas
authorFabrixxm <fabrix.xm@gmail.com>
Wed, 29 Jul 2015 09:30:04 +0000 (11:30 +0200)
committerFabrixxm <fabrix.xm@gmail.com>
Wed, 29 Jul 2015 09:30:04 +0000 (11:30 +0200)
move filebrowser js to single file
document filebrowser usage
replace "onclick" for comment style buttons with data-* and move logic to main.js
use filebrowser to insert images in comments

js/filebrowser.js [new file with mode: 0644]
js/main.js
view/templates/filebrowser_plain.tpl
view/templates/jot-header.tpl
view/theme/dispy/templates/comment_item.tpl
view/theme/duepuntozero/templates/comment_item.tpl
view/theme/frost-mobile/templates/comment_item.tpl
view/theme/frost/templates/comment_item.tpl
view/theme/quattro/templates/comment_item.tpl
view/theme/vier/templates/comment_item.tpl

diff --git a/js/filebrowser.js b/js/filebrowser.js
new file mode 100644 (file)
index 0000000..8f7b78d
--- /dev/null
@@ -0,0 +1,116 @@
+/**\r
+ * Filebrowser - Friendica Communications Server\r
+ * \r
+ * Copyright (c) 2010-2013 the Friendica Project\r
+ *\r
+ * This program is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Affero General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This code handle user interaction for image/file upload/browser dialog.\r
+ * Is loaded from filebrowser_plain.tpl\r
+ *\r
+ * To load filebrowser in colorbox, call\r
+ *\r
+ *     $.colorbox({href: ulr, iframe:true,innerWidth:'500px',innerHeight:'400px'})\r
+ *\r
+ * where url is:\r
+ *\r
+ *             <baseurl>/fbrowser/<type>/?mode=minimal[#<eventname>-<id>]\r
+ *\r
+ *             baseurl: baseurl from friendica\r
+ *             type: one of "image", "file"\r
+ *             eventname: event name to catch return value\r
+ *             id: id returned to event handler\r
+ *\r
+ *     When user select an item, an event in fired in parent page, on body element\r
+ *     The event is named\r
+ *\r
+ *             fbrowser.<type>.[<eventname>]\r
+ *             \r
+ *     with params:\r
+ *\r
+ *             filemane: filename of item choosed by user\r
+ *             embed: bbcode to embed element into posts\r
+ *             id: id from url\r
+ *\r
+ *  example:\r
+ *\r
+ *     // open dialog for select an image for a textarea with id "myeditor"\r
+ *             var id="myeditor";\r
+ *             $.colorbox({href: baseurl + "/fbrowser/image/?mode=minimal#example-"+id, iframe:true,innerWidth:'500px',innerHeight:'400px'})\r
+ *\r
+ *             // setup event handler to get user selection\r
+ *             $("body").on("fbrowser.image.example", function(event, filename, bbcode, id) {\r
+ *                     // close colorbox\r
+ *                     $.colorbox.close();\r
+ *                     // replace textxarea text with bbcode\r
+ *                     $(id).value = bbcode;\r
+ *             });\r
+ **/\r
\r
+var FileBrowser = {\r
+       nickname : "",\r
+       type : "",\r
+       event: "",\r
+       id : null,\r
+       \r
+       init: function(nickname, type) {\r
+               FileBrowser.nickname = nickname;\r
+               FileBrowser.type = type;\r
+               FileBrowser.event = "fbrowser."+type;\r
+               if (location['hash']!=="") {\r
+                       var h = location['hash'].replace("#","");\r
+                       FileBrowser.event = FileBrowser.event + "." + h.split("-")[0];\r
+                       FileBrowser.id = h.split("-")[1];\r
+               }\r
+               \r
+               console.log("FileBrowser:", nickname, type,FileBrowser.event, FileBrowser.id );\r
+               $(".photo-album-photo-link").on('click', function(e){\r
+                       e.preventDefault();\r
+                       \r
+                       var embed = "";\r
+                       if (FileBrowser.type == "image") {\r
+                               embed = "[url="+this.dataset.link+"][img]"+this.dataset.img+"[/img][/url]";\r
+                       }\r
+                       if (FileBrowser.type=="file") {\r
+                               // attachment links are "baseurl/attach/id"; we need id\r
+                               embed = "[attachment]"+this.dataset.link.split("/").pop()+"[/attachment]";\r
+                       }\r
+                       console.log(FileBrowser.event, this.dataset.filename, embed, FileBrowser.id);\r
+                       parent.$("body").trigger(FileBrowser.event, [\r
+                               this.dataset.filename,\r
+                               embed,\r
+                               FileBrowser.id\r
+                       ]);\r
+                       \r
+               });\r
+               \r
+               if ($("#upload-image").length)\r
+                       var image_uploader = new window.AjaxUpload(\r
+                               'upload-image',\r
+                               { action: 'wall_upload/'+FileBrowser.nickname,\r
+                                       name: 'userfile',\r
+                                       onSubmit: function(file,ext) { $('#profile-rotator').show(); },\r
+                                       onComplete: function(file,response) {\r
+                                               location = baseurl + "/fbrowser/image/?mode=minimal"+location['hash'];\r
+                                               location.reload(true);\r
+                                       }                                \r
+                               }\r
+                       );\r
+\r
+               if ($("#upload-file").length)\r
+                       var file_uploader = new window.AjaxUpload(\r
+                               'upload-file',\r
+                               { action: 'wall_attach/'+FileBrowser.nickname,\r
+                                       name: 'userfile',\r
+                                       onSubmit: function(file,ext) { $('#profile-rotator').show(); },\r
+                                       onComplete: function(file,response) {\r
+                                               location = baseurl + "/fbrowser/file/?mode=minimal"+location['hash'];\r
+                                               location.reload(true);                          }                                \r
+                               }\r
+               );\r
+       }\r
+};\r
+\r
index 239a875cb418896f00cbd86458cf322b3f9a84e3..d3cce33040a6d8fc53b0b635fbfa1eb3e19644ab 100644 (file)
                        e.tipTip({defaultPosition: pos, edgeOffset: 8});
                });*/
                
+               /* setup comment textarea buttons */
+               
+               $('[data-role="insert-formatting"]').on('click', 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") {
+                               $.colorbox({href: baseurl + "/fbrowser/image/?mode=minimal#comment-"+id, iframe:true,innerWidth:'500px',innerHeight:'400px'})
+                               return; 
+                       }
+                       
+                       insertFormatting(comment, bbcode, id);
+               });
+
+               /* event from comment textarea button popups */
+               /* insert returned bbcode at cursor position or replace selected text */
+               $("body").on("fbrowser.image.comment", function(e, filename, bbcode, id) {
+                       console.log("on", id);
+                       $.colorbox.close();
+                       var textarea = document.getElementById("comment-edit-text-" +id);
+                       var start = textarea.selectionStart;
+                       var end = textarea.selectionEnd;
+                       textarea.value = textarea.value.substring(0, start) + bbcode + textarea.value.substring(end, textarea.value.length);
+               });
+       
                
                
                /* setup onoff widgets */
index 4d29f60b8fd9e63bd8ab00a64c4bc4a0d763f8f4..9b70fbf8524ec5e019720360ea61d4c502d6e4a0 100644 (file)
@@ -4,28 +4,36 @@
        -->
 
 <script type="text/javascript" src="{{$baseurl}}/js/ajaxupload.js" ></script>
-
+<script type="text/javascript" src="{{$baseurl}}/js/filebrowser.js"></script>
+<script>
+       $(function() {
+               FileBrowser.init("{{$nickname}}", "{{$type}}");
+       });
+</script>
 <div class="fbrowser {{$type}}">
 
        <div class="path">
                {{foreach $path as $p}}<a href="{{$p.0}}">{{$p.1}}</a>{{/foreach}}
        </div>
        
+       {{if $folders }}
        <div class="folders">
                <ul>
                        {{foreach $folders as $f}}<li><a href="{{$baseurl}}/fbrowser/{{$type}}/{{$f.0}}">{{$f.1}}</a></li>{{/foreach}}
                </ul>
        </div>
+       {{/if}}
                
-       {{foreach $files as $f}}
-       <div class="photo-album-image-wrapper">
-               <a href="#" class="photo-album-photo-link" data-link="{{$f.0}}" data-filename="{{$f.1}}" data-img="{{$f.2}}">
-                       <img src="{{$f.2}}">
-                       <p>{{$f.1}}</p>
-               </a>
+       <div class="list">
+               {{foreach $files as $f}}
+               <div class="photo-album-image-wrapper">
+                       <a href="#" class="photo-album-photo-link" data-link="{{$f.0}}" data-filename="{{$f.1}}" data-img="{{$f.2}}">
+                               <img src="{{$f.2}}">
+                               <p>{{$f.1}}</p>
+                       </a>
+               </div>
+               {{/foreach}}
        </div>
-       <div class="photo-album-image-wrapper-end"></div>
-       {{/foreach}}
 
        <div class="upload">
                <button id="upload-{{$type}}"><img id="profile-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait|escape:'html'}}" style="display: none;" /> {{"Upload"|t}}</button> 
 </div>
 
 
-
-       <script>
-               $(".photo-album-photo-link").on('click', function(e){
-                       e.preventDefault();
-                       
-                       {{if $type == "image"}}
-                       var embed = "[url="+this.dataset.link+"][img]"+this.dataset.img+"[/img][/url]";
-                       {{/if}}
-                       {{if $type == "file"}}
-                       var embed = "[url="+this.dataset.link+"][img]"+this.dataset.img+"[/img] "+this.dataset.filename+"[/url]";
-                       {{/if}}
-                       console.log(this.dataset.filename, embed, parent.$("body"));
-                       parent.$("body").trigger("fbrowser.{{$type}}", [
-                               this.dataset.filename,
-                               embed,
-                       ]);
-                       
-               });
-               
-               if ($("#upload-image").length)
-                       var image_uploader = new window.AjaxUpload(
-                               'upload-image',
-                               { action: 'wall_upload/{{$nickname}}',
-                                       name: 'userfile',
-                                       onSubmit: function(file,ext) { $('#profile-rotator').show(); },
-                                       onComplete: function(file,response) {
-                                               location = baseurl + "/fbrowser/image/?mode=minimal";
-                                               location.reload(true);
-                                       }                                
-                               }
-                       );
-
-               if ($("#upload-file").length)
-                       var file_uploader = new window.AjaxUpload(
-                               'upload-file',
-                               { action: 'wall_attach/{{$nickname}}',
-                                       name: 'userfile',
-                                       onSubmit: function(file,ext) { $('#profile-rotator').show(); },
-                                       onComplete: function(file,response) {
-                                               location = baseurl + "/fbrowser/file/?mode=minimal";
-                                               location.reload(true);                          }                                
-                               }
-                       );
-               
-               
-
-       </script>
-
        </body>
        
 </html>
index 5f498e706fea257016f16c206e3763f4631ff0ee..c4934f10b6bb8edac752e67a9faff35fb4fd0b4f 100644 (file)
@@ -142,11 +142,11 @@ function enableOnUser(){
                 **/
        
                /* callback */
-               $('body').on('fbrowser.image', function(e, filename, embedcode) {
+               $('body').on('fbrowser.image', function(e, filename, embedcode, id) {
                        $.colorbox.close();
                        addeditortext(embedcode);
                });
-               $('body').on('fbrowser.file', function(e, filename, embedcode) {
+               $('body').on('fbrowser.file', function(e, filename, embedcode, id) {
                        $.colorbox.close();
                        addeditortext(embedcode);
                });
index b9462e0a7a23294254c431f6dbb061290338494d..9af025454661b08cfeee1492f590e2c6aba8585a 100644 (file)
                                <ul class="comment-edit-bb-{{$id}}">
                                        <li><a class="editicon boldbb shadow"
                                                style="cursor: pointer;"
-                                               onclick="insertFormatting('{{$comment}}','b', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="b" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon italicbb shadow"
                                                style="cursor: pointer;"
-                                               onclick="insertFormatting('{{$comment}}','i', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="i" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon underlinebb shadow"
                                                style="cursor: pointer;"
-                                               onclick="insertFormatting('{{$comment}}','u', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="u" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon quotebb shadow"
                                                style="cursor: pointer;"
-                                               onclick="insertFormatting('{{$comment}}','quote', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="quote" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon codebb shadow"
                                                style="cursor: pointer;"
-                                               onclick="insertFormatting('{{$comment}}','code', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="code" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon imagebb shadow"
                                                style="cursor: pointer;"
-                                               onclick="insertFormatting('{{$comment}}','img', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="img" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon urlbb shadow"
                                                style="cursor: pointer;"
-                                               onclick="insertFormatting('{{$comment}}','url', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="url" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon videobb shadow"
                                                style="cursor: pointer;"
-                                               onclick="insertFormatting('{{$comment}}','video', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="video" data-id="{{$id}}"></a></li>
                                </ul>
                                <div class="comment-edit-bb-end"></div>
                                <textarea id="comment-edit-text-{{$id}}"
index afbac7c643192b8248a4002758730419646d90f4..1bb9dc6663d8f0759c9fb458c907b8b5d2a0bc43 100644 (file)
                                <ul class="comment-edit-bb-{{$id}}">
                                        <li><a class="editicon boldbb shadow"
                                                style="cursor: pointer;" title="{{$edbold}}"
-                                               onclick="insertFormatting('{{$comment}}','b', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="b" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon italicbb shadow"
                                                style="cursor: pointer;" title="{{$editalic}}"
-                                               onclick="insertFormatting('{{$comment}}','i', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="i" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon underlinebb shadow"
                                                style="cursor: pointer;" title="{{$eduline}}"
-                                               onclick="insertFormatting('{{$comment}}','u', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="u" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon quotebb shadow"
                                                style="cursor: pointer;" title="{{$edquote}}"
-                                               onclick="insertFormatting('{{$comment}}','quote', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="quote" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon codebb shadow"
                                                style="cursor: pointer;" title="{{$edcode}}"
-                                               onclick="insertFormatting('{{$comment}}','code', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="code" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon imagebb shadow"
                                                style="cursor: pointer;" title="{{$edimg}}"
-                                               onclick="insertFormatting('{{$comment}}','img', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="img" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon urlbb shadow"
                                                style="cursor: pointer;" title="{{$edurl}}"
-                                               onclick="insertFormatting('{{$comment}}','url', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="url" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon videobb shadow"
                                                style="cursor: pointer;" title="{{$edvideo}}"
-                                               onclick="insertFormatting('{{$comment}}','video', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="video" data-id="{{$id}}"></a></li>
                                </ul>   
                                <div class="comment-edit-bb-end"></div>
                                <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" onFocus="commentOpen(this,{{$id}});cmtBbOpen(this, {{$id}});" onBlur="commentClose(this,{{$id}});cmtBbClose(this,{{$id}});" >{{$comment}}</textarea>                       
index bd3e57716df8e9762847198102f62be23d632843..11aa31116aba2a5e53cb92b8e19df827d16d3c67 100644 (file)
                                <ul class="comment-edit-bb-{{$id}}">
                                        <li><a class="editicon boldbb shadow"
                                                style="cursor: pointer;" title="{{$edbold}}"
-                                               onclick="insertFormatting('{{$comment}}','b', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="b" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon italicbb shadow"
                                                style="cursor: pointer;" title="{{$editalic}}"
-                                               onclick="insertFormatting('{{$comment}}','i', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="i" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon underlinebb shadow"
                                                style="cursor: pointer;" title="{{$eduline}}"
-                                               onclick="insertFormatting('{{$comment}}','u', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="u" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon quotebb shadow"
                                                style="cursor: pointer;" title="{{$edquote}}"
-                                               onclick="insertFormatting('{{$comment}}','quote', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="quote" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon codebb shadow"
                                                style="cursor: pointer;" title="{{$edcode}}"
-                                               onclick="insertFormatting('{{$comment}}','code', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="code" data-id="{{$id}}"></a></li>
 {{*<!--                                        <li><a class="editicon imagebb shadow"
                                                style="cursor: pointer;" title="{{$edimg}}"
-                                               onclick="insertFormatting('{{$comment}}','img', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="img" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon urlbb shadow"
                                                style="cursor: pointer;" title="{{$edurl}}"
-                                               onclick="insertFormatting('{{$comment}}','url', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="url" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon videobb shadow"
                                                style="cursor: pointer;" title="{{$edvideo}}"
-                                               onclick="insertFormatting('{{$comment}}','video', {{$id}});"></a></li>-->*}}
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="video" data-id="{{$id}}"></a></li>-->*}}
                                </ul>   
                                {{*<!--<div class="comment-edit-bb-end"></div>-->*}}
 {{*<!--                                <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" onFocus="commentOpen(this,{{$id}});cmtBbOpen({{$id}});" onBlur="commentClose(this,{{$id}});cmtBbClose({{$id}});" >{{$comment}}</textarea>-->*}}
index 34eade358578b583e7acfa2aa3570f6782aa1665..56adbb1af3d9730c43ddeeaa475ea04883fd5cb4 100644 (file)
                                <ul class="comment-edit-bb" id="comment-edit-bb-{{$id}}">
                                        <li><a class="editicon boldbb shadow"
                                                style="cursor: pointer;" title="{{$edbold}}"
-                                               onclick="insertFormatting('{{$comment}}','b', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="b" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon italicbb shadow"
                                                style="cursor: pointer;" title="{{$editalic}}"
-                                               onclick="insertFormatting('{{$comment}}','i', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="i" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon underlinebb shadow"
                                                style="cursor: pointer;" title="{{$eduline}}"
-                                               onclick="insertFormatting('{{$comment}}','u', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="u" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon quotebb shadow"
                                                style="cursor: pointer;" title="{{$edquote}}"
-                                               onclick="insertFormatting('{{$comment}}','quote', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="quote" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon codebb shadow"
                                                style="cursor: pointer;" title="{{$edcode}}"
-                                               onclick="insertFormatting('{{$comment}}','code', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="code" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon imagebb shadow"
                                                style="cursor: pointer;" title="{{$edimg}}"
-                                               onclick="insertFormatting('{{$comment}}','img', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="img" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon urlbb shadow"
                                                style="cursor: pointer;" title="{{$edurl}}"
-                                               onclick="insertFormatting('{{$comment}}','url', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="url" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon videobb shadow"
                                                style="cursor: pointer;" title="{{$edvideo}}"
-                                               onclick="insertFormatting('{{$comment}}','video', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="video" data-id="{{$id}}"></a></li>
                                </ul>   
 {{*<!--                                <div class="comment-edit-bb-end"></div>-->*}}
 {{*<!--                                <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" onFocus="commentOpen(this,{{$id}});cmtBbOpen({{$id}});" onBlur="commentClose(this,{{$id}});cmtBbClose({{$id}});" >{{$comment}}</textarea>-->*}}
index d3d5c46320e961581fd644d0d099b4dcda8ea0be..20417c1e186f96bd1b1fbc2e70bbb471796d8d0f 100644 (file)
                                        class="comment-edit-bb">
                                        <li><a class="editicon boldbb shadow"
                                                style="cursor: pointer;" title="{{$edbold}}"
-                                               onclick="insertFormatting('{{$comment}}','b', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="b" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon italicbb shadow"
                                                style="cursor: pointer;" title="{{$editalic}}"
-                                               onclick="insertFormatting('{{$comment}}','i', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="i" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon underlinebb shadow"
                                                style="cursor: pointer;" title="{{$eduline}}"
-                                               onclick="insertFormatting('{{$comment}}','u', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="u" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon quotebb shadow"
                                                style="cursor: pointer;" title="{{$edquote}}"
-                                               onclick="insertFormatting('{{$comment}}','quote', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="quote" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon codebb shadow"
                                                style="cursor: pointer;" title="{{$edcode}}"
-                                               onclick="insertFormatting('{{$comment}}','code', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="code" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon imagebb shadow"
                                                style="cursor: pointer;" title="{{$edimg}}"
-                                               onclick="insertFormatting('{{$comment}}','img', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="img" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon urlbb shadow"
                                                style="cursor: pointer;" title="{{$edurl}}"
-                                               onclick="insertFormatting('{{$comment}}','url', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="url" data-id="{{$id}}"></a></li>
                                        <li><a class="editicon videobb shadow"
                                                style="cursor: pointer;" title="{{$edvideo}}"
-                                               onclick="insertFormatting('{{$comment}}','video', {{$id}});"></a></li>
+                                               data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="video" data-id="{{$id}}"></a></li>
                                </ul>   
                                <textarea id="comment-edit-text-{{$id}}" 
                                        class="comment-edit-text-empty" 
                                        name="body" 
-                                       onFocus="commentOpen(this,{{$id}}) && cmtBbOpen({{$id}});" 
-                                       onBlur="commentClose(this,{{$id}}) && cmtBbClose({{$id}});" >{{$comment}}</textarea>
+                                       onFocus="commentOpen(this,{{$id}}) && cmtBbOpen({{$id}});" >{{$comment}}</textarea>
                                {{if $qcomment}}
                                        <select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});" >
                                        <option value=""></option>
index 62a42c6e865e2083366982bdc3466631c28b20b9..7a9627b7795771e5c929ffcc0512f31b196555a5 100644 (file)
                                <div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-{{$id}}" style="display: none;" >
 
                                <div class="comment-edit-bb">
-                                       <a title="{{$edimg}}" onclick="insertFormatting('{{$comment}}','img',{{$id}});"><i class="icon-picture"></i></a>      
-                                       <a title="{{$edurl}}" onclick="insertFormatting('{{$comment}}','url',{{$id}});"><i class="icon-link"></i></a>
-                                       <a title="{{$edvideo}}" onclick="insertFormatting('{{$comment}}','video',{{$id}});"><i class="icon-film"></i></a>
+                                       <a title="{{$edimg}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="img" data-id="{{$id}}"><i class="icon-picture"></i></a>      
+                                       <a title="{{$edurl}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="url" data-id="{{$id}}"><i class="icon-link"></i></a>
+                                       <a title="{{$edvideo}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="video" data-id="{{$id}}"><i class="icon-film"></i></a>
                                                                                 
-                                       <a title="{{$eduline}}" onclick="insertFormatting('{{$comment}}','u',{{$id}});"><i class="icon-underline"></i></a>
-                                       <a title="{{$editalic}}" onclick="insertFormatting('{{$comment}}','i',{{$id}});"><i class="icon-italic"></i></a>
-                                       <a title="{{$edbold}}" onclick="insertFormatting('{{$comment}}','b',{{$id}});"><i class="icon-bold"></i></a>
-                                       <a title="{{$edquote}}" onclick="insertFormatting('{{$comment}}','quote',{{$id}});"><i class="icon-quote-left"></i></a>
+                                       <a title="{{$eduline}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="u" data-id="{{$id}}"><i class="icon-underline"></i></a>
+                                       <a title="{{$editalic}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="i" data-id="{{$id}}"><i class="icon-italic"></i></a>
+                                       <a title="{{$edbold}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="b" data-id="{{$id}}"><i class="icon-bold"></i></a>
+                                       <a title="{{$edquote}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="quote" data-id="{{$id}}"><i class="icon-quote-left"></i></a>
 
                                 </div>
                                        <input type="submit" onclick="post_comment({{$id}}); return false;" id="comment-edit-submit-{{$id}}" class="comment-edit-submit" name="submit" value="{{$submit}}" />