document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. <script src=\'http://code.jquery.com/jquery-latest.js\' type=\'text/javascript\'></script>
  2. <script type=\'text/javascript\'>
  3. //<![CDATA[
  4. // تضمين فيديوهات اليوتيوب داخل تعليقات بلوجر وداخل الموضوعات by MS-potilas 2012.
  5. // See http://abu-iyad.com
  6. //
  7. // if oetag=0, just use video urls like:
  8. //           https://www.youtube.com/watch?v=FI_l43NxgcU
  9. //           surrounded by white space (video tag can be used, too)
  10. // if oetag=1 (for nerdy blogs?), use syntax:
  11. //           [video=https://www.youtube.com/watch?v=FI_l43NxgcU]
  12. // config:
  13. var oetag = 0;           // see above
  14. var oetagname = "video"; // [video=zzz], maybe you like "embed" or "youtube" more?
  15. var oelazy = -1; // -1 detect, 0 = normal, 1 = lazy (needs lazy load hack)
  16. //
  17. function oe_loadscript(filename) {
  18.   var scr=document.createElement(\'script\');
  19.   scr.setAttribute("type","text/javascript");
  20.   scr.setAttribute("src",filename);
  21.   document.getElementsByTagName("head")[0].appendChild(scr);
  22. }
  23. function oe_jumptohash() { // reposition to anchor
  24.   window.scrollTo(0, $("#"+window.location.hash.replace(/^#/, "")).offset().top);
  25. }
  26. var oe_tid;
  27. var oe_elems = {};
  28. //
  29. function oembed_callback(response) {
  30.   var resp = response;
  31.   revurl = resp.url.split("").reverse().join("");
  32.   html = oe_elems[response.callID].html();
  33.   ee = $(resp.html);
  34.   w = parseInt(ee.attr("width"));
  35.   h = parseInt(ee.attr("height"));
  36.   if(oelazy==1) { // convert to lazy load
  37.     src = ee.attr("src");
  38.     src += ((src.indexOf("?")==-1) ? "?" : "&") + "autoplay=1";
  39.     ee.attr("src", src);
  40.     ee.attr("style", "vertical-align:top;");
  41.     htm = $("<div/>").append(ee).html();
  42.     htm = $(\'<div/>\').text(htm).html().replace(/"/g,\'&quot;\');
  43.     resp.html = \'<a href="\'+resp.url+\'" class="youtube-lazy-link" style="width: \'+w+\'px; height: \'+h+\'px; background: #000) center center no-repeat;" onclick="$(this).replaceWith(\\\'\'+htm+\'\\\');return false;"><div style="width:\'+(w-4)+\'px;height:\'+(h-4)+\'px;" class="youtube-lazy-link-div"></div><div class="youtube-lazy-link-info"></div></a>\';
  44.   }
  45.   htmlx = html.replace(new RegExp("\\\\[" + oetagname + "="+resp.url.replace("/", "\\\\/").replace(".", "\\\\.").replace("?", "\\\\?")+"\\\\]"), " " + resp.url + " ");
  46.   htmlx = htmlx.replace(new RegExp("\\\\[" + oetagname + "="+resp.url.replace("/", "\\\\/").replace(".", "\\\\.").replace("?", "\\\\?")+" \\\\]"), " " + resp.url + " ");
  47.   htmlx = htmlx.replace(new RegExp(\'"\'+resp.url.replace("/", "\\\\/").replace(".", "\\\\.").replace("?", "\\\\?")+\'"\', "g"), \'"\'+revurl+\'"\');  // trick to preserve href="url"
  48.   htmlx = htmlx.replace(new RegExp(resp.url.replace("/", "\\\\/").replace(".", "\\\\.").replace("?", "\\\\?")), \'<div style="height:\'+h+\'px;" class="oembed youtube">\'+resp.html+\'</div>\')
  49.   htmlx = htmlx.replace(new RegExp(\'"\'+revurl.replace("/", "\\\\/").replace(".", "\\\\.").replace("?", "\\\\?")+\'"\', "g"), \'"\'+resp.url+\'"\');  // trick to preserve href="url"
  50.   if(html != htmlx) {
  51.     oe_elems[response.callID].html(htmlx);
  52.     if(window.location.hash.replace(/^#/, "").length > 0) {
  53.       if(oe_tid) window.clearTimeout(oe_tid);
  54.       oe_tid = window.setTimeout("oe_jumptohash()", 1000);
  55.     }
  56.   }
  57. }
  58. function oembed_yt(url, width, callID) {
  59.   src = "http://oembed-js.appspot.com/?url=" + encodeURIComponent(url) + "&callback=oembed_callback&callID=" + encodeURIComponent(callID);
  60.   if(width) src = src + "&maxwidth=" + width + "&maxheight=" + width;
  61.   oe_loadscript(src);
  62. }
  63. $(document).ready(function() {
  64.  det=$(\'<div class="youtube-lazy-link-div" />\');
  65.  $("body").append(det);
  66.  if(det.css("position")=="absolute") {
  67.   if(oelazy != 0) oelazy=1;
  68.  }
  69.  else oelazy = 0;
  70.  det.remove();
  71.  window.setTimeout(function() {
  72.   var callID=0;
  73.   $(".comment-content,.comment-body,.comment-body-author,.post-body").each(function() {
  74.     html = " " + $(this).html() + " ";
  75.     if(oetag)
  76.       matches = html.match(new RegExp("\\\\["+oetagname+"=(https?:\\\\/\\\\/[^\\\\s<\\\\/]*youtu\\\\.*be[^\\\\]]+)", "g"));
  77.     else
  78.       matches = html.match(/([>\\s^]|\\[\\w+=)(https?:\\/\\/[^\\s<\\/]*youtu\\.*be[^\\s<\\]]+)/g);
  79.     if(matches && matches.length) {
  80.       for(var i=0;i<matches.length;i++) {
  81.         url = matches[i].match(/https?:\\/\\/[^\\s<\\/]*youtu\\.*be[^\\s<\\]]+/);
  82.         oe_elems[callID] = $(this);
  83.         oembed_yt(url, $(this).width(), callID++);
  84.       }
  85.     }
  86.   });
  87.  }, 500);
  88. });
  89. //]]>
  90. </script>
  91. <script src=\'http://code.jquery.com/jquery-latest.js\' type=\'text/javascript\'></script>
  92. <script type=\'text/javascript\'>
  93. //<![CDATA[
  94. // Lazy loading of youtube videos by MS-potilas 2012. Needs jQuery.
  95. // طريقة الاستخدام نسخ الكود بالأسفل ووضعه مباشرة داخل الموضوع بعد التعديل
  96. // <a class="youtube-lazy-link" style="width:560px;height:315px;" href="https://www.youtube.com/watch?v=الأى دى الخاص بالفيديو">عنوان الفيديو</a>
  97. //  - يمكنك تغيير ابعاد الفيديو
  98. // Source: http://www.abu-iyad.com/2014/10/youtube-videos-lazy-load.html
  99. $(document).ready(function() {
  100.   $("a.youtube-lazy-link").each(function(index) {
  101.     var embedparms = $(this).attr("href").split("/embed/")[1];
  102.     if(!embedparms) embedparms = $(this).attr("href").split("://youtu.be/")[1];
  103.     if(!embedparms) embedparms = $(this).attr("href").split("?v=")[1].replace(/&/,\'?\');
  104.     var youid = embedparms.split("?")[0].split("#")[0];
  105.     var start = embedparms.match(/[#&]t=(d+)s/);
  106.     if(start) start = start[1];
  107.     else {
  108.       start = embedparms.match(/[#&]t=(d+)m(d+)s/);
  109.       if(start) start = parseInt(start[1])*60+parseInt(start[2]);
  110.       else {
  111.         start = embedparms.match(/[?&]start=(d+)/);
  112.         if(start) start = start[1];
  113.       }
  114.     }
  115.     embedparms = embedparms.split("#")[0];
  116.     if(start && embedparms.indexOf("start=") == -1)
  117.       embedparms += ((embedparms.indexOf("?")==-1) ? "?" : "&") + "start="+start;
  118.     if(embedparms.indexOf("showinfo=0") != -1)
  119.       $(this).html(\'\');
  120.     else
  121.       $(this).html(\'<div class="youtube-lazy-link-info">\' + $(this).html() + \'</div>\');
  122.     $(this).prepend(\'<div style="height:\'+(parseInt($(this).css("height"))-4)+\'px;width:\'+(parseInt($(this).css("width"))-4)+\'px;" class="youtube-lazy-link-div"></div>\');
  123.     $(this).css("background", "#000) center center no-repeat");
  124.     $(this).attr("id", youid+index);
  125.     $(this).attr("href", "http://www.youtube.com/watch?v="+youid+(start ? "#t="+start+"s" : ""));
  126.     var emu = \'http://www.youtube.com/embed/\'+embedparms;
  127.     emu += ((emu.indexOf("?")==-1) ? "?" : "&") + "autoplay=1";
  128.     var videoFrame = \'<iframe width="\'+parseInt($(this).css("width"))+\'" height="\'+parseInt($(this).css("height"))+\'" style="vertical-align:top;" src="\'+emu+\'" frameborder="0" allowfullscreen></iframe>\';
  129.     $(this).attr("onclick", "$(\'#"+youid+index+"\').replaceWith(\'"+videoFrame+"\');return false;");
  130.   });
  131. })
  132. //]]>
  133. </script>
  134. <style type=\'text/css\'>
  135. a.youtube-lazy-link {
  136.   vertical-align:top;
  137.   background:#555;
  138.   width:560px; height:315px;
  139.   background-size:cover;
  140.   text-decoration:none;
  141.   color:#DDD;
  142.   text-align:left;
  143.   text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
  144.   display:inline-block;
  145. }
  146. a.youtube-lazy-link:hover {
  147.   text-decoration:none;
  148.   color:#FFF;
  149. }
  150. .youtube-lazy-link-div {
  151.   border:2px solid #000;
  152.   background: url(http://lh4.googleusercontent.com/-QCeB6REIFlE/TuGUlY3N46I/AAAAAAAAAaI/9-urEUtpKcI/s800/youtube-play-button.png) center center no-repeat;
  153.   position:absolute;
  154. }
  155. .youtube-lazy-link-div:hover {
  156.   background: url( http://lh4.googleusercontent.com/-ywkTvQ4VohA/T455cg8_PRI/AAAAAAAAAq4/qfUJoK13InI/s800/youtube-play-button-hover-red.png) center center no-repeat;
  157. }
  158. .youtube-lazy-link-info {
  159.   font-size: 110%;
  160.   padding: 2px 6px;
  161.   background: rgb(0, 0, 0);
  162.   background: rgba(0, 0, 0, 0.5);
  163. }
  164. </style>
');