/*globals svgEditor, svgCanvas, canvg, $*/ /* * ext-server_opensave.js * * Licensed under the MIT License * * Copyright(c) 2010 Alexis Deveria * */ svgEditor.addExtension("server_opensave", { callback: function() { 'use strict'; function getFileNameFromTitle () { var title = svgCanvas.getDocumentTitle(); return $.trim(title).replace(/[^a-z0-9\.\_\-]+/gi, '_'); } function clientDownloadSupport (filename, suffix, uri) { var a, support = $('')[0].download === ''; if (support) { a = $('hidden').attr({download: (filename || 'image') + suffix, href: uri}).css('display', 'none').appendTo('body'); a[0].click(); return true; } } var open_svg_action, import_svg_action, import_img_action, open_svg_form, import_svg_form, import_img_form, save_svg_action = 'extensions/filesave.php', save_img_action = 'extensions/filesave.php', // Create upload target (hidden iframe) cancelled = false; $('