09-08-2015, 01:00 PM | #1 |
Enthusiast
Posts: 40
Karma: 10
Join Date: Jul 2015
Device: none
|
CSS trick for url popups solved
This works with epub and mobi/azw formats (in Calibre and Kindle - not other ereaders that can read those formats) and its only tested on the windows version of those programs, not on any standalone devices
With the following tweaks, can add a url address popup when hovering on wrapped links at the bottom left of the screen, the same way webpages have a status panel to show urls when hovering on links, and works in both single and double page mode: <a id="ebook" href="http://example.com">example</a> + #ebook { position:relative } #ebook:hover:after { content: " " attr(href) ""; display:block; position:fixed; bottom:0px; left:0px; color:#000; max-width:500pt; text-align:justify; word-wrap:break-word; background:#DBD7BD; border:1px solid #777; padding:0px 5px 2px 5px } = (btw see post #6 for an alternate approach) Another option is to use popups as notes, and also use the css equivalent or <br> which is just \a <a id="ebooknote">example note</a> + #ebooknote { position:relative } #eboonote:hover:after { white-space: pre-wrap; /* adding this is needed to use \a */ content: "And in the rows going across, from left to right, and in each row: the first row, the numbers are 4, 9 and 2, and in the second row, the numbers are 3, 5 and 7, and in the third row, the numbers are 8, 1 and 6. Whether you add them up diagonally, vertically or horizontally, no matter in which direction you go, it always adds up to the number 15.] \a \a The predominantly dark blue rectangle which occupies most of the middle tier of the mural, the upper side which passes through the exact middle of the small bisected sphere, represents the altar. The yellow rectangle set at an angle into the lower and middle tiers so that one corner touches the bottom of the mural is a second representation of the altar. They indicate [ladies and gentlemen] duality "; display:block; position:fixed; bottom:0px; left:0px; color:#000; max-width:300pt; /*example screenshot uses this width*/ text-align:justify; word-wrap:break-word; background:#DBD7BD; border:1px solid #777; padding:0px 5px 2px 5px } = and can also have multiple content rules like content: " blablabla \a "attr(href)" \a blablabla" ; OR content: " blablabla \a "url(image.jpg)" \a blablabla " ; OR content: " " attr(href) "\a " url(image.jpg) " "; OR content: " " attr(href) "\a " url(image.jpg) "\a " url(image2.jpg) " "; OR content: " " url(image.jpg) " blablabla \a " url(image2.jpg) " blablabla \a "attr(href) " "; Unfortunately cant have content fetch images like it fetches attr(href), so need unique rules. A few suggestions to that end: 1. specify urls twice with id="" AND alt="" to have the bulk handled by one and content by the other 2. give the unique content important tags, so other urls can keep using generic content 3. add the unique content to the htm/html to keep the stylesheet uncluttered SO in the htm/html would have <a id="ebook" alt="ebook1" href="http://www.example1.com">example1</a> <a id="ebook" alt="ebook2" href="http://www.example2.com">example2</a> <a id="ebook" href="http://www.example3.com">example3</a> <style> a[alt="ebook1"]:hover:after {content: "" url(image1.jpg) "\a " attr(href) " " !important} a[alt="ebook2"]:hover:after {content: "" url(image2.jpg) "\a " attr(href) " " !important} </style> + #ebook { position:relative } #ebook:hover:after { content: " " attr(href) " "; display:block; position:fixed; bottom:0px; left:0px; color:#000; word-wrap:break-word; background:#DBD7BD; border:1px solid #777 } For ebook1 & ebook2 links, will show the url in the bottom left, along with an image directly above it, while the third link will just show the url Last edited by ni_c; 09-28-2015 at 02:44 AM. Reason: even more improved code |
09-08-2015, 01:15 PM | #2 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
I think most ereader devices and apps aren't meant to use hovering. I challenge you to get that working on my E-Ink Kindle...
|
09-08-2015, 08:55 PM | #3 |
Enthusiast
Posts: 40
Karma: 10
Join Date: Jul 2015
Device: none
|
ok, i dont own any ereaders, so cant test how it works on anything but a windows version of calibre reader and the kindle equivalent. Does your e-ink kindle have a custom browser with connectivity to open links in, or is it one of those greyscale low power deals intended just for text? Guessing the latter so it wouldnt matter as much if raw links are viewable or not for you
Last edited by ni_c; 09-08-2015 at 11:01 PM. |
09-08-2015, 09:19 PM | #4 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
There is a builtin "experimental" browser. But the reader software is custom stuff written by Amazon.
Such is not uncommon amongst avid readers with their E-Ink devices. Just be aware that what you are trying to do won't work everywhere. |
09-14-2015, 12:53 AM | #5 |
Enthusiast
Posts: 40
Karma: 10
Join Date: Jul 2015
Device: none
|
bump
finished tinkering with the code, enjoy |
09-15-2015, 05:56 AM | #6 |
Enthusiast
Posts: 40
Karma: 10
Join Date: Jul 2015
Device: none
|
Um lol, just discovered the increadibly simple alternative to my method in the OP, not that mines useless, but the alternatives just FAR simpler and should be the default method when adding urls to non-pdf ebooks. Its simply using the title feature
so for a normal wrapped url like <a href="http://www.example.com">example</a> just add the same url as a title like <a href="http://www.example.com" title="http://www.example.com">example</a> Also for the purpose of cross compatibility, pdf links can act as notes too, same as the title feature, but using the href, and the only requirement is they start with a letter or letters (certain symbols like a dash - are ok too) and be capped before any blank spaces with a colon : eg the following will show the same note in both pdfs and other ebooks <a href="-: important instructions on blinking" title="important instructions on blinking">message popup</a> and the pdf requirement for it starting with a character + colon can be masked using the method "note: blablabla" Last edited by ni_c; 09-15-2015 at 06:26 AM. |
09-15-2015, 12:01 PM | #7 | |
Interested in the matter
Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
Quote:
|
|
09-16-2015, 02:01 AM | #8 |
Enthusiast
Posts: 40
Karma: 10
Join Date: Jul 2015
Device: none
|
Have you tried the OP example too? should only require css support for hover, so if ADE allows to change text color on hover, the statuspanel tooltip should work too
and fwiw the statuspanel tooltip/popup is cleaner than the title equivalent, particularly with long urls like <a href="http://www.example.com/a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_x_y_ z_a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_x_ y_z_a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_ x_y_z" title="http://www.example.com/a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_x_y_ z_a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_x_ y_z_a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_ x_y_z">example</a> vs <a href="http://www.example.com/a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_x_y_ z_a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_x_ y_z_a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_ x_y_z" id="ww">example</a> Last edited by ni_c; 09-16-2015 at 02:19 AM. |
09-27-2015, 12:37 AM | #9 |
Enthusiast
Posts: 40
Karma: 10
Join Date: Jul 2015
Device: none
|
fwiw, since jbacelar mentioned that have installed ADE, and goto say its one dodgy ereader, sure it can view both epub and pdfs, and its setup to purchase and borrow books thru it, but its highly stripped down on all other fronts
doesnt support before/after psuedo tags, OR title tags (so neither trick works) nor does it have its own popup system either. and barely supports wrapped urls anyway, developing MAJOR formatting issues if present, like disappearing whole chapters sortof thing, crazy behavior also doesnt support custom backgrounds, but DOES support the :hover tag so might do some other psuedos aswell, but I wont be testing ADE any further, will only use it for purchasing and borrowing, certainly not for custom content, or really as an ereader at all, sorry to say Last edited by ni_c; 09-27-2015 at 12:45 AM. |
09-27-2015, 05:57 AM | #10 |
Wizard
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
|
That is the reason, why a lot of ebook creators use ADE for a final test of EPUB 2.x files (eschwartz mentioned this point above). This engine is, what you will find in nearly 90% of reader implementations and everything what won't work for ADE won't work for most of EPUB-Readers too.
|
09-27-2015, 09:06 AM | #11 |
Enthusiast
Posts: 40
Karma: 10
Join Date: Jul 2015
Device: none
|
thanks Divingduck, good to know, will check any future ebooks ill be publishing for compatibility with it then
|
Tags |
css, popup, url |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Moon+ Reader on Kindle Fire - popups cut off | RobFreundlich | Android Devices | 0 | 10-03-2013 06:10 PM |
Suggestion: Stop popups from interrupting workflow | dandichka | Calibre | 5 | 06-26-2013 04:27 AM |
Print friendly url unrelated to regular url (and javascript) | sleepless | Recipes | 3 | 12-03-2011 10:43 AM |
Questions: Disable yellow popups, Ratings display | Cheyenne | Calibre | 5 | 07-01-2011 02:50 AM |
css pseudo elements and adjacent combinators in extra css? | ldolse | Calibre | 2 | 12-21-2010 05:09 PM |