Sourcecode in HopObject/objectFunctions.js:
1: function createLinkParam(param) {
2: // clone the param object since known non-html
3: // attributes are going to be deleted
4: var linkParam = Object.clone(param);
5: var url = param.to ? param.to : param.linkto;
6: if (!url || url == "main") {
7: if (this._prototype != "Comment")
8: linkParam.href = this.href();
9: else
10: linkParam.href = this.story.href() + "#" + this._id;
11: } else if (url.contains("://") || url.startsWith("javascript"))
12: linkParam.href = url;
13: else {
14: // check if link points to a subcollection
15: if (url.contains("/"))
16: linkParam.href = this.href() + url;
17: else
18: linkParam.href = this.href(url);
19: }
20: if (param.urlparam)
21: linkParam.href += "?" + param.urlparam;
22: if (param.anchor)
23: linkParam.href += "#" + param.anchor;
24: delete linkParam.to;
25: delete linkParam.linkto;
26: delete linkParam.urlparam;
27: delete linkParam.anchor;
28: delete linkParam.text;
29: return linkParam;
30: }
|