Skip to content

Commit

Permalink
- Added version tags to ajax requests in web variant.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauvilsa committed Feb 22, 2021
1 parent 0c02d79 commit 70d1780
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

nw-page-editor - Simple app for visual editing of Page XML files.

Version: 2021.02.17
Version: 2021.02.22


# Description
Expand Down
8 changes: 4 additions & 4 deletions js/page-canvas.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Javascript library for viewing and interactive editing of Page XMLs.
*
* @version $Version: 2021.02.17$
* @version $Version: 2021.02.22$
* @author Mauricio Villegas <[email protected]>
* @copyright Copyright(c) 2015-present, Mauricio Villegas <[email protected]>
* @license MIT License
Expand All @@ -23,7 +23,7 @@
'use strict';

var
version = '$Version: 2021.02.17$'.replace(/^\$Version. (.*)\$/,'$1');
version = '$Version: 2021.02.22$'.replace(/^\$Version. (.*)\$/,'$1');

/// Set PageCanvas global object ///
if ( ! global.PageCanvas )
Expand Down Expand Up @@ -421,7 +421,7 @@

for ( n=0; n<xslt_import.length; n++ ) // jshint -W083
(function(idx) {
$.ajax({ url: importSvgXsltHref[idx], async: async, dataType: 'xml' })
$.ajax({ url: self.util.addAjaxVersionTimestamp(importSvgXsltHref[idx]), async: async, dataType: 'xml' })
.fail( function () { self.throwError( 'Failed to retrieve '+importSvgXsltHref[idx] ); } )
.done( function ( data ) {
xslt_import[idx] = new XSLTProcessor();
Expand All @@ -447,7 +447,7 @@

for ( n=0; n<xslt_export.length; n++ ) // jshint -W083
(function(idx) {
$.ajax({ url: exportSvgXsltHref[idx], async: async, dataType: 'xml' })
$.ajax({ url: self.util.addAjaxVersionTimestamp(exportSvgXsltHref[idx]), async: async, dataType: 'xml' })
.fail( function () { self.throwError( 'Failed to retrieve '+exportSvgXsltHref[idx] ); } )
.done( function ( data ) {
xslt_export[idx] = new XSLTProcessor();
Expand Down
14 changes: 11 additions & 3 deletions js/svg-canvas.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Javascript library for viewing and interactive editing of SVGs.
*
* @version $Version: 2020.10.02$
* @version $Version: 2021.02.22$
* @author Mauricio Villegas <[email protected]>
* @copyright Copyright(c) 2015-present, Mauricio Villegas <[email protected]>
* @license MIT License
Expand All @@ -23,7 +23,7 @@
var
sns = 'http://www.w3.org/2000/svg',
xns = 'http://www.w3.org/1999/xlink',
version = '$Version: 2020.10.02$'.replace(/^\$Version. (.*)\$/,'$1');
version = '$Version: 2021.02.22$'.replace(/^\$Version. (.*)\$/,'$1');

/// Set SvgCanvas global object ///
if ( ! global.SvgCanvas )
Expand Down Expand Up @@ -77,6 +77,7 @@
self.cfg.textFormatter = svgTextFormatter;
self.cfg.textValidator = function () { return false; };
self.cfg.multilineText = true;
self.cfg.ajaxVersionStamp = null;
self.cfg.onSetConfig = [];
self.cfg.onPanZoomChange = [];
self.cfg.onMouseMove = [];
Expand Down Expand Up @@ -823,6 +824,13 @@
/// Import and export SVGs ///
//////////////////////////////

function addAjaxVersionTimestamp( url ) {
if ( self.cfg.ajaxVersionStamp )
url += '?v='+self.cfg.ajaxVersionStamp;
return url;
}
self.util.addAjaxVersionTimestamp = addAjaxVersionTimestamp;

/**
* Returns a clone of the SVG without all of the editor data.
*/
Expand Down Expand Up @@ -914,7 +922,7 @@
if ( typeof dragpointSvg === 'undefined' &&
self.cfg.dragpointHref &&
self.cfg.dragpointHref[0] !== '#' ) {
$.ajax({ url: self.cfg.dragpointHref, dataType: 'xml' })
$.ajax({ url: addAjaxVersionTimestamp(self.cfg.dragpointHref), dataType: 'xml' })
.fail( function () { self.throwError( 'Failed to retrive '+self.cfg.dragpointHref ); } )
.done( function ( data ) { initDragpoint(data); } );
return;
Expand Down
4 changes: 3 additions & 1 deletion js/web-app.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
/**
* App functionality for the web edition of nw-page-editor.
*
* @version $Version: 2020.11.16$
* @version $Version: 2021.02.22$
* @author Mauricio Villegas <[email protected]>
* @copyright Copyright(c) 2015-present, Mauricio Villegas <[email protected]>
* @license MIT License
*/

$(window).on('load', function () {

pageCanvas.cfg.ajaxVersionStamp = page_editor_version.replace(/^[^\d]*/, '');

/// Additional pageCanvas configuration ///
pageCanvas.setConfig(
{ importSvgXsltHref: [ '../xslt/page2svg.xslt', '../xslt/page_from_2010-03-19.xslt', '../xslt/page2page.xslt', '../xslt/alto_v2_to_page.xslt', '../xslt/alto_v3_to_page.xslt' ],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nw-page-editor",
"version": "2021.02.17",
"version": "2021.02.22",
"description": "Simple app for visual editing of Page XML files",
"main": "./html/index.html#1",
"author": "Mauricio Villegas <[email protected]>",
Expand Down
4 changes: 2 additions & 2 deletions web-app/common.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
/**
* Common code to be executed by other php scripts.
*
* @version $Version: 2021.02.17$
* @version $Version: 2021.02.22$
* @author Mauricio Villegas <[email protected]>
* @copyright Copyright(c) 2017-present, Mauricio Villegas <[email protected]>
* @license MIT License
*/

$version = str_replace('Version: ','',"Version: 2021.02.17");
$version = str_replace('Version: ','',"Version: 2021.02.22");
$v = '?v='.$version;

/// User authentication ///
Expand Down

0 comments on commit 70d1780

Please sign in to comment.