Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: "Read More..."

  1. #1
    New Coder
    Join Date
    Mar 2007
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    "Read More..."

    There are a growing number of web sites that have a "feature" (if you want to call it that) where when you high-lite and copy some text, when you paste the text there is an additional few lines like "Read more at http://www.blawblawblaw.com/some/linky"

    Time.com is such a site. For example, copied from the front page:
    The woman who could be the next President of Haiti — and the first female to be elected to that office — doesn't strike you as an insurgent when she walks into a room.

    Read more: http://www.time.com/time/world/artic...#ixzz15QHfMbRg
    The part I high-lited and copied did not include the "Read more..."

    I assume this is done with JavaScript, but I couldn't find the code in the source (it's probably deep in some linked library). I'm thinking of maybe starting with one of those functions that disables copy/paste/context menu, and modding it.

    Any idea how this is done?

  • #2
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,133
    Thanks
    38
    Thanked 504 Times in 498 Posts
    Your example provided looks to me to be a simple HTML link with a 'Read more: ' prefix.

    What else do you want it to do?

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,147
    Thanks
    80
    Thanked 4,557 Times in 4,521 Posts
    No, jmrker, I've seen this before.

    They do it no matter *what* text on the page you highlight. When you click COPY (or equivalent), they indeed append a copyright message or a read more or a "copied from xxx.com" or whatever.

    It's not too hard. You just have to intercept the copy function. I think you can actually do it based on the selection property. I remember looking at the code that did it maybe 18 months or so ago.

    Oh, w.t.h.... Let me go look at the site he referenced...
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,147
    Thanks
    80
    Thanked 4,557 Times in 4,521 Posts
    Yeah, I thought so...it doesn't happen in Firefox. So they are indeed taking advantage of MSIE's selection process.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,451
    Thanks
    17
    Thanked 275 Times in 275 Posts
    Quote Originally Posted by Old Pedant View Post
    Yeah, I thought so...it doesn't happen in Firefox. So they are indeed taking advantage of MSIE's selection process.
    It does work in Firefox, on Linux even, I just had to try it. It seems you have to enable popups for it to work, so maybe it's meant to be a popup on select, or some such. When I pasted the select/copy into a document it hat the read more.

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,147
    Thanks
    80
    Thanked 4,557 Times in 4,521 Posts
    Yeah, got it to work in FF without enabling popups.

    I poked around with Firebug but there is so much utter crap on that page that it's hard to know what is doing what.

    Find another, simpler, page that does it and I think we could find the code.

    Pretty sure it will be tied to the onselect or more likely oncopy event. And then selection will find what is selected.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #7
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,147
    Thanks
    80
    Thanked 4,557 Times in 4,521 Posts
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #8
    New Coder
    Join Date
    Mar 2007
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Works on any browser. Checked it on IE/Chrome/FF on WinXP.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •