rename data-prefix to data-isso

This commit is contained in:
Martin Zimmermann 2013-11-05 14:25:12 +01:00
parent af6695e935
commit 33fb15e241
2 changed files with 6 additions and 7 deletions

View File

@ -122,14 +122,14 @@ You can configure the client (the JS part) via `data-` attributes:
Make sure to escape the attribute value. Make sure to escape the attribute value.
* data-prefix * data-isso
Isso usually detects the REST API automatically, but when you serve the JS Isso usually detects the REST API automatically, but when you serve the JS
script on a different location, this may fail. Use `data-prefix` to script on a different location, this may fail. Use `data-isso` to
override the API location: override the API location:
```html ```html
<script data-prefix="/isso" src="/path/to/embed.min.js"></script> <script data-isso="/isso" src="/path/to/embed.min.js"></script>
``` ```
### Webserver configuration ### Webserver configuration

View File

@ -30,19 +30,18 @@ define(["q"], function(Q) {
* *
* .. code-block:: html * .. code-block:: html
* *
* <script data-prefix="/path" src="/.../embed.min.js"></script> * <script data-isso="http://example.tld/path/" src="/.../embed.min.js"></script>
* *
* 2. use require.js (during development). When using require.js, we * 2. use require.js (during development). When using require.js, we
* assume that the path to the scripts ends with `/js/`. * assume that the path to the scripts ends with `/js/`.
*
*/ */
var script, endpoint, var script, endpoint,
js = document.getElementsByTagName("script"); js = document.getElementsByTagName("script");
for (var i = 0; i < js.length; i++) { for (var i = 0; i < js.length; i++) {
if (js[i].dataset.issoPrefix !== undefined) { if (js[i].dataset.isso !== undefined) {
endpoint = js[i].dataset.issoPrefix; endpoint = js[i].dataset.isso;
} else if (js[i].src.match("require\\.js$")) { } else if (js[i].src.match("require\\.js$")) {
endpoint = js[i].dataset.main.replace(/\/js\/(embed|count)$/, ""); endpoint = js[i].dataset.main.replace(/\/js\/(embed|count)$/, "");
} }