Mercurial > hg > OKFNAnnotator
comparison annotator_files/lib/extensions.js @ 4:6979313586cf
new version of annotator.
author | casties |
---|---|
date | Mon, 27 Aug 2012 19:05:38 +0200 |
parents | 6356e78ccf5c |
children |
comparison
equal
deleted
inserted
replaced
3:6356e78ccf5c | 4:6979313586cf |
---|---|
1 // Generated by CoffeeScript 1.3.3 | |
1 var $, gettext, _gettext, _ref, _t; | 2 var $, gettext, _gettext, _ref, _t; |
2 | 3 |
3 gettext = null; | 4 gettext = null; |
4 | 5 |
5 if (typeof Gettext !== "undefined" && Gettext !== null) { | 6 if (typeof Gettext !== "undefined" && Gettext !== null) { |
89 var elem, idx, path; | 90 var elem, idx, path; |
90 path = ''; | 91 path = ''; |
91 elem = this; | 92 elem = this; |
92 while (elem && elem.nodeType === 1 && elem !== relativeRoot) { | 93 while (elem && elem.nodeType === 1 && elem !== relativeRoot) { |
93 idx = $(elem.parentNode).children(elem.tagName).index(elem) + 1; | 94 idx = $(elem.parentNode).children(elem.tagName).index(elem) + 1; |
94 idx = idx > 1 ? "[" + idx + "]" : ""; | 95 idx = "[" + idx + "]"; |
95 path = "/" + elem.tagName.toLowerCase() + idx + path; | 96 path = "/" + elem.tagName.toLowerCase() + idx + path; |
96 elem = elem.parentNode; | 97 elem = elem.parentNode; |
97 } | 98 } |
98 return path; | 99 return path; |
99 }); | 100 }); |
103 $.escape = function(html) { | 104 $.escape = function(html) { |
104 return html.replace(/&(?!\w+;)/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'); | 105 return html.replace(/&(?!\w+;)/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'); |
105 }; | 106 }; |
106 | 107 |
107 $.fn.escape = function(html) { | 108 $.fn.escape = function(html) { |
108 if (arguments.length) return this.html($.escape(html)); | 109 if (arguments.length) { |
110 return this.html($.escape(html)); | |
111 } | |
109 return this.html(); | 112 return this.html(); |
110 }; | 113 }; |
114 | |
115 $.fn.reverse = [].reverse; |