Fixed bbode element toc for webpages
- At the moment webpages can contain empty headings if the textarea "Title" is left empty in the webpage creator (https://hostname/webpages/username)
This commit is contained in:
parent
6657712714
commit
123ca1d403
@ -13,7 +13,10 @@
|
||||
* or implied. See the License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The original script was modified to work within the red#martrix (added var pathname).
|
||||
* 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 ($) {
|
||||
@ -54,6 +57,9 @@
|
||||
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
|
||||
@ -78,6 +84,7 @@
|
||||
);
|
||||
|
||||
currentLevel = level;
|
||||
}
|
||||
});
|
||||
});
|
||||
}, old = $.fn.toc;
|
||||
|
@ -1125,7 +1125,7 @@ $(document).ready(function() {
|
||||
|
||||
|
||||
$(".autotime").timeago();
|
||||
$("#toc").toc({content: "div.page-body", headings: "h1,h2,h3,h4"});
|
||||
$("#toc").toc({content: "body", headings: "h1,h2,h3,h4"});
|
||||
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user