parent
95ded1101a
commit
addc67549e
3 changed files with 9 additions and 9 deletions
|
@ -1056,7 +1056,7 @@ L.U.IframeExporter = L.Evented.extend({
|
||||||
}
|
}
|
||||||
var currentView = this.options.currentView ? window.location.hash : '',
|
var currentView = this.options.currentView ? window.location.hash : '',
|
||||||
iframeUrl = this.baseUrl + '?' + this.map.xhr.buildQueryString(this.queryString) + currentView,
|
iframeUrl = this.baseUrl + '?' + this.map.xhr.buildQueryString(this.queryString) + currentView,
|
||||||
code = '<iframe width="' + this.dimensions.width + '" height="' + this.dimensions.height + '" frameBorder="0" allowfullscreen src="' + iframeUrl + '"></iframe>';
|
code = '<iframe width="' + this.dimensions.width + '" height="' + this.dimensions.height + '" frameborder="0" allowfullscreen src="' + iframeUrl + '"></iframe>';
|
||||||
if (this.options.includeFullScreenLink) {
|
if (this.options.includeFullScreenLink) {
|
||||||
code += '<p><a href="' + this.baseUrl + '">' + L._('See full screen') + '</a></p>';
|
code += '<p><a href="' + this.baseUrl + '">' + L._('See full screen') + '</a></p>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,9 +81,9 @@ L.Util.toHTML = function (r) {
|
||||||
r = r.replace(/\[\[([^|]*?)\|(.*?)\]\]/g, '<a href="$1">$2</a>');
|
r = r.replace(/\[\[([^|]*?)\|(.*?)\]\]/g, '<a href="$1">$2</a>');
|
||||||
|
|
||||||
// iframe
|
// iframe
|
||||||
r = r.replace(/{{{(h_t_t_ps?[^ |]*)}}}/g, '<iframe frameBorder="0" src="$1" width="100%" height="300px"></iframe>');
|
r = r.replace(/{{{(h_t_t_ps?[^ |]*)}}}/g, '<iframe frameborder="0" src="$1" width="100%" height="300px"></iframe>');
|
||||||
r = r.replace(/{{{(h_t_t_ps?[^ |]*)\|(\d*)(px)?}}}/g, '<iframe frameBorder="0" src="$1" width="100%" height="$2px"></iframe>');
|
r = r.replace(/{{{(h_t_t_ps?[^ |]*)\|(\d*)(px)?}}}/g, '<iframe frameborder="0" src="$1" width="100%" height="$2px"></iframe>');
|
||||||
r = r.replace(/{{{(h_t_t_ps?[^ |]*)\|(\d*)(px)?\*(\d*)(px)?}}}/g, '<iframe frameBorder="0" src="$1" width="$4px" height="$2px"></iframe>');
|
r = r.replace(/{{{(h_t_t_ps?[^ |]*)\|(\d*)(px)?\*(\d*)(px)?}}}/g, '<iframe frameborder="0" src="$1" width="$4px" height="$2px"></iframe>');
|
||||||
|
|
||||||
// images
|
// images
|
||||||
r = r.replace(/{{([^\]|]*?)}}/g, '<img src="$1">');
|
r = r.replace(/{{([^\]|]*?)}}/g, '<img src="$1">');
|
||||||
|
|
|
@ -75,23 +75,23 @@ describe('L.Util', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle iframe', function () {
|
it('should handle iframe', function () {
|
||||||
assert.equal(L.Util.toHTML('A simple iframe: {{{http://osm.org/pouet.html}}}'), 'A simple iframe: <iframe frameBorder="0" src="http://osm.org/pouet.html" width="100%" height="300px"></iframe>');
|
assert.equal(L.Util.toHTML('A simple iframe: {{{http://osm.org/pouet.html}}}'), 'A simple iframe: <iframe frameborder="0" src="http://osm.org/pouet.html" width="100%" height="300px"></iframe>');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle iframe with height', function () {
|
it('should handle iframe with height', function () {
|
||||||
assert.equal(L.Util.toHTML('A simple iframe: {{{http://osm.org/pouet.html|200}}}'), 'A simple iframe: <iframe frameBorder="0" src="http://osm.org/pouet.html" width="100%" height="200px"></iframe>');
|
assert.equal(L.Util.toHTML('A simple iframe: {{{http://osm.org/pouet.html|200}}}'), 'A simple iframe: <iframe frameborder="0" src="http://osm.org/pouet.html" width="100%" height="200px"></iframe>');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle iframe with height and width', function () {
|
it('should handle iframe with height and width', function () {
|
||||||
assert.equal(L.Util.toHTML('A simple iframe: {{{http://osm.org/pouet.html|200*400}}}'), 'A simple iframe: <iframe frameBorder="0" src="http://osm.org/pouet.html" width="400px" height="200px"></iframe>');
|
assert.equal(L.Util.toHTML('A simple iframe: {{{http://osm.org/pouet.html|200*400}}}'), 'A simple iframe: <iframe frameborder="0" src="http://osm.org/pouet.html" width="400px" height="200px"></iframe>');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle iframe with height with px', function () {
|
it('should handle iframe with height with px', function () {
|
||||||
assert.equal(L.Util.toHTML('A simple iframe: {{{http://osm.org/pouet.html|200px}}}'), 'A simple iframe: <iframe frameBorder="0" src="http://osm.org/pouet.html" width="100%" height="200px"></iframe>');
|
assert.equal(L.Util.toHTML('A simple iframe: {{{http://osm.org/pouet.html|200px}}}'), 'A simple iframe: <iframe frameborder="0" src="http://osm.org/pouet.html" width="100%" height="200px"></iframe>');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle iframe with url parameter', function () {
|
it('should handle iframe with url parameter', function () {
|
||||||
assert.equal(L.Util.toHTML('A simple iframe: {{{https://osm.org/?url=https%3A//anotherurl.com}}}'), 'A simple iframe: <iframe frameBorder="0" src="https://osm.org/?url=https%3A//anotherurl.com" width="100%" height="300px"></iframe>');
|
assert.equal(L.Util.toHTML('A simple iframe: {{{https://osm.org/?url=https%3A//anotherurl.com}}}'), 'A simple iframe: <iframe frameborder="0" src="https://osm.org/?url=https%3A//anotherurl.com" width="100%" height="300px"></iframe>');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('http link with http link as parameter as variable', function () {
|
it('http link with http link as parameter as variable', function () {
|
||||||
|
|
Loading…
Reference in a new issue