Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _mceImage : function(ui, val) {
- var ed = this.editor;
- var t = this;
- // Internal image object like a flash placeholder
- if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1)
- return;
- XenForo.ajax('index.php?editor/dialog', { dialog: 'fast_image'}, t._xenforo_ajax_success);
- },
- _xenforo_ajax_success: function(ajaxData)
- {
- if (XenForo.hasResponseError(ajaxData) || typeof(ajaxData.templateHtml) == 'undefined')
- {
- return;
- }
- if (ajaxData.templateHtml)
- {
- new XenForo.ExtLoader(ajaxData, function()
- {
- var overlay, overtop, isTouch = XenForo.isTouchBrowser();
- if(isTouch) { overtop = '10%'; } else { overtop = 'center'; }
- $triger = $(ajaxData.templateHtml).find('.miuTriger');
- $focus = $(ajaxData.templateHtml).find('.mceFocus');
- $inputs = $(ajaxData.templateHtml).find('input');
- overlay = $(ajaxData.templateHtml)
- .xfInsert('prependTo', 'body', 'xfFadeIn')
- .overlay({
- mask: {
- color: '#000000',
- zIndex: 10010,
- loadSpeed: 200,
- opacity: 0.6
- },
- onBeforeLoad: function(e) {
- $('.xenOverlay').css('opacity', '0.5');
- },
- onLoad: function(e) {
- this.getOverlay().insertAfter('#exposeMask').addClass('isLoaded');//@http://stackoverflow.com/questions/1939494/
- $inputs
- .bind('keypress', function(e){
- //Map "return" Key to the .miuTriger button
- if ( e.which == 13 )
- {
- e.preventDefault();
- $triger.trigger('click');
- }
- });
- $triger.one('click', function (e){
- e.stopImmediatePropagation();
- var inputs = {};
- $inputs.each(function(index) {
- inputs[$(this).attr('name')] = $(this).val();
- });
- overlay.close();
- //XenForo.miuExtra.miu.textarea.focus();
- //XenForo.miuExtra[redirection](inputs, XenForo.miuExtra.miu);
- return false;
- });
- $focus.focus();
- },
- onClose: function(e) {
- $('.xenOverlay').css('opacity', '1').expose();
- $inputs.val('');
- },
- top: overtop,
- left:0, //will be centered by css... better to avoid bugs
- fixed:!isTouch,
- closeOnClick: false,
- oneInstance: false,
- load: true,
- api:true
- }).load();
- return false;
- });
- }
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement