From 6ed8fb30b8b6b70c1f9a2ff5651d6a4892060db9 Mon Sep 17 00:00:00 2001 From: Einer von Vielen Date: Sat, 14 Feb 2015 20:33:51 +0100 Subject: [PATCH 1/2] Changed bb code [toc] to make it more flexible This usage is know closer to the original usage of http://ndabas.github.io/toc/ Changed: - jquery.toc.js: Do not check for empty headings - bbcode.php: Added processing of [toc] with parameters - main.js: Use the default params for jquery.toc.js - bbcode.html: Added more help for [toc] and corrected some html --- doc/bbcode.html | 41 ++++++++++++--------- include/bbcode.php | 9 ++++- library/tableofcontents/jquery.toc.js | 53 ++++++++++++--------------- view/js/main.js | 2 +- 4 files changed, 54 insertions(+), 51 deletions(-) diff --git a/doc/bbcode.html b/doc/bbcode.html index f0b61b33c..f75b1c90b 100644 --- a/doc/bbcode.html +++ b/doc/bbcode.html @@ -49,26 +49,31 @@

Red Matrix specific codes

- +

These require a suitable map plugin/addon such as openstreetmap or else the result will be blank

',$Text); + } // Check for centered text if (strpos($Text,'[/center]') !== false) { diff --git a/library/tableofcontents/jquery.toc.js b/library/tableofcontents/jquery.toc.js index 6ef36f49c..fe10850a3 100644 --- a/library/tableofcontents/jquery.toc.js +++ b/library/tableofcontents/jquery.toc.js @@ -15,8 +15,6 @@ * * The original script was modified to work within the red#martrix * - added var pathname - * - added var textHeading: Accept heading with text only - * Why? At the moment webpages can contain empty title using h3 */ (function ($) { @@ -55,36 +53,31 @@ // What level is the current heading? var elem = $(this), level = $.map(headingSelectors, function (selector, index) { return elem.is(selector) ? index : undefined; - })[0]; - - // Accept heading with text only - var textHeading = elem.text(); - if(textHeading != '') { - if (level > currentLevel) { - // If the heading is at a deeper level than where we are, start a new nested - // list, but only if we already have some list items in the parent. If we do - // not, that means that we're skipping levels, so we can just add new list items - // at the current level. - // In the upside-down stack, unshift = push, and stack[0] = the top. - var parentItem = stack[0].children("li:last")[0]; - if (parentItem) { - stack.unshift($("<" + listTag + "/>").appendTo(parentItem)); - } - } else { - // Truncate the stack to the current level by chopping off the 'top' of the - // stack. We also need to preserve at least one element in the stack - that is - // the containing element. - stack.splice(0, Math.min(currentLevel - level, Math.max(stack.length - 1, 0))); + })[0]; + if (level > currentLevel) { + // If the heading is at a deeper level than where we are, start a new nested + // list, but only if we already have some list items in the parent. If we do + // not, that means that we're skipping levels, so we can just add new list items + // at the current level. + // In the upside-down stack, unshift = push, and stack[0] = the top. + var parentItem = stack[0].children("li:last")[0]; + if (parentItem) { + stack.unshift($("<" + listTag + "/>").appendTo(parentItem)); } - // the variable pathname was added to the original script. - var pathname = window.location.pathname; - // Add the list item - $("
  • ").appendTo(stack[0]).append( - $("").text(elem.text()).attr("href", pathname + "#" + elem.attr("id")) - ); - - currentLevel = level; + } else { + // Truncate the stack to the current level by chopping off the 'top' of the + // stack. We also need to preserve at least one element in the stack - that is + // the containing element. + stack.splice(0, Math.min(currentLevel - level, Math.max(stack.length - 1, 0))); } + // the variable pathname was added to the original script. + var pathname = window.location.pathname; + // Add the list item + $("
  • ").appendTo(stack[0]).append( + $("").text(elem.text()).attr("href", pathname + "#" + elem.attr("id")) + ); + + currentLevel = level; }); }); }, old = $.fn.toc; diff --git a/view/js/main.js b/view/js/main.js index 17ea42db7..48505fc04 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1125,7 +1125,7 @@ $(document).ready(function() { $(".autotime").timeago(); - $("#toc").toc({content: "body", headings: "h1,h2,h3,h4"}); + $("#toc").toc(); }); From 4e6ba149d70cc4d3ae915cb0d0f298c74e408527 Mon Sep 17 00:00:00 2001 From: einervonvielen Date: Sun, 15 Feb 2015 18:11:51 +0100 Subject: [PATCH 2/2] Some changes of doc for beginning developers Made some corrections after following this manual step by step. --- doc/dev_beginner.bb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/dev_beginner.bb b/doc/dev_beginner.bb index c3e4ea07c..b29b0bad7 100644 --- a/doc/dev_beginner.bb +++ b/doc/dev_beginner.bb @@ -188,8 +188,7 @@ If you not want to use GIT from the command line - there is a usefull Eclipse pl You should have created an account on github and forked the projects befor you procceed. Delete the directory www -[code]root@debian /var/www/html $ cd .. -rm -R www/ +[code]root@debian:/var# rm -R www/ [/code] Install git (and optionally git-gui a client gui) @@ -211,7 +210,7 @@ root@debian:/var/www# mkdir -p "store/[data]/smarty3" Create .htconfig.php and make it writable by the webserver [code] -root@debian:/var# cd www/ +root@debian:/var/www# touch .htconfig.php root@debian:/var/www# chmod ou+w .htconfig.php [/code] @@ -224,6 +223,7 @@ root@debian:/var# chown -R www-data:www-data www/ Add yourself ("surfer" in this example) to the group www-data. Why? Later you want to modify files in eclipse or in another editor. Then make all files writable by the group www-date you are now a member of. [code] +root@debian:/var# cd www/ root@debian:/var/www# usermod -G www-data surfer root@debian:/var# chmod -R g+w www/ [/code]