Remove inline javascript from page header
This commit is contained in:
parent
293fb99467
commit
d7b4f88d5e
5 changed files with 56 additions and 28 deletions
|
@ -115,4 +115,24 @@ $(document).ready(function () {
|
|||
$("nav.primary li a").on("click", function() {
|
||||
$("header").toggleClass("closed");
|
||||
});
|
||||
|
||||
var application_data = $("head").data();
|
||||
|
||||
I18n.default_locale = OSM.DEFAULT_LOCALE;
|
||||
I18n.locale = application_data.locale;
|
||||
I18n.fallbacks = true;
|
||||
|
||||
OSM.preferred_editor = application_data.preferredEditor;
|
||||
|
||||
if (application_data.user) {
|
||||
OSM.user = application_data.user;
|
||||
|
||||
if (application_data.userHome) {
|
||||
OSM.home = application_data.userHome;
|
||||
}
|
||||
}
|
||||
|
||||
if (application_data.location) {
|
||||
OSM.location = application_data.location;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
//= require ohauth
|
||||
|
||||
$(document).ready(function () {
|
||||
var application_data = $("head").data();
|
||||
|
||||
function makeAbsolute(url) {
|
||||
var a = document.createElement('a');
|
||||
a.href = url;
|
||||
return a.href;
|
||||
}
|
||||
|
||||
if (OSM.oauth_token) {
|
||||
if (application_data.token) {
|
||||
var headerGenerator = window.ohauth.headerGenerator({
|
||||
consumer_key: OSM.oauth_consumer_key,
|
||||
consumer_secret: OSM.oauth_consumer_secret,
|
||||
token: OSM.oauth_token,
|
||||
token_secret: OSM.oauth_token_secret
|
||||
consumer_key: application_data.consumerKey,
|
||||
consumer_secret: application_data.consumerSecret,
|
||||
token: application_data.token,
|
||||
token_secret: application_data.tokenSecret
|
||||
});
|
||||
|
||||
$.ajaxPrefilter(function(options, jqxhr) {
|
||||
|
|
|
@ -16,6 +16,7 @@ OSM = {
|
|||
MAPQUEST_DIRECTIONS_URL: <%= MAPQUEST_DIRECTIONS_URL.to_json %>,
|
||||
MAPZEN_VALHALLA_URL: <%= MAPZEN_VALHALLA_URL.to_json %>,
|
||||
OSRM_URL: <%= OSRM_URL.to_json %>,
|
||||
DEFAULT_LOCALE: <%= I18n.default_locale.to_json %>,
|
||||
|
||||
<% if defined?(MAPQUEST_KEY) %>
|
||||
MAPQUEST_KEY: <%= MAPQUEST_KEY.to_json %>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue