From 38a2174b1dd098290d4b853df853c1072369377d Mon Sep 17 00:00:00 2001 From: Andreas Gohr <gohr@cosmocode.de> Date: Mon, 22 Feb 2016 17:06:24 +0100 Subject: [PATCH] Revert "make reuse of mediamanager popup easier" this was an accidental commit to master This reverts commit f7f7fb6c2b301fc145bf78687261f89e446e89ae. --- lib/scripts/media.js | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/lib/scripts/media.js b/lib/scripts/media.js index c52226eaa..2995addfd 100644 --- a/lib/scripts/media.js +++ b/lib/scripts/media.js @@ -214,12 +214,14 @@ var dw_mediamanager = { * @author Pierre Spring <pierre.spring@caillou.ch> */ insert: function (id) { - var opts, cb, edid, s; + var opts, alignleft, alignright, edid, s; // set syntax options dw_mediamanager.$popup.dialog('close'); opts = ''; + alignleft = ''; + alignright = ''; if ({img: 1, swf: 1}[dw_mediamanager.ext] === 1) { @@ -252,14 +254,16 @@ var dw_mediamanager = { } } } + if (dw_mediamanager.align !== '1') { + alignleft = dw_mediamanager.align === '2' ? '' : ' '; + alignright = dw_mediamanager.align === '4' ? '' : ' '; + } } } edid = String.prototype.match.call(document.location, /&edid=([^&]+)/); - edid = edid ? edid[1] : 'wiki__text'; - cb = String.prototype.match.call(document.location, /&onselect=([^&]+)/); - cb = cb ? cb[1] : 'dw_mediamanager_item_select'; + opener.insertTags(edid ? edid[1] : 'wiki__text', + '{{'+alignleft+id+opts+alignright+'|','}}',''); - opener[cb](edid, id, opts, dw_mediamanager.align); if(!dw_mediamanager.keepopen) { window.close(); } @@ -267,8 +271,6 @@ var dw_mediamanager = { return false; }, - - /** * Prefills the wikiname. * @@ -919,25 +921,4 @@ var dw_mediamanager = { } }; -/** - * Default implementation for the media manager's select action - * - * Can be overriden with the onselect URL parameter. Is called on the opener context - * - * @param {string} edid - * @param {string} mediaid - * @param {string} opts - * @param {string} align [none, left, center, right] - */ -function dw_mediamanager_item_select(edid, mediaid, opts, align) { - var alignleft = ''; - var alignright = ''; - if (align !== '1') { - alignleft = align === '2' ? '' : ' '; - alignright = align === '4' ? '' : ' '; - } - - insertTags(edid, '{{' + alignleft + mediaid + opts + alignright + '|', '}}', ''); -} - jQuery(dw_mediamanager.init); -- GitLab