SHARE
TWEET

Sample 2 - Get Original URL

a guest May 14th, 2012 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript:
  2.  
  3. function myRadFunction2() {
  4.         $.get("http://getpocket.com/unread", function(data){
  5.         /*alert("Data Loaded: " + data);*/
  6.         getOriginalURL(data);
  7.         });
  8. }
  9.  
  10. function getOriginalURL(data) {
  11.         for (var i = 0; i<$('.favicon').length; i++) {
  12.                 var index = data.indexOf('<a class="item"');
  13.                 var data1 = data.substring(index+22);
  14.                 var indexURLEnd = data1.indexOf('"');
  15.                 var url = data1.substring(0,indexURLEnd);
  16.                 var indexTitleStart = data1.indexOf('>');
  17.                 var indexTitleEnd = data1.indexOf('<');
  18.                 var title = data1.substring(indexTitleStart+1,indexTitleEnd);
  19.                 window.alert(url);
  20.                 window.alert(title);
  21.         }
  22. }
  23.  
  24. if (!($ = window.jQuery)) {
  25.         script = document.createElement( 'script' );  
  26.         script.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';  
  27.     script.onload=myRadFunction2;  
  28.     document.body.appendChild(script);  
  29. }  
  30. else {  
  31.     myRadFunction2();  
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top