Piperita / ID_modding

Add-ons for DarknessKight's PonyDebate-script. 'LinkPreview' adds buttons to links that open/close previews for their content. The "Filter"-folder contains a script circumventing ID's filter to automatically catch and replace banned words. "Padding" is a simple script taking care of unreadable posts due to too many replies. The folder "CountReplies" is a stand-alone function for bluefury to store replies with author and text in a csv-file
0 stars 0 forks source link

CSS for frames does not get set on EQD mobile #1

Open Piperita opened 9 years ago

Piperita commented 9 years ago

Problem

On the mobile site all previews get not adjusted properly when the script does not get started by pasting its entirety into the console, i.e. it gets loaded by loading it externally through

document.head.appendChild(document.createElement("script")

or the related bookmark-injection.

Affected code

  frameWidth =$('.popClass'); frameClass=frameWidth;
  frameWidth =frameWidth[0].parentElement.clientWidth;
  frameHeight=parseInt(frameWidth*0.5625)+'px';
  frameWidth =parseInt(frameWidth)+'px';
  frameClass.css('width', frameWidth).css('height', frameHeight);

Origin

According to alerts giving out the respective values,

frameWidth =frameWidth[0].parentElement.clientWidth;

gives out different values depending on how the script is loaded. If pasted into the console as a whole, it gives out the expected values, if loaded externally, it gives out a wrong value.

value expected returned
frameWidth: 438px 223px
frameHeight: 780px 398