projects
/
euphorik.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add a project and module file for IntelliJ.
[euphorik.git]
/
js
/
fragment.js
diff --git
a/js/fragment.js
b/js/fragment.js
index
835c05e
..
4ffbf8f
100644
(file)
--- a/
js/fragment.js
+++ b/
js/fragment.js
@@
-17,16
+17,22
@@
// along with Euphorik. If not, see <http://www.gnu.org/licenses/>.
/**
// along with Euphorik. If not, see <http://www.gnu.org/licenses/>.
/**
- *
+ *
Gestion du fragment d'url, permet de le modifier en direct.
*/
Fragment = function() {
var thisFragment = this;
*/
Fragment = function() {
var thisFragment = this;
+ // remplacement des codes de type %22 (en hexa)
+ var replaceHtmlCode = function(str) {
+ return str.replace(/%(\d\d)/g, function(text, code) {
+ return String.fromCharCode(parseInt(code, 16));
+ });
+ };
this.fragments = {};
if (!window.location.hash) {
return;
}
try {
this.fragments = {};
if (!window.location.hash) {
return;
}
try {
- var fragmentsStr =
window.location.hash.slice(1
).split(";");
+ var fragmentsStr =
replaceHtmlCode(window.location.hash.slice(1)
).split(";");
fragmentsStr.each(function(i, tuple) {
tuple = tuple.split("=");
thisFragment.fragments[tuple[0]] = JSON.parse(tuple[1]);
fragmentsStr.each(function(i, tuple) {
tuple = tuple.split("=");
thisFragment.fragments[tuple[0]] = JSON.parse(tuple[1]);
@@
-38,25
+44,25
@@
Fragment = function() {
Fragment.prototype.setVal = function(name, val) {
this.fragments[name] = val;
Fragment.prototype.setVal = function(name, val) {
this.fragments[name] = val;
-}
+}
;
Fragment.prototype.getVal = function(name) {
return this.fragments[name];
Fragment.prototype.getVal = function(name) {
return this.fragments[name];
-}
+}
;
Fragment.prototype.delVal = function(name) {
delete this.fragments[name];
Fragment.prototype.delVal = function(name) {
delete this.fragments[name];
-}
+}
;
Fragment.prototype.eraseAllVal = function() {
this.fragments = [];
Fragment.prototype.eraseAllVal = function() {
this.fragments = [];
-}
+}
;
Fragment.prototype.each = function(fun) {
objectEach(this.fragments, function(name, val) {
fun(name, val);
});
Fragment.prototype.each = function(fun) {
objectEach(this.fragments, function(name, val) {
fun(name, val);
});
-}
+}
;
Fragment.prototype.write = function() {
var fragmentsStr = "";
Fragment.prototype.write = function() {
var fragmentsStr = "";
@@
-66,4
+72,4
@@
Fragment.prototype.write = function() {
first = false;
});
window.location.hash = fragmentsStr;
first = false;
});
window.location.hash = fragmentsStr;
-}
+};
\ No newline at end of file