Thursday, December 18, 2014

“Sony should make that email can leak” – Computer Sweden

– IDG.se:



  White Paper
 




‘; // This element ifogas in the body
  was target_element_selector = ‘# smart-in text-target’; // Id same elements
 
  was article_body = jQuery (‘[class = "saplo: body'] ‘); // Article Text Column
 
  // Selector video container in the body or Article image container
  was video_container_selector = ”
  + ‘#articleImageBlock Iframe [src * = "http://ljsp.lwcdn.com'], ‘
  + ‘#articleImageBlock Iframe [src * =' youtube.com '],’
  + ‘#articleImageBlock Iframe [src * = "vimeo.com'], ‘
  + ‘[Class = "saplo: body"] iframe [src * = "http://ljsp.lwcdn.com'], ‘
  + ‘[Class = "saplo: body"] iframe [src * =' youtube.com '],’
  + ‘[Class = "saplo: body"] iframe [src * = "vimeo.com"]‘;
 
  // Gets the video container
  was video_container = jQuery (video_containe r_selector);
 
  // Called to move the ad from the right column to the body text and display it
  injectAdToText function () {
  jQuery (target_element_selector) .append (smart_in_text_container);
  smart_in_text_container.show ();
  }
 
  // Function that makes it possible to search for indices with regex
  function regexIndexOf (string, regex, startpos) {
  was indexOf = string.substring (startpos || 0) .search (regex);
  Return (indexOf & gt; = 0)? (+ IndexOf (startpos || 0)): indexOf;
  }
 
  // Hides ad
  smart_in_text_container.hide ();
 
  // Run only if there is an article column, and if there is not a video in the article
  if (article_body.length === 1 & amp; & amp; ad_exists & amp; & amp; video_container.length === 0) {
  
  // Gets all the “sections” in the text (or rather the element with the clas s “paragraphIntro”)
  was paragraph_array = article_body.find (Br + br + .paragraphIntro ‘);
  
  // If paragraphs are more than 1
  if (paragraph_array.length & gt; 1) {
  
  was middle_p_nr = (Math.round ((paragraph_array.length / 2)) – 1);
 
  // Prints the ad container in the middle of the article
  jQuery (paragraph_array [middle_p_nr]). beforehand (target_element);
  
  // Paste the ad in annonsbeållaren
  injectAdToText ();
  } Else {
  // If there are no sections NR2 check is made to
  // Look double line breaks even between themselves
  
  // Retrieves the body of a string
  was article_text = article_body.html ();
 
 
  // Match all br tags with & amp; nbsp between them.
  was search_str = / (
) ( s?) * ( s?) * (
) / g; was current_index = regexIndexOf (article _text, search_str); was brbr_count = []; // Loops through the body and looks for double line breaks while (current_index! == -1) {Brbr_count.push (current_index); current_index = regexIndexOf (article_text, search_str, (current_index + 1)); } // If there are multiple breaks in the article if (brbr_count.length & gt; 0) {// Pick out a double line break in the middle, and save the index for this was middle_br_nr = (Math.round ((brbr_count.length / 2 )) – 1); was middle_index = brbr_count [middle_br_nr]; // Creates a new body with ad reservoir was new_text = article_text.substr (0, middle_index); new_text + = target_element; new_text + = article_text.substr (middle_index, article_text.length); // Replaces the old body with the new article_body.html (new_text); // Inject the ad in the ad container injectAdToText (); } Else {// If no paragraphs or double br found in the body text overlay ad at the bottom of the body. console.log (‘SMART CLIP: Found no clauses inserted at the end of the body text’); article_body.append (target_element); injectAdToText (); }}} // If there is already a video if (video_container.length & gt; 0) {console.log (‘SMART CLIP: Döjs due to conflict with existing video’); }} ());

Ad: News from Tieto
Ad: News from Tieto
Ad: News from Digital Trends

News from blogs

LikeTweet

No comments:

Post a Comment