Permalink
Browse files

FLUID-4323: Fixed the chrome issue that the table of contents does no…

…t populated properly.
  • Loading branch information...
1 parent 536234a commit 63371a5b62eaae17695ead899941e78733823d4a Cindy Qi Li committed Apr 1, 2013
@@ -48,12 +48,12 @@ var fluid_1_5 = fluid_1_5 || {};
* @param Object Contains a list of headings, usually generated by that.locate("headings")
* @return filtered headings
*/
- fluid.tableOfContents.filterHeadings = function (headings) {
- return headings.filter(":visible").filter('[class!="flc-tableOfContents-exclude"]');
+ fluid.tableOfContents.filterHeadings = function (headings, exclude) {
+ return headings.filter(":visible").filter('[class!="' + exclude + '"]');
};
fluid.tableOfContents.regenerateToc = function (that) {
- var headings = that.filterHeadings(that.locate("headings"));
+ var headings = that.filterHeadings(that.locate("headings"), that.options.selectors.exclude);
that.anchorInfo = fluid.transform(headings, function (heading) {
return that.headingTextToAnchor(heading);
});
@@ -129,7 +129,8 @@ var fluid_1_5 = fluid_1_5 || {};
},
selectors: {
headings: ":header",
- tocContainer: ".flc-toc-tocContainer"
+ tocContainer: ".flc-toc-tocContainer",
+ exclude: "flc-tableOfContents-exclude"
},
events: {
onReady: null,
@@ -128,6 +128,9 @@ var fluid_1_5 = fluid_1_5 || {};
selectors: {
content: ".flc-uiOptions-content"
},
+ styles: {
+ simplified: "fl-uiOptins-content-simplified"
+ },
model: {
value: false
},
@@ -150,29 +153,34 @@ var fluid_1_5 = fluid_1_5 || {};
fluid.uiOptions.actionAnts.simplifiedContentEnactor.set = function (value, that) {
var contentContainer = that.container.find(that.options.selectors.content);
+ var simplified = contentContainer.hasClass(that.options.styles.simplified);
if (!that.initialContent || !that.article) {
that.initialContent = contentContainer.html();
- $("aside", that.container).remove();
- $("img", that.container).css("float", "none");
- $("figure", that.container).css("float", "none");
- var article = contentContainer.find("article").html();
+ var articleDom = contentContainer.find("article").clone();
+ $("aside", articleDom).remove();
+ $("img", articleDom).css("float", "none");
+ $("figure", articleDom).css("float", "none");
+ var article = articleDom.html();
that.article = article ? article : that.initialContent;
that.origBg = $("body").css("background-image");
}
if (value) {
- if (contentContainer.html() !== that.article) {
+ if (!simplified) {
$("body").css("background-image", "none");
contentContainer.html(that.article);
+ contentContainer.addClass(that.options.styles.simplified);
+ that.events.settingChanged.fire();
}
} else {
- if (contentContainer.html() !== that.initialContent) {
+ if (simplified) {
$("body").css("background-image", that.origBg);
contentContainer.html(that.initialContent);
+ contentContainer.removeClass(that.options.styles.simplified);
+ that.events.settingChanged.fire();
}
}
- that.events.settingChanged.fire();
};
fluid.uiOptions.actionAnts.simplifiedContentEnactor.finalInit = function (that) {

0 comments on commit 63371a5

Please sign in to comment.