mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-09-13 21:31:23 +00:00
Hash the state qualifier to make it shorter
We were having problems with TW5 generating filepaths that were longer than Windows likes. Fixes #240
This commit is contained in:
@@ -402,4 +402,15 @@ exports.getAnimationDuration = function() {
|
||||
return parseInt($tw.wiki.getTiddlerText("$:/config/AnimationDuration","400"),10);
|
||||
};
|
||||
|
||||
/*
|
||||
Hash a string to a number
|
||||
Derived from http://stackoverflow.com/a/15710692
|
||||
*/
|
||||
exports.hashString = function(str) {
|
||||
return str.split("").reduce(function(a,b) {
|
||||
a = ((a << 5) - a) + b.charCodeAt(0);
|
||||
return a & a;
|
||||
},0);
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user