From f00068c02c6478561de55d1e9e52f0113a2fa808 Mon Sep 17 00:00:00 2001 From: Jeff Schiller Date: Tue, 12 Jan 2010 08:07:50 +0000 Subject: [PATCH] Merge arbelos fixes for opera widget for svgicons and locale to trunk git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1195 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/locale/locale.js | 16 ++++++++++++++-- editor/svgicons/jquery.svgicons.js | 22 ++++++++++++++++++---- opera-widget/handlers.js | 2 +- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/editor/locale/locale.js b/editor/locale/locale.js index 3b906ce2..b2d0e81e 100644 --- a/editor/locale/locale.js +++ b/editor/locale/locale.js @@ -34,7 +34,8 @@ var put_locale = function(svgCanvas, given_param){ } var url = "locale/lang." + lang_param + ".js"; - $.get(url, function(data){ + + var processFile = function(data){ var LangData = eval(data), js_strings; $.each(LangData, function(i, data) { if(data.id) { @@ -56,5 +57,16 @@ var put_locale = function(svgCanvas, given_param){ } }); svgCanvas.setLang(lang_param, js_strings); - },"json"); + } + + $.ajax({ + 'url': url, + 'dataType': "text", + success: processFile, + error: function(xhr) { + if(xhr.responseText) { + processFile(xhr.responseText); + } + } + }); }; diff --git a/editor/svgicons/jquery.svgicons.js b/editor/svgicons/jquery.svgicons.js index 536eba87..282afeeb 100644 --- a/editor/svgicons/jquery.svgicons.js +++ b/editor/svgicons/jquery.svgicons.js @@ -160,10 +160,20 @@ $(function() { getIcons('ajax'); }); }, - error: function() { - $(function() { - useFallback(); - }); + error: function(err) { + // TODO: Fix Opera widget icon bug + if(window.opera) { + $(function() { + useFallback(); + }); + } else { + if(err.responseXML) { + svgdoc = err.responseXML; + $(function() { + getIcons('ajax'); + }); + } + } } }); } @@ -423,6 +433,10 @@ $(function() { $(sel).each(function() { this.setAttribute('width', w); this.setAttribute('height', h); + if(window.opera && window.widget) { + this.parentNode.style.width = w + 'px'; + this.parentNode.style.height = h + 'px'; + } }); }); } diff --git a/opera-widget/handlers.js b/opera-widget/handlers.js index c493da25..bb1d1385 100644 --- a/opera-widget/handlers.js +++ b/opera-widget/handlers.js @@ -33,7 +33,7 @@ $(function() { } }, - 'save':function(svg) { + 'save':function(window, svg) { try { window.opera.io.filesystem.browseForSave( new Date().getTime(), /* mountpoint name */