Skip to content

Instantly share code, notes, and snippets.

@rissajeanne
Created July 26, 2011 17:09
Show Gist options
  • Save rissajeanne/1107246 to your computer and use it in GitHub Desktop.
Save rissajeanne/1107246 to your computer and use it in GitHub Desktop.
ABS.common.getShareUrl()
// Old
that.getShareUrl = function () {
return window.location.href.replace('/#', '/').replace('/%23', '/');
};
that.getShareUrl = function () {
var osisArr = ABS.verseSelector.getSelectedOsisSpans();
var osisUrl = ABS.util.osis.toUrl(osisArr[0][0]);
var version = ABS.spi.passagePanel.collection.first().get('version').id;
var root = window.location.protocol + "//" + window.location.host;
return root + "/" + version + "/" + osisUrl;
};
// ABS.util.osis.toUrl()
that.osis = {
// given an OSIS ID, return "$book/$chapter/$verse"
toUrl : function(osisId) {
return osisId.replace(/[:\.]/g, '/');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment