/* eslint-disable no-var */
/* globals svgEditor, svgedit, svgCanvas, canvg, $, top */
/*
* ext-server_moinsave.js
*
* Licensed under the MIT License
*
* Copyright(c) 2010 Alexis Deveria
* 2011 MoinMoin:ReimarBauer
* adopted for moinmoins item storage. it sends in one post png and svg data
* (I agree to dual license my work to additional GPLv2 or later)
*
*/
svgEditor.addExtension('server_opensave', {
callback: function () {
'use strict';
var Utils = svgedit.utilities;
var saveSvgAction = '/+modify';
// Create upload target (hidden iframe)
/* var target = */ $('').hide().appendTo('body');
svgEditor.setCustomHandlers({
save: function (win, data) {
var svg = '\n' + data;
var qstr = $.param.querystring();
var name = qstr.substr(9).split('/+get/')[1];
var svgData = Utils.encode64(svg);
if (!$('#export_canvas').length) {
$('