Commit b874a0b0 authored by Sven Franck's avatar Sven Franck

debug: firstElementChild and firstChild

parent 5a1fae4c
......@@ -272,7 +272,8 @@
// optionally wrap input in a div-fieldcontain
// NOTE: route is for custom HTML elements... service_instance_status
if (!spec.logic.route && (spec.logic.wrap !== true && spec.wrap !== true) || hidden_field) {
if ((!spec.logic.route && (spec.logic.wrap !== true && spec.wrap !== true))
|| hidden_field) {
wrapper = document.createDocumentFragment();
} else {
wrapper = factory.element({
......@@ -447,8 +448,7 @@
// add <span> which contains JQM current select
if (element_reverse) {
element_target.appendChild(factory.element({
"type": "span"}));
element_target.appendChild(factory.element({"type": "span"}));
} else {
element_target = container;
}
......@@ -473,7 +473,7 @@
element_target.appendChild(factory.element({
"type": "span",
"direct": {"className": "ui-invalid-label translate"},
"attributes": {"data-i18n":"validation_dict.required_field"}
"attributes": {"data-i18n": "validation_dict.required_field"}
}));
}
......@@ -886,7 +886,7 @@
// button group wrappers and title (inserted before last wrapper!)
target = function (new_spec) {
var position, drop_content, fragment, count, config, i, len, source;
var position, drop_content, fragment, count, config, i, len;
count = new_spec.j;
config = new_spec.config;
......@@ -911,11 +911,6 @@
pic = factory.element({"type": "picture"});
len = config.src_set.length;
// // all hail IE9
// pic.appendChild(
// document.createTextNode('<!--[if IE 9]><video style="display: none;"><![endif]-->')
// );
for (i = 0; i < len; i += 1) {
pic.appendChild(factory.element({
"type": "source",
......@@ -924,21 +919,16 @@
}));
}
// // again...
// pic.appendChild(
// document.createTextNode('<!--[if IE 9]></video><![endif]-->')
// );
pic.appendChild(factory.element({
"type": "img",
"direct": {"className": "ui-title-logo", "alt": config.alt},
"attributes": {"srcset": config.src_set[len - 1].srcset}
}));
source = factory.element({
"type": "img",
"direct": {"alt": config.alt},
"attributes": {"srcset": config.src_set[len - 1].srcset}
});
// source = factory.element({
// "type": "img",
// "direct": {"alt": config.alt},
// "attributes": {"srcset": config.src_set[len - 1].srcset}
// });
fragment.appendChild(pic);
} else {
fragment.appendChild(factory.element({
......@@ -1317,7 +1307,7 @@
"type": "div",
"direct": {"className": "navbar ui-navbar " + (spec.class_list || "")},
"attributes": {
"role": "navigation",
"role": "navigation"
},
"logic": {"data-reference": spec.reference || null}
});
......@@ -1882,7 +1872,7 @@
// TODO: dividers? will not be in spec, so can only be listview option!
// TODO: find better way to set mapper/widget
factory.widget.listview = function (spec) {
var fragment, has_filter, generator;
var fragment, generator;
// generate list item
generator = function (generator_spec) {
......@@ -1972,14 +1962,12 @@
// NOTE: if input provided, the filter is already there!
// THIS MAKES B
if (spec.filter && !spec.input) {
has_filter = true;
fragment.appendChild(factory.widget.formElement(
factory.util.searchBarTemplate({
fragment.appendChild(factory.widget.formElement(
factory.util.searchBarTemplate({
"search_id": spec.id || "search",
"text": spec.text || "",
"text_i18n": spec.text_i18n || null
})
));
}
......@@ -2005,7 +1993,8 @@
return {
"fragment": fragment,
"child_selector": spec.update !== true ? fragment.querySelector("ul") : fragment,
"child_selector": spec.update !== true ?
fragment.querySelector("ul") : fragment,
"child_constructor": generator,
"child_mapper": spec.map_children,
"base": "li",
......@@ -2327,7 +2316,7 @@
tag = factory.element({"type": "thead"});
tag.appendChild(
generator({
"item":section.field_list,
"item": section.field_list,
"wrapper": {
"property_dict": spec,
"wrap": true
......@@ -2388,7 +2377,7 @@
" translate"
},
"attributes": {
"data-i18n": "global_dict." + config.href.replace(/[#\/]/g,'')
"data-i18n": "global_dict." + config.href.replace(/[#\/]/g, '')
},
"logic": {
"data-action": config.action || null,
......@@ -2589,7 +2578,8 @@
"direct": {
"id": "select_" + (spec.id || id),
"name": "select_" +
(is_type ? (spec.id || id) : (spec.id || id || config.id).slice(0, -2)),
(is_type ? (spec.id || id) :
(spec.id || id || config.id).slice(0, -2)),
"className": spec.action ? "action" : ""
},
"attributes": input_dict,
......@@ -2768,7 +2758,7 @@
"clear": "true",
"action": "search",
"data-i18n": spec.text_i18n ?
("[placeholder]" + spec.text_i18n) : null
("[placeholder]" + spec.text_i18n) : null
}
};
};
......@@ -2779,7 +2769,7 @@
* @return {object} finished config object
**/
factory.util.searchBar = function (spec) {
var i, element_list, search_id, props, class_list, spec_list;
var i, element_list, search_id, props, spec_list;
search_id = spec.search_id = "search_" + util.uuid();
props = spec.slot ? {"slot": spec.slot} : {};
......@@ -3030,9 +3020,15 @@
})
.fail(function (error) {
switch (error.status) {
case 408: app.util.loader("", "status_dict.timeout", "clock-o"); break;
case 400: app.util.loader("", "validation_dict.general", "ban"); break;
default: app.util.loader("", "status_dict.error", "ban"); break;
case 408:
app.util.loader("", "status_dict.timeout", "clock-o");
break;
case 400:
app.util.loader("", "validation_dict.general", "ban");
break;
default:
app.util.loader("", "status_dict.error", "ban");
break;
}
});
},
......@@ -3052,7 +3048,7 @@
* @param {object} obj Action Object
**/
"update_bip": function (obj) {
var identifier, element_list, i, len, value = undefined;
var element_list, i, len, value;
if (obj.form) {
element_list = obj.form.getElementsByTagName("input");
for (i = 0, len = element_list.length; i < len; i += 1) {
......@@ -3063,45 +3059,57 @@
}
if (value) {
return storage.fetch({
storage.fetch({
"query": {"_id": value},
"pass": obj.pass || {}
})
.then(function (reply) {
obj.backpack = reply.response.data.rows[0].doc;
})
.then(function () {
return storage.write(obj)
.then(function (response) {
app.util.loader("", "status_dict.saved", "check");
app.navigate(obj, response);
})
.fail(function (error) {
switch (error.status) {
case 408: app.util.loader("", "status_dict.timeout", "clock-o"); break;
case 400: app.util.loader("", "validation_dict.general", "ban"); break;
default: app.util.loader("", "status_dict.error", "ban"); break;
}
});
})
.fail(app.util.error);
.then(function (reply) {
obj.backpack = reply.response.data.rows[0].doc;
})
.then(function () {
return storage.write(obj)
.then(function (response) {
app.util.loader("", "status_dict.saved", "check");
app.navigate(obj, response);
})
.fail(function (error) {
switch (error.status) {
case 408:
app.util.loader("", "status_dict.timeout", "clock-o");
break;
case 400:
app.util.loader("", "validation_dict.general", "ban");
break;
default:
app.util.loader("", "status_dict.error", "ban");
break;
}
});
})
.fail(app.util.error);
} else {
return storage.write(obj)
storage.write(obj)
.then(function (response) {
app.util.loader("", "status_dict.saved", "check");
app.navigate(obj, response);
})
.fail(function (error) {
switch (error.status) {
case 408: app.util.loader("", "status_dict.timeout", "clock-o"); break;
case 400: app.util.loader("", "validation_dict.general", "ban"); break;
default: app.util.loader("", "status_dict.error", "ban"); break;
case 408:
app.util.loader("", "status_dict.timeout", "clock-o");
break;
case 400:
app.util.loader("", "validation_dict.general", "ban");
break;
default:
app.util.loader("", "status_dict.error", "ban");
break;
}
});
}
},
/**
* PUT an object
* @method update
......@@ -3115,21 +3123,27 @@
})
.fail(function (error) {
switch (error.status) {
case 408: app.util.loader("", "status_dict.timeout", "clock-o"); break;
case 400: app.util.loader("", "validation_dict.general", "ban"); break;
default: app.util.loader("", "status_dict.error", "ban"); break;
case 408:
app.util.loader("", "status_dict.timeout", "clock-o");
break;
case 400:
app.util.loader("", "validation_dict.general", "ban");
break;
default:
app.util.loader("", "status_dict.error", "ban");
break;
}
});
},
/**
* Same as put but since there is no time to make dyno interaction, we cheat!
* Same as put but since there is no time to make dyno interaction, cheat!
* @method update
* @param {object} obj Action Object
**/
"update_custom": function (obj) {
storage.write(obj)
.then(function (response) {
storage.write(obj)
.then(function () {
var i, len, dyno_list, dyno, promise_list, dump;
// clear active page, because we need to reload
......@@ -3152,7 +3166,8 @@
"portal_type_title": dyno.state.title,
"property_dict": util.mergeObject(
{"dynamic": true},
dyno.state.dyno_dict),
dyno.state.dyno_dict
),
"scheme": dyno.state.scheme
},
{
......@@ -3163,10 +3178,10 @@
},
false
)
.fail(app.util.error);
.fail(app.util.error);
}
return RSVP.all(promise_list)
.then(function (response_list) {
.then(function () {
app.util.loader("", "status_dict.saved", "check");
//app.navigate(obj, response);
})
......@@ -3175,9 +3190,15 @@
.then(app.setPageBindings)
.fail(function (error) {
switch (error.status) {
case 408: app.util.loader("", "status_dict.timeout", "clock-o"); break;
case 400: app.util.loader("", "validation_dict.general", "ban"); break;
default: app.util.loader("", "status_dict.error", "ban"); break;
case 408:
app.util.loader("", "status_dict.timeout", "clock-o");
break;
case 400:
app.util.loader("", "validation_dict.general", "ban");
break;
default:
app.util.loader("", "status_dict.error", "ban");
break;
}
});
},
......@@ -3249,7 +3270,8 @@
element.value = i18n.t(target[1]);
break;
case "[parent":
element.parentNode.childNodes[0].textContent = i18n.t(target[1]);
element.parentNode.childNodes[0].textContent =
i18n.t(target[1]);
break;
case "[node":
element.childNodes[0].textContent = i18n.t(target[1]);
......@@ -3261,7 +3283,9 @@
default:
// NOTE: empty - setting .translate on a wrapper will empty it
util.deleteChildren(element);
element.appendChild(document.createTextNode(i18n.t(target[0])));
element.appendChild(
document.createTextNode(i18n.t(target[0]))
);
break;
}
}
......@@ -3603,7 +3627,7 @@
// TODO: subordinated fields should have links, not id only!!!
// NOTE: make sure there is no "id" flying through here!!! only _id
map.listItem = function (spec) {
var quirk_dict, section, label, j, k, field, setter, record, new_item,
var quirk_dict, section, label, j, k, field, record, new_item,
id, key, translation_fields, item, relation, promise_list, pass, count;
promise_list = [];
......@@ -3671,8 +3695,8 @@
}
return RSVP.all(promise_list)
.then(function(response_list) {
var l, len, response, obj, setter, pos;
.then(function (response_list) {
var l, len, response, obj, new_setter, pos;
for (l = 0, len = response_list.length; l < len; l += 1) {
response = response_list[l];
......@@ -3683,12 +3707,12 @@
// text/label/... all stuff translateable
if (response.text_element) {
obj[response.key + "_18n"] = record[response.key + "_i18n"];
setter = key;
new_setter = key;
} else {
setter = "value";
new_setter = "value";
}
obj[setter] = response.value;
obj[new_setter] = response.value;
new_item[pos].push(util.mergeObject(response.field, obj));
}
return new_item;
......@@ -3727,8 +3751,7 @@
// TODO: remove this crap or make it generic...
// set = setter_list ... JSLINT
setValue = function (setter) {
var n, len, set_value, set_flux, set, val, set_reference, logic,
selection, split;
var n, len, set_value, set_flux, set, val, set_reference, logic;
logic = setter.logic;
if (logic) {
......@@ -4113,7 +4136,9 @@
case 0:
clone.position = len === 1 ? null : true;
break;
case len -1: clone.position = false; break;
case len - 1:
clone.position = false;
break;
}
group.children.push(clone);
}
......@@ -4150,7 +4175,8 @@
helper.children.push(section_response_list[m]);
}
// HACK for Thierry
helper.reference = helper.property_dict.reference = spec.wrapper.reference;
helper.reference = helper.property_dict.reference =
spec.wrapper.reference;
return RSVP.resolve(helper);
})
......@@ -4193,7 +4219,7 @@
var data = answer.response.data;
// set subordinate value
if (data.total_rows > 0) {
spec.value = data.rows[0].doc[spec.subordinate]
spec.value = data.rows[0].doc[spec.subordinate];
}
// NOTE: delete here, otherwise impossible to track. This will still
......@@ -4296,7 +4322,7 @@
// TODO: storage.add included prefetch of field_items and validation
// TODO: storage.add deleted identifier if create_new was set
storage.write = function (obj) {
var form, data, valid, prefix, config, method, action, pointer, sample;
var form, data, valid, prefix, config, method, action, pointer;
form = obj.form;
pointer = (obj.element || storage.span).getAttribute("data-action");
......@@ -4304,9 +4330,9 @@
config = {};
prefix = obj.id + "_";
valid = obj.sample_store || storage.validate(form);
if (valid) {
data = obj.sample_data || storage.parseForm(valid, prefix, true);
// HACK: Thierry
if (obj.backpack) {
data = util.mergeObject(obj.backpack, data);
......@@ -4342,6 +4368,7 @@
app.storage_dict.items[method || "post"](data, config)
);
}
$.mobile.loading("show");
app.util.loader("", "validation_dict.general", "ban");
return RSVP.reject({"status": 400});
};
......@@ -4609,7 +4636,8 @@
break;
default:
if (plain) {
container[property.replace(clean, "").replace("select_", "")] = value;
container[property.replace(clean, "").replace("select_", "")] =
value;
} else {
container.append(property.replace(clean, ""), value);
}
......@@ -4871,7 +4899,8 @@
"portal_type_title": config.state.title,
"property_dict": util.mergeObject(
{"dynamic": true},
config.state.dyno_dict),
config.state.dyno_dict
),
"scheme": config.state.scheme
},
{
......@@ -4892,10 +4921,9 @@
* @param {string} direction Direction to sort
* @param {string} prev Previous icon
* @param {string} next Next icon
* @param {boolean} single Single state sort
*/
// TODO: overwrite direction on single state sorting
app.sort = function (config, direction, prev, next, single) {
app.sort = function (config, direction, prev, next) {
var i, in_array, sort_by, delay, state;
// NOTE: if column title is not set, we might be sortling a list!
......@@ -5126,7 +5154,8 @@
"portal_type_title": state.title,
"property_dict": util.mergeObject(
{"dynamic": true},
state.dyno_dict),
state.dyno_dict
),
"scheme": state.scheme
},
{
......@@ -5528,7 +5557,7 @@
.enhanceWithin()
.on("click", "img.ui-title-logo", function (e, data) {
.on("click", "img.ui-title-logo", function () {
$.mobile.changePage("#home");
})
......@@ -5939,10 +5968,9 @@
* Get the active JQM page in JavaScript-only
* @method getPage
* @param {string} url url of the page to fetch
* @param {string} straight If not set, we start searching from behind
* @return {string} id of active page
*/
util.getPage = function (url, straight) {
util.getPage = function (url) {
var i, kid, len, kids = document.body.children;
// reverse, because in JQM last page is the active page!
......@@ -6023,22 +6051,6 @@
return new RegExp("(?:^|\\s)" + className + "(?!\\S)", "g");
};
// /**
// * Property to set whether classlist is supported
// * @property support_classList
// */
// // TODO: add to support module/Modernizr
// util.no_support_classList = document.documentElement.classList === undefined;
//
// util.testForString = util.no_support_classList ?
// function(el, clss) {
// return el.className && new RegExp("(^|\\s)" +
// clss + "(\\s|$)").test(el.className);
// } :
// function(el, clss) {
// return el.classList.contains(clss);
// };
/**
* Test for a class name
* @method testForString
......@@ -6131,12 +6143,12 @@
// HACK Thierryfic hack
if (is_html) {
return util.ajax(
{"url": "data/" + pass.url_dict.href}
).then(function(e) {
return util.ajax({
"url": "data/" + pass.url_dict.href
}).then(function (e) {
// Don't look...
var i, len, fragment, response = $.parseHTML(
e.target.response.replace("/erp5/","/", "g")
e.target.response.replace("/erp5/", "/", "g")
);
fragment = document.createDocumentFragment();
......@@ -6473,10 +6485,10 @@
// will be passed down the rendering tree
app.content.make = function (reply) {
var pass, method, type, kids, promise_list, route,
search, search_id, kid, is_html, is_dynamic, is_id, i, j, k, last,
encoded, wrapper, active, selector, update_target, target, widget,
search, search_id, kid, is_html, is_dynamic, is_id, i, last,
encoded, wrapper, active, selector, update_target, widget,
quirk_dict, generator, pointer_results, data_total_rows, is_parameter,
param_len, parameter, no_item, dyno, container, has_props, widget_dyno,
no_item, dyno, container, has_props, widget_dyno,
set_reference;
pass = reply.pass;
......@@ -6590,7 +6602,7 @@
// =====================================================================
// NOTE: store state on wrapper property_dict to inherit!
wrapper.property_dict.state = pass.state
wrapper.property_dict.state = pass.state;
// =====================================================================
// inherit item id, so it's available in form as indentifier
......@@ -6662,7 +6674,9 @@
"children": [{
"type": "p",
"direct": {"className": "ui-table-caption translate"},
"attributes": {"data-i18n": quirk_dict.caption.text_i18n || null},
"attributes": {
"data-i18n": quirk_dict.caption.text_i18n || null
},
"logic": {"text": quirk_dict.caption.text}
}]
});
......@@ -6677,11 +6691,11 @@
// add popup (local/global)
switch (quirk_dict.need_popup) {
case "local":
if (util.getPage().querySelectorAll("div.local_popup") === null) {
target.appendChild(factory.widget.popup({}));
}
break;
// case "local":
// if (util.getPage().querySelectorAll("div.local_popup") === null) {
// target.appendChild(factory.widget.popup({}));
// }
// break;
case "global":
if (document.getElementById("global_popup") === null) {
document.documentElement.appendChild(factory.widget.popup({}));
......@@ -6693,11 +6707,15 @@
// TODO: can this be done without storing on and querying DOM???!!!
// TODO: THIS MAKES ME INSANE... qsa || widget does not work!
widget = pass.state.gadget;
widget_dyno = widget.querySelector("[data-update]") || widget.getElementsByTagName("form")[0];
wrapper.property_dict.map_children = widget_dyno.getAttribute("data-map");
widget_dyno = widget.querySelector("[data-update]") ||
widget.getElementsByTagName("form")[0];
wrapper.property_dict.map_children =
widget_dyno.getAttribute("data-map");
wrapper = util.mergeObject(
factory.widget[widget_dyno.getAttribute("data-widget")](wrapper.property_dict),
factory.widget[widget_dyno.getAttribute("data-widget")](
wrapper.property_dict
),
wrapper
);
......@@ -6827,11 +6845,11 @@
return RSVP.all(promise_list)
.then(function (response_list) {
var k, l, m, len, done_target, wrapper_selector, response, content,
content_target, last_child, detach, child_list;
var h, l, m, len, done_target, wrapper_selector, response, content,
last_child, detach, child_list;
for (k = 0, l = response_list.length; k < l; k += 1) {
response = response_list[k];
for (h = 0, l = response_list.length; h < l; h += 1) {
response = response_list[h];
done_target = undefined;
if (response) {
......@@ -6881,13 +6899,13 @@
);
}
} else {
// TODO: terrible. what about footer/header/popup.
if (content.querySelector("div.panel")) {
wrapper.fragment.appendChild(content);
} else {
(wrapper.child_selector || wrapper.fragment)
.appendChild(content);
}
// TODO: terrible. what about footer/header/popup.
if (content.querySelector("div.panel")) {
wrapper.fragment.appendChild(content);
} else {
(wrapper.child_selector || wrapper.fragment)
.appendChild(content);
}
}
}
}
......@@ -6903,10 +6921,12 @@
// UPDATES - same %&/( as above
if (quirk_dict.update) {
selector = pass.state.gadget;
update_target = widget.querySelector("[data-update]") || widget.getElementsByTagName("form")[0];
update_target = widget.querySelector("[data-update]") ||
widget.getElementsByTagName("form")[0];
// TODO: generic method!
// TODO: or inherit reference to controlgroup without being child of form?
// TODO: or inherit reference to controlgroup without being
// child of form?
// rescue persistent elements from dump
detach = document.createDocumentFragment();
child_list = update_target.children;
......@@ -6925,8 +6945,8 @@
// CREATE
} else {
selector = wrapper.fragment.firstElementChild || wrapper.fragment;
selector = wrapper.fragment.firstElementChild ||
wrapper.fragment.firstChild || wrapper.fragment;
// TODO: find way to dig down into tree
if (util.testForString("dyno", selector.className) === false) {
......@@ -7063,7 +7083,8 @@
// TODO: clean up, no exceptions (location), clear key + val!
// TODO: make lookup parsing robust!
app.util.setParam = function (kid, wrapper) {
var i, len, param_list, param, href, loc, splitter, key, val, lookup, new_val;
var i, len, param_list, param, href, loc, splitter, key, val, lookup,
new_val;
param_list = kid.logic.setParam;
for (i = 0, len = param_list.length; i < len; i += 1) {
......@@ -7072,40 +7093,41 @@
key = param[0];
switch (val) {
// NOTE: hacked for oauth redirect url
// TODO: find way to include encoding when setting a href
case "location":
href = kid.direct.href;
splitter = href.indexOf("?") > 0 ? "&" : "?";
loc = window.location;
kid.direct.href += splitter + window.encodeURIComponent(key) +
"=" + window.encodeURIComponent(
loc.origin + loc.pathname + loc.hash.split("?")[0]
);
// NOTE: hacked for oauth redirect url
// TODO: find way to include encoding when setting a href
case "location":
href = kid.direct.href;
splitter = href.indexOf("?") > 0 ? "&" : "?";
loc = window.location;
kid.direct.href += splitter + window.encodeURIComponent(key) +
"=" + window.encodeURIComponent(
loc.origin + loc.pathname + loc.hash.split("?")[0]
);
break;
// set values or flag for subordination inside map.element
default:
kid.logic[key] = kid.logic[key] || "";
if (val.split("subordinate_").length > 1) {
// NOTE: try to get value from state/URL before flagging
// NOTE: must check for equality, otherwise id foo > foofoo
// TODO: this is still super-not-robust... redo!
lookup = wrapper.property_dict.state.query.query;
if (lookup && lookup.indexOf(val) > -1) {
new_val = lookup.split(val)[1].split("+")[0]
.replace(":=", "").replace(")","");
if (kid.logic[key] !== new_val) {
kid.logic[key] += new_val;
}
} else {
kid.needs_subordination = true;
// set values or flag for subordination inside map.element
default:
kid.logic[key] = kid.logic[key] || "";
if (val.split("subordinate_").length > 1) {
// NOTE: try to get value from state/URL before flagging
// NOTE: must check for equality, otherwise id foo > foofoo
// TODO: this is still super-not-robust... redo!
lookup = wrapper.property_dict.state.query.query;
if (lookup && lookup.indexOf(val) > -1) {
new_val = lookup.split(val)[1].split("+")[0]
.replace(":=", "").replace(")", "");
if (kid.logic[key] !== new_val) {
kid.logic[key] += new_val;
}
} else {
kid.logic[key] += wrapper.property_dict.data.doc[val];
delete kid.logic.setParam[i];
kid.needs_subordination = true;
}
} else {
kid.logic[key] += wrapper.property_dict.data.doc[val];
delete kid.logic.setParam[i];
}
break;
}
}
return kid;
......@@ -7126,8 +7148,7 @@
* @returns {object} Query to run based on parameters
*/
app.util.parseQueryParameter = function (str) {
var i, param_list, param_len, param, initial_query, indicator,
value_list;
var i, param_list, param_len, param, initial_query, indicator;
param_list = str.split("&");
initial_query = {};
......@@ -7135,27 +7156,25 @@
for (i = 0, param_len = param_list.length; i < param_len; i += 1) {
param = param_list[i].split(":");
indicator = param[0];
value_list = param[1];
switch (indicator) {
case "query":
initial_query.query = param[1].replace("=", ":=", "g")
.replace("+", " AND ", "g");
break;
case "limit":
// NOTE: Thanks Tristan!
initial_query.limit = param[1].split("+")
.map(function (part) { return part.split("=")[1]; });
break;
case "sort":
initial_query.sort_on = param[1].split("+").map(function (part) {
var s = part.split("=");
return [s[0], s[1]];
});
break;
case "select":
initial_query.select_list = param[1].replace("+", ",", "g");
break;
case "query":
initial_query.query = param[1].replace("=", ":=", "g")
.replace("+", " AND ", "g");
break;
case "limit":
// NOTE: Thanks Tristan!
initial_query.limit = param[1].split("+")
.map(function (part) { return part.split("=")[1]; });
break;
case "sort":
initial_query.sort_on = param[1].split("+").map(function (part) {
var s = part.split("=");
return [s[0], s[1]];
});
break;
case "select":
initial_query.select_list = param[1].replace("+", ",", "g");
break;
}
}
return initial_query;
......@@ -7168,7 +7187,7 @@
* @return {object} navigation object
**/
app.util.parseLink = function (url) {
var i, hash, path, clean_hash, decode, root, last, stripped, url_query,
var hash, path, clean_hash, decode, root, last, stripped, url_query,
strip;
hash = $.mobile.path.parseUrl(
......@@ -7201,7 +7220,7 @@
}
// check for mode
path = stripped.split("/");
last = path.length -1;
last = path.length - 1;
return {
"mode": path[last],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment