Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove more Internet Explorer code #2427

Merged
merged 10 commits into from
Jan 14, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@
if (response.attribute && $(response.attribute)) {
$(response.attribute).setHasError(true, productForm);
Validation.ajaxError($(response.attribute), response.message);
if (!Prototype.Browser.IE){
$(response.attribute).focus();
}
$(response.attribute).focus();
}
else if ($('messages')) {
$('messages').innerHTML = '<ul class="messages"><li class="error-msg"><ul><li>' + response.message + '</li></ul></li></ul>';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ attributesForm._processValidationResult = function(transport) {
if (response.attribute && $(response.attribute)) {
$(response.attribute).setHasError(true, attributesForm);
Validation.ajaxError($(response.attribute), response.message);
if (!Prototype.Browser.IE){
$(response.attribute).focus();
}
$(response.attribute).focus();
} else if ($('messages')) {
$('messages').innerHTML = '<ul class="messages"><li class="error-msg"><ul><li>' + response.message + '</li></ul></li></ul>';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@
function openMessagePopup() {
var height = $('html-body').getHeight();
$('message-popup-window-mask').setStyle({'height':height+'px'});
toggleSelectsUnderBlock($('message-popup-window-mask'), false);
Element.show('message-popup-window-mask');
$('message-popup-window').addClassName('show');
}

function closeMessagePopup() {
toggleSelectsUnderBlock($('message-popup-window-mask'), true);
Element.hide('message-popup-window-mask');
$('message-popup-window').removeClassName('show');
messagePopupClosed = true;
Expand Down
2 changes: 0 additions & 2 deletions js/mage/adminhtml/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ MediabrowserUtility = {
window = this.dialogWindow;
}
if (window) {
// IE fix - hidden form select fields after closing dialog
WindowUtilities._showSelect();
window.close();
}
}
Expand Down
20 changes: 0 additions & 20 deletions js/mage/adminhtml/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,26 +386,6 @@ RegionUpdater.prototype = {

regionUpdater = RegionUpdater;

/**
* Fix errorrs in IE
*/
Event.pointerX = function(event){
try{
return event.pageX || (event.clientX +(document.documentElement.scrollLeft || document.body.scrollLeft));
}
catch(e){

}
};
Event.pointerY = function(event){
try{
return event.pageY || (event.clientY +(document.documentElement.scrollTop || document.body.scrollTop));
}
catch(e){

}
};

SelectUpdater = Class.create();
SelectUpdater.prototype = {
initialize: function (firstSelect, secondSelect, selectFirstMessage, noValuesMessage, values, selected)
Expand Down
2 changes: 0 additions & 2 deletions js/mage/adminhtml/giftmessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ GiftOptionsPopup.prototype = {
var element = Event.element(event).id;
var itemId = element.sub('gift_options_link_','');

toggleSelectsUnderBlock(this.giftOptionsWindowMask, false);
this.giftOptionsWindowMask = $('gift_options_window_mask');
this.giftOptionsWindow = $('gift_options_configure');
this.giftOptionsWindow.select('select').each(function(el){
Expand Down Expand Up @@ -207,7 +206,6 @@ GiftOptionsPopup.prototype = {
},

closeWindow : function() {
toggleSelectsUnderBlock(this.giftOptionsWindowMask, true);
this.giftOptionsWindowMask.style.display = 'none';
this.giftOptionsWindow.style.display = 'none';
}
Expand Down
21 changes: 2 additions & 19 deletions js/mage/adminhtml/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,27 +180,10 @@ varienGrid.prototype = {
setLocation(response.ajaxRedirect);
}
} else {
/**
* For IE <= 7.
* If there are two elements, and first has name, that equals id of second.
* In this case, IE will choose one that is above
*
* @see https://prototype.lighthouseapp.com/projects/8886/tickets/994-id-selector-finds-elements-by-name-attribute-in-ie7
*/
var divId = $(this.containerId);
if (divId.id == this.containerId) {
divId.update(responseText);
} else {
$$('div[id="'+this.containerId+'"]')[0].update(responseText);
}
$(this.containerId).update(responseText);
}
} catch (e) {
var divId = $(this.containerId);
if (divId.id == this.containerId) {
divId.update(responseText);
} else {
$$('div[id="'+this.containerId+'"]')[0].update(responseText);
}
$(this.containerId).update(responseText);
}
}.bind(this)
});
Expand Down
53 changes: 4 additions & 49 deletions js/mage/adminhtml/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,72 +207,27 @@ function showLoader(loaderArea) {
return;
}
Element.clonePosition(loadingMask, loaderArea, {offsetLeft:-2});
toggleSelectsUnderBlock(loadingMask, false);
Element.show(loadingMask);
Element.childElements(loadingMask).invoke('hide');
setLoaderPosition();
loaderTimeout = setTimeout(function() {
Element.childElements(loadingMask).invoke('show');
}, typeof window.LOADING_TIMEOUT === 'undefined' ? 200 : window.LOADING_TIMEOUT);
}

function hideLoader() {
toggleSelectsUnderBlock($('loading-mask'), true);
Element.hide('loading-mask');
if(loaderTimeout) {
clearTimeout(loaderTimeout);
loaderTimeout = null;
}
}

/**
* @todo need calculate middle of visible area and scroll bind
*/
function setLoaderPosition(){
var elem = $('loading_mask_loader');
if (elem && Prototype.Browser.IE) {
var elementDims = elem.getDimensions();
var viewPort = document.viewport.getDimensions();
var offsets = document.viewport.getScrollOffsets();
elem.style.left = Math.floor(viewPort.width / 2 + offsets.left - elementDims.width / 2) + 'px';
elem.style.top = Math.floor(viewPort.height / 2 + offsets.top - elementDims.height / 2) + 'px';
elem.style.position = 'absolute';
}
// Deprecated since 20.0.17
elidrissidev marked this conversation as resolved.
Show resolved Hide resolved
function setLoaderPosition() {
}

/*function getRealHeight() {
var body = document.body;
if (window.innerHeight && window.scrollMaxY) {
return window.innerHeight + window.scrollMaxY;
}
return Math.max(body.scrollHeight, body.offsetHeight);
}*/



function toggleSelectsUnderBlock(block, flag){
if(Prototype.Browser.IE){
var selects = document.getElementsByTagName("select");
for(var i=0; i<selects.length; i++){
/**
* @todo: need check intersection
*/
if(flag){
if(selects[i].needShowOnSuccess){
selects[i].needShowOnSuccess = false;
// Element.show(selects[i])
selects[i].style.visibility = '';
}
}
else{
if(Element.visible(selects[i])){
// Element.hide(selects[i]);
selects[i].style.visibility = 'hidden';
selects[i].needShowOnSuccess = true;
}
}
}
}
// Deprecated since 20.0.17
function toggleSelectsUnderBlock(block, flag) {
}

Ajax.Responders.register(varienLoaderHandler.handler);
Expand Down
23 changes: 0 additions & 23 deletions js/mage/adminhtml/product/composite/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,40 +409,17 @@ ProductConfigure.prototype = {
* Show configuration window
*/
_showWindow: function() {
this._toggleSelectsExceptBlock(false);
this.blockMask.setStyle({'height':this.windowHeight+'px'}).show();
this.blockWindow.setStyle({'marginTop':-this.blockWindow.getHeight()/2 + "px", 'display':'block'});
if (Object.isFunction(this.showWindowCallback[this.current.listType])) {
this.showWindowCallback[this.current.listType]();
}
},

/**
* toggles Selects states (for IE) except those to be shown in popup
*/
_toggleSelectsExceptBlock: function(flag) {
if(Prototype.Browser.IE){
if (this.blockForm) {
var states = new Array;
var selects = this.blockForm.getElementsByTagName("select");
for(var i=0; i<selects.length; i++){
states[i] = selects[i].style.visibility;
}
}
toggleSelectsUnderBlock(this.blockMask, flag);
if (this.blockForm) {
for(i=0; i<selects.length; i++){
selects[i].style.visibility = states[i];
}
}
}
},

/**
* Close configuration window
*/
_closeWindow: function() {
toggleSelectsUnderBlock(this.blockMask, true);
this.blockMask.style.display = 'none';
this.blockWindow.style.display = 'none';
this.clean('window');
Expand Down
14 changes: 1 addition & 13 deletions js/mage/adminhtml/sales.js
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ AdminOrder.prototype = {
if ('message' != id || response[id]) {
var wrapper = new Element('div');
wrapper.update(response[id] ? response[id] : '');
$(this.getAreaId(id)).update(Prototype.Browser.IE ? wrapper.outerHTML : wrapper);
$(this.getAreaId(id)).update(wrapper);
}
if ($(this.getAreaId(id)).callback) {
this[$(this.getAreaId(id)).callback]();
Expand Down Expand Up @@ -1137,18 +1137,6 @@ AdminOrder.prototype = {
parentEl.addClassName('ignore-validate');
}

if (Prototype.Browser.IE) {
parentEl.select('select').each(function (elem) {
if (show) {
elem.needShowOnSuccess = false;
elem.style.visibility = '';
} else {
elem.style.visibility = 'hidden';
elem.needShowOnSuccess = true;
}
});
}

parentEl.setStyle({position: 'relative'});
el.setStyle({
display: show ? 'none' : '',
Expand Down
15 changes: 1 addition & 14 deletions js/mage/adminhtml/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ var toolbarToggle = {
headerOffset: null, // Normal toolbar offset - calculated once
headerCopy: null, // Floating toolbar
eventsAdded: false, // We're listening to scroll/resize
compatible: !navigator.appVersion.match('MSIE 6.'), // Whether object is compatible with browser (do not support old browsers, legacy code)

// Inits object and pushes it into work. Can be used to init/reset(update) object by current DOM.
reset: function () {
Expand All @@ -271,10 +270,6 @@ var toolbarToggle = {

// Creates toolbar and inits all needed properties
createToolbar: function () {
if (!this.compatible) {
return;
}

// Extract header that we will use as toolbar
var headers = $$('.content-header');
for (var i = headers.length - 1; i >= 0; i--) {
Expand Down Expand Up @@ -318,7 +313,7 @@ var toolbarToggle = {
// Checks whether object properties are ready and valid
ready: function () {
// Return definitely boolean value
return (this.compatible && this.header && this.headerCopy && this.headerCopy.parentNode) ? true : false;
return (this.header && this.headerCopy && this.headerCopy.parentNode) ? true : false;
},

// Updates toolbars for current scroll - shows/hides normal and floating toolbar
Expand Down Expand Up @@ -409,10 +404,6 @@ var toolbarToggle = {

// Starts object on window load
startOnLoad: function () {
if (!this.compatible) {
return;
}

if (!this.funcOnWindowLoad) {
this.funcOnWindowLoad = this.start.bind(this);
}
Expand All @@ -429,10 +420,6 @@ var toolbarToggle = {

// Starts object by creating toolbar and enabling scroll/resize events
start: function () {
if (!this.compatible) {
return;
}

this.reset();
this.startListening();
},
Expand Down
8 changes: 0 additions & 8 deletions js/mage/adminhtml/wysiwyg/tiny_mce/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,14 +478,6 @@ tinyMceWysiwygSetup.prototype =
this.getPluginButtons().each(function(e) {
e.show();
});
if (Prototype.Browser.IE) {
// workaround for IE textarea redraw bug
window.setTimeout(function() {
if ($(this.id)) {
$(this.id).value = $(this.id).value;
}
}.bind(this), 0);
}
},

closePopups: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,3 @@ del {color:red; text-decoration:line-through}
cite {border-bottom:1px dashed blue}
acronym {border-bottom:1px dotted #CCC; cursor:help}
abbr, html\:abbr {border-bottom:1px dashed #CCC; cursor:help}

/* IE */
* html body {
scrollbar-3dlight-color:#F0F0EE;
scrollbar-arrow-color:#676662;
scrollbar-base-color:#F0F0EE;
scrollbar-darkshadow-color:#DDD;
scrollbar-face-color:#E0E0DD;
scrollbar-highlight-color:#F0F0EE;
scrollbar-shadow-color:#F0F0EE;
scrollbar-track-color:#F5F5F5;
}
2 changes: 0 additions & 2 deletions js/mage/adminhtml/wysiwyg/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ var widgetTools = {
window = this.dialogWindow;
}
if (window) {
// IE fix - hidden form select fields after closing dialog
WindowUtilities._showSelect();
window.close();
}
}
Expand Down
16 changes: 4 additions & 12 deletions js/mage/directpost.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,18 +365,10 @@ directPost.prototype = {

createHiddenElement : function(name, value) {
var field;
if (isIE) {
field = document.createElement('input');
field.setAttribute('type', 'hidden');
field.setAttribute('name', name);
field.setAttribute('value', value);
} else {
field = document.createElement('input');
field.type = 'hidden';
field.name = name;
field.value = value;
}

field = document.createElement('input');
field.type = 'hidden';
field.name = name;
field.value = value;
return field;
},

Expand Down
14 changes: 0 additions & 14 deletions js/mage/translate_inline.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,6 @@ TranslateInline.prototype = {

this.trigTimer = null;
this.trigContentEl = null;
if (Prototype.Browser.IE) {
$$('*[data-translate]').each(this.initializeElement.bind(this));
var scope = this;
Ajax.Responders.register({ onComplete: function() {
window.setTimeout(scope.reinitElements.bind(scope), 50);
}
});
var ElementNode = (typeof HTMLElement != 'undefined' ? HTMLElement : Element);
var ElementUpdate = ElementNode.prototype.update;
ElementNode.prototype.update = function() {
ElementUpdate.apply(this, arguments);
$(this).select('*[data-translate]').each(scope.initializeElement.bind(scope));
};
}
this.trigEl = $(trigEl);
this.trigEl.observe('click', this.formShow.bind(this));

Expand Down
Loading