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 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Jul 2014
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Exclamation modify the URL of the current web page then load the new modified URL

    i want to create a script "bookmarklet" that loads the original images instead of the watermarked ones which are loaded by default from the website "fansshare.com"

    loading the original image from the site could be done by modifying the URL of the watermarked image, & the modifications would be as follows:

    watermarked image : http://img26.fansshare.com/cached/photos/kaka/brazil-kaka-brazil-1630765198.jpg

    original image : Fans Share | Celebrity Gossip, News, Pop, Music, Movies, TV/photos/kaka/brazil-kaka-brazil-1630765198.jpg

    so basically i want to replace "http://img26.fansshare.com/cached" with "http://us.cdn001.fansshare.com" & keep the rest of the URL unattached then go to the new URL.

    I found a script that could add text to the URL but i didn't know how to make it replace text in the URL rather than just add to it

    Script:

    javascript:void((function(){location.href=location.href.replace(/^http\:\/\/([^\/\@]+)\/(?/,%22http://%22+%22$1%22.replace(%22\:%22,%22.%22)+%22.us.cdn281.fansshare.com/%22);})())

    i would be very thankful if any one could help me modify the above script to make it work as i wanted to be

  • #2
    New to the CF scene
    Join Date
    Jul 2014
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

  • #3
    New to the CF scene
    Join Date
    Jul 2014
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    EDIT 2 :

    SCRIPT:

    javascript:void((function(){location.href=location.href.replace(/^http\:\/\/([^\/\@]+)\/(?/,%22http://%22+%22$1%22.replace(%22\:%22,%22.%22)+%22.us.cdn281.fansshare.com/%22);})())

    OR

    javascript:void((function(){location.href=location.href.replace(/^http\:\/\/([^\/\@]+)\/(?/,%22http://%22+%22$1%22.replace(%22\:%22,%22.%22)+%22.us.cdn281.fansshare.com/%22);})())

  • #4
    New to the CF scene
    Join Date
    Jul 2014
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    javascript:void((function(){location.href=location.href.replace(/^http\:\/\/([^\/\@]+)\/(?:)/,%22http://%22+%22$1%22.replace(%22\:%22,%22.%22)+%22.us.cdn281.fansshare.com/%22);})())

  • #5
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,989
    Thanks
    56
    Thanked 557 Times in 554 Posts
    couldn't you just do
    Code:
    location.href=location.href.replace("http://img26.fansshare.com/cached/","http://us.cdn001.fansshare.com/");

  • Users who have thanked xelawho for this post:

    opera211 (07-23-2014)

  • #6
    New to the CF scene
    Join Date
    Jul 2014
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Thumbs up Problem Solved

    Quote Originally Posted by xelawho View Post
    couldn't you just do
    Code:
    location.href=location.href.replace("http://img26.fansshare.com/cached/","http://us.cdn001.fansshare.com/");
    That was so easy , now its working as it should be
    i really appreciate ur help..many thanks to u

  • #7
    New Coder
    Join Date
    Aug 2014
    Posts
    27
    Thanks
    0
    Thanked 1 Time in 1 Post
    There are several easy methods to alter the Site URL manually. It is possible to set the site URL manually in the wp-config.php file.
    define('WP_HOME','http:// example. com');
    define('WP_SITEURL','http:// example. com');


  •  

    Tags for this Thread

    Posting Permissions

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