From f9c9019d90733be6743fbdce2005e0ae515b123c Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Sat, 16 Apr 2016 01:00:23 +0200 Subject: [PATCH] move js from theme.php to theme.js --- js/theme.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ theme.php | 53 ----------------------------------------------------- 2 files changed, 48 insertions(+), 53 deletions(-) diff --git a/js/theme.js b/js/theme.js index 7cd98c862d..9a4d2987ba 100644 --- a/js/theme.js +++ b/js/theme.js @@ -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 diff --git a/theme.php b/theme.php index 0d74116d98..66288b42e6 100644 --- 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 - -EOT; } function frio_install() { -- 2.39.5