spb-utils.js
866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* "Class" for select and option html generation
*/
var SelectElement = (function() {
function SelectElement(name, id) {
this.select = document.createElement("select");
}
SelectElement.prototype.setAttr = function(attr, value) {
return this.select.setAttribute(attr, value);
};
SelectElement.prototype.addOption = function(option) {
return this.select.add(option);
};
SelectElement.prototype.getSelect = function() {
return this.select;
};
SelectElement.generateOption = function(value, text) {
var option;
option = document.createElement("option");
option.setAttribute("value", value);
option.text = text;
return option;
};
return SelectElement;
})();
function url_with_subdirectory(url) {
var subdirectory = jQuery("meta[property='noosfero:root']").attr("content");
return subdirectory+url;
}