Advertisement
hdiwan

hd1/links.js

Jun 6th, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function hd1_done(data) {
  2.         alert('URL success!');
  3.         if (data.indexOf('youtu.be') > -1) {
  4.                 alert('youtube link!');
  5.                 video_uuid = data.substring(17);
  6.                 text = '<iframe src="https://www.youtube.com/embed/'+video_uuid+'" frameborder height="315" width="560"></iframe>'; else
  7.         } else if (data.indexOf('png') > -1 || data.indexOf('jpg') > -1) {
  8.                 alert('image url!');
  9.                 text = '<img src="'+data+'" height="420" width="240"/>';
  10.         } else { // other sites to resolve go here
  11.                 alert('Normal link!');
  12.                 text = data;
  13.         }
  14.         $(this).html(text);
  15. }
  16.  
  17. function hd1_mouseOver(evt) {
  18.     alert('in mouseover');
  19.     var thePage = $(this).text();
  20.     alert('got url '+thePage);
  21.     $.ajax({
  22.         url: '/title',
  23.         data: {
  24.             "page": thePage
  25.         },
  26.         dataType: 'text',
  27.                 success: hd1_done,
  28.                 context: this});
  29. }
  30.  
  31. function hd1_load(jQuery) {
  32.     alert('document is ready!');
  33.     $('.link a').on("mouseover", hd1_mouseOver);
  34. }
  35.  
  36. $(document).ready(hd1_load);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement