mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-07 14:23:53 +00:00
Fix bad function declaration in wiki.js (#3559)
fix for #3555 - inner function declaration should be on top of its "host" function error originally appeared on firefox v38.0.5
This commit is contained in:
parent
430be4ec30
commit
7729649f0e
@ -538,29 +538,8 @@ exports.findListingsOfTiddler = function(targetTitle,fieldName) {
|
|||||||
Sorts an array of tiddler titles according to an ordered list
|
Sorts an array of tiddler titles according to an ordered list
|
||||||
*/
|
*/
|
||||||
exports.sortByList = function(array,listTitle) {
|
exports.sortByList = function(array,listTitle) {
|
||||||
var list = this.getTiddlerList(listTitle);
|
var self = this,
|
||||||
if(!array || array.length === 0) {
|
replacedTitles = Object.create(null);
|
||||||
return [];
|
|
||||||
} else {
|
|
||||||
var titles = [], t, title;
|
|
||||||
// First place any entries that are present in the list
|
|
||||||
for(t=0; t<list.length; t++) {
|
|
||||||
title = list[t];
|
|
||||||
if(array.indexOf(title) !== -1) {
|
|
||||||
titles.push(title);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Then place any remaining entries
|
|
||||||
for(t=0; t<array.length; t++) {
|
|
||||||
title = array[t];
|
|
||||||
if(list.indexOf(title) === -1) {
|
|
||||||
titles.push(title);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Finally obey the list-before and list-after fields of each tiddler in turn
|
|
||||||
var sortedTitles = titles.slice(0),
|
|
||||||
replacedTitles = Object.create(null),
|
|
||||||
self = this;
|
|
||||||
function replaceItem(title) {
|
function replaceItem(title) {
|
||||||
if(!$tw.utils.hop(replacedTitles, title)) {
|
if(!$tw.utils.hop(replacedTitles, title)) {
|
||||||
replacedTitles[title] = true;
|
replacedTitles[title] = true;
|
||||||
@ -597,7 +576,28 @@ exports.sortByList = function(array,listTitle) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
var list = this.getTiddlerList(listTitle);
|
||||||
|
if(!array || array.length === 0) {
|
||||||
|
return [];
|
||||||
|
} else {
|
||||||
|
var titles = [], t, title;
|
||||||
|
// First place any entries that are present in the list
|
||||||
|
for(t=0; t<list.length; t++) {
|
||||||
|
title = list[t];
|
||||||
|
if(array.indexOf(title) !== -1) {
|
||||||
|
titles.push(title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Then place any remaining entries
|
||||||
|
for(t=0; t<array.length; t++) {
|
||||||
|
title = array[t];
|
||||||
|
if(list.indexOf(title) === -1) {
|
||||||
|
titles.push(title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Finally obey the list-before and list-after fields of each tiddler in turn
|
||||||
|
var sortedTitles = titles.slice(0);
|
||||||
for(t=0; t<sortedTitles.length; t++) {
|
for(t=0; t<sortedTitles.length; t++) {
|
||||||
title = sortedTitles[t];
|
title = sortedTitles[t];
|
||||||
replaceItem(title);
|
replaceItem(title);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user