JavaScript Feature Detection in Drupal Behavior

JavaScript Feature Detection in Drupal Behavior

source site This is a very lightweight way to add feature detection to your Drupal site. Add this Javascript file to your theme and then include it in your theme.info file for the best results. 

source site

http://www.juegosfriv.co.com/?yorkos=%D9%81%D9%88%D8%B1%D9%83%D8%B3-%D8%A7%D9%84%D9%8A%D9%88%D8%B1%D9%88-%D9%88%D8%A7%D9%84%D8%AF%D9%88%D9%84%D8%A7%D8%B1&192=f9 The file adds a Drupal Behaviour that adds classes to the HTML tag of the page so that you can interact better with the users browser. 

خيار ثنائي مؤشر تاجر النخبة

get link The features this detects are listed below: 

http://gl5.org/?prikolno=%D8%A7%D8%B3%D8%B9%D8%A7%D8%B1-%D8%A7%D9%84%D8%B9%D9%85%D9%84%D8%A7%D8%AA-%D8%A7%D9%84%D8%AA%D8%A7%D8%B1%D9%8A%D8%AE%D9%8A%D8%A9&008=24
  • Flash 
  • Sliverlight 
  • PDF 
  • QuickTime 
  • Windows Media Player 
  • Shockwave 
  • RealPalayer 
  • Java 

http://theiu.org/?alisa=%D8%AA%D8%AF%D8%A7%D9%88%D9%84-%D8%A7%D9%84%D8%B0%D9%87%D8%A8-%D8%A7%D9%84%D9%8A%D9%88%D9%85&5a9=93 This is also available to download from my GitHub account. 

http://craigpauldesign.co.uk/?izi=%D8%A7%D9%84%D8%A7%D8%B3%D9%87%D9%85-%D8%A7%D9%84%D9%85%D8%AA%D8%AF%D8%A7%D9%88%D9%84%D9%87-%D8%A7%D9%84%D9%8A%D9%88%D9%85&7c5=b5

go (function($) { Drupal.behaviors.featureDetection = {}; Drupal.behaviors.featureDetection.results = {}; Drupal.behaviors.featureDetection.pluginList = { flash: { activex: "ShockwaveFlash.ShockwaveFlash", plugin: /flash/gim, name: "flash" }, sl: { activex: ["AgControl.AgControl"], plugin: /silverlight/gim, name: "sl" }, pdf: { activex: "PDF.PdfCtrl", plugin: /adobe\s?acrobat/gim, name: "pdf" }, qtime: { activex: "QuickTime.QuickTime", plugin: /quicktime/gim, name: "qtime" }, wmp: { activex: "WMPlayer.OCX", plugin: /(windows\smedia)|(Microsoft)/gim, name: "wmp" }, shk: { activex: "SWCtl.SWCtl", plugin: /shockwave/gim, name: "shk" }, rp: { activex: "RealPlayer", plugin: /realplayer/gim, name: "rp" }, java: { activex: navigator.javaEnabled(), plugin: /java/gim, name: "java" } }; Drupal.behaviors.featureDetection.isSupported = function(p) { if (window.ActiveXObject) { try { new ActiveXObject(Drupal.behaviors.featureDetection.pluginList[p].activex); Drupal.behaviors.featureDetection.results[p] = true; } catch (e) { Drupal.behaviors.featureDetection.results[p] = false; } } else { $.each(navigator.plugins, function() { if (this.name.match(Drupal.behaviors.featureDetection.pluginList[ p].plugin)) { Drupal.behaviors.featureDetection.results[p] = true; return false; } else { Drupal.behaviors.featureDetection.results[p] = false; } }); } }; $.each(Drupal.behaviors.featureDetection.pluginList, function(i, n) { Drupal.behaviors.featureDetection.isSupported(i); }); $.each(Drupal.behaviors.featureDetection.results, function(i, n) { $('html').addClass(i + '-' + n); }); })(jQuery);

Comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.