Pārlūkot izejas kodu

Load JSON rather than expecting a script

New backend URL
master
Chris Smith 12 gadus atpakaļ
vecāks
revīzija
e74d977482
2 mainītis faili ar 4 papildinājumiem un 3 dzēšanām
  1. 1
    1
      .htaccess
  2. 3
    2
      res/js/viewer.js

+ 1
- 1
.htaccess Parādīt failu

1
 RewriteEngine On
1
 RewriteEngine On
2
-RewriteRule ^/?res/data/layouts/([0-9]+).js http://mifune.co.uk/~shane/convert.php?id=$1 [P]
2
+RewriteRule ^/?res/data/layouts/([0-9]+).js http://backend.layoutviewer.co.uk/getLayout/$1.js [P]

+ 3
- 2
res/js/viewer.js Parādīt failu

163
  $('#createlayout').click(showPicker);
163
  $('#createlayout').click(showPicker);
164
  $('#layoutmask').click(closePicker);
164
  $('#layoutmask').click(closePicker);
165
 
165
 
166
- function updateLayout() {
166
+ function updateLayout(data) {
167
+  layout = data;
167
   thisLevel = levels[layout.level - 1];
168
   thisLevel = levels[layout.level - 1];
168
   $('#mapcontainer').css('background-image', 'url("' + thisLevel.minimap + '")');
169
   $('#mapcontainer').css('background-image', 'url("' + thisLevel.minimap + '")');
169
 
170
 
177
  }
178
  }
178
 
179
 
179
  function getLayout(id) {
180
  function getLayout(id) {
180
-  $.getScript('res/data/layouts/' + id + '.js', updateLayout);
181
+  $.getJSON('res/data/layouts/' + id + '.js', updateLayout);
181
  }
182
  }
182
 
183
 
183
  getLayout(parseInt(getURLParameter('id')) || 13934);
184
  getLayout(parseInt(getURLParameter('id')) || 13934);

Notiek ielāde…
Atcelt
Saglabāt