]> git.mxchange.org Git - friendica.git/commitdiff
move js from theme.php to theme.js
authorrabuzarus <>
Fri, 15 Apr 2016 23:00:23 +0000 (01:00 +0200)
committerrabuzarus <>
Fri, 15 Apr 2016 23:00:23 +0000 (01:00 +0200)
js/theme.js
theme.php

index 7cd98c862d82100cf86cb169b2291f4dce110789..9a4d2987ba719fca8aa5d5a9d7039c00406c96db 100644 (file)
@@ -352,3 +352,51 @@ function random_digits(digits) {
 
        return rnd;
 }
+
+function insertFormatting(comment,BBcode,id) {
+
+               var tmpStr = $("#comment-edit-text-" + id).val();
+               if(tmpStr == comment) {
+                       tmpStr = "";
+                       $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
+                       $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
+                       openMenu("comment-edit-submit-wrapper-" + id);
+                       $("#comment-edit-text-" + id).val(tmpStr);
+               }
+
+       textarea = document.getElementById("comment-edit-text-" +id);
+       if (document.selection) {
+               textarea.focus();
+               selected = document.selection.createRange();
+               if (BBcode == "url"){
+                       selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
+                       } else
+               selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
+       } else if (textarea.selectionStart || textarea.selectionStart == "0") {
+               var start = textarea.selectionStart;
+               var end = textarea.selectionEnd;
+               if (BBcode == "url"){
+                       textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
+                       } else
+               textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
+       }
+       return true;
+}
+
+
+function showThread(id) {
+       $("#collapsed-comments-" + id).show()
+       $("#collapsed-comments-" + id + " .collapsed-comments").show()
+}
+function hideThread(id) {
+       $("#collapsed-comments-" + id).hide()
+       $("#collapsed-comments-" + id + " .collapsed-comments").hide()
+}
+
+
+function cmtBbOpen(id) {
+       $("#comment-edit-bb-" + id).show();
+}
+function cmtBbClose(id) {
+       $("#comment-edit-bb-" + id).hide();
+}
\ No newline at end of file
index 0d74116d98b4312b22cc656759c6fe3050692b86..66288b42e69e67514738a88f9d07d0acfe97e97e 100644 (file)
--- a/theme.php
+++ b/theme.php
@@ -27,59 +27,6 @@ function frio_init(&$a) {
 
        if ($style == "")
                $style = get_config('frio', 'style');
-
-$a->page['htmlhead'] .= <<< EOT
-<script type="text/javascript">
-
-function insertFormatting(comment,BBcode,id) {
-
-               var tmpStr = $("#comment-edit-text-" + id).val();
-               if(tmpStr == comment) {
-                       tmpStr = "";
-                       $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
-                       $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
-                       openMenu("comment-edit-submit-wrapper-" + id);
-                       $("#comment-edit-text-" + id).val(tmpStr);
-               }
-
-       textarea = document.getElementById("comment-edit-text-" +id);
-       if (document.selection) {
-               textarea.focus();
-               selected = document.selection.createRange();
-               if (BBcode == "url"){
-                       selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
-                       } else
-               selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
-       } else if (textarea.selectionStart || textarea.selectionStart == "0") {
-               var start = textarea.selectionStart;
-               var end = textarea.selectionEnd;
-               if (BBcode == "url"){
-                       textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
-                       } else
-               textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
-       }
-       return true;
-}
-
-
-function showThread(id) {
-       $("#collapsed-comments-" + id).show()
-       $("#collapsed-comments-" + id + " .collapsed-comments").show()
-}
-function hideThread(id) {
-       $("#collapsed-comments-" + id).hide()
-       $("#collapsed-comments-" + id + " .collapsed-comments").hide()
-}
-
-
-function cmtBbOpen(id) {
-       $("#comment-edit-bb-" + id).show();
-}
-function cmtBbClose(id) {
-       $("#comment-edit-bb-" + id).hide();
-}
-</script>
-EOT;
 }
 
 function frio_install() {