Skip to content

Conversation

@wilding
Copy link

@wilding wilding commented Mar 31, 2016

Hi ellenbrook, I really enjoy using your extension Wikihover, but I often found myself wishing that there was a picture along with the text. I added a bit of code to the inject.js file to achieve this. It only shows pictures that are taller than 100px (to avoid displaying the little icons that accompany alert messages), and if there are no pictures that match the criteria the output will be identical to how it was before I added the changes. This is my first attempt at contributing to an open-source project so forgive me if I'm going about this the wrong way, but I wanted to share the changes with you in case it was something you were interested in implementing.

Thanks!
Wilding

- add variable ‘picture’ that represents the value of the src attribute of the first child of #infobox that has an <img> tag
- add variable ‘new_html’ to contain popup window html
- wrap popup window html into a flex-box <div>
- separate content into two divs: one for text and one for the picture
- remove padding from cssRules
- add padding for text <div> only
- use ‘picture’ variable as source for the background image of the picture <div>
- remove wrap property from popup div
- remove width property from content
- change from background image to <img>
- give img auto width, max height equal to the max height of the popup window, and a right margin of 10px
- select pictures from full article content rather than just the info box
- update var picture to refer to the element itself rather than its src attribute
- filter out pictures that are less than 100px in height
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant