/*
__ _ ___ ___ ___ ___ ___ ____ _ __ ___ ___
/ _` |/ / / __/ _ \ / _ \ / / / __/| '_ ` _ \ / /
| (_| |\ \| (_| (_) | (_) |\ \ | (__ | | | | | |\ \
\__,_|/__/ \___\___/ \___/ /__/ \___\|_| |_| |_|/__/
*/
(function($) {
/**
* START FUNCTION isFlashEnabled(options)
*
* FUNCTION: isFlashEnabled(options)
*
* options
* --------
* ret -- Return or Show Flash informations -- [Default = false]
* id -- HTML Tag ID for show information -- [Default = 'info-flash']. Used only if ret = false.
* textInstalled -- Text for message if installled on Windows Explorer -- [Default = 'Flash is installed.']
* textNotInstalled -- Text for message if not installled -- [Default = 'Flash is not installed.']
* isInstalled -- Text for message if installled -- [Default = 'The {0} {1} is installed.']
* name -- [ONLY READ] - The Flash Name
* version -- [ONLY READ] - The Flash Version
* description -- [ONLY READ] - The Flash Description
* result: -- [ONLY READ] - The flag installation -- 0 = No Installed, 1 = Installed -- [Default = 0]
*
* DESCRIPTION: Checks whether the flash is installed and enabled on the Browser
*
* USE:
* -----
* A) For print in HTML Tag ID
* jQuery(window).isFlashEnabled({ret:false, id:'info-flash'});
*
* B) For return Array with Flash informations. For use with multilanguage info's and CSS id or classes.
* var FlashResult = jQuery(window).isFlashEnabled({ret:true});
* switch ( FlashResult[0] ) {
* case 0:
* jQuery('.info-flash').text('The Flash is not installed');
* break;
*
* case 1:
* jQuery('.info-flash').text( String.format(\"The {0} {1} is installed\", FlashResult[1], FlashResult[2]) );
* break;
* }
*
* EXPORT:
* In English -> The Shockwave Flash 20.0.0.267 is installed.
* In Greek -> Το Shockwave Flash 20.0.0.267 είναι εγκατεστημένο
*
**/
$.fn.isFlashEnabled = function(options) {
defaults = $.extend({
ret: false,
id: 'info-flash',
textInstalled: 'Flash is installed.',
textNotInstalled: 'Flash is not installed.',
isInstalled: 'The {0} {1} is installed.',
name: '',
version: '',
description: '',
result: 0
}, options);
/* Defaults Only Read */
defaults.name = '';
defaults.version = '';
defaults.description = '';
defaults.result = 0;
var opt = defaults;
if (navigator.mimeTypes && navigator.mimeTypes.length > 0) {
// Firefox, Google Chrome, Safari, Opera
var mime = navigator.mimeTypes['application/x-shockwave-flash'];
if (mime && mime.enabledPlugin) {
opt.result = 1;
opt.name = mime.enabledPlugin.name;
opt.version = mime.enabledPlugin.version;
opt.decription = mime.enabledPlugin.description;
}
} else {
if (typeof (ActiveXObject) != "undefined") {
// Internet Explorer
try {
var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.1");
if (flash) {
opt.result = 1;
}
} catch (e) {}
}
}
switch (opt.ret) {
case false:
var info = document.getElementById(opt.id);
switch (opt.result) {
case 0:
info.innerHTML = opt.textNotInstalled;
return opt.result;
break;
case 1:
if (opt.version != '') info.innerHTML = String.format(opt.isInstalled, opt.name, opt.version);
else info.innerHTML = opt.textInstalled;
return opt.result;
break;
default:
info.innerHTML = opt.textNotInstalled;
return opt.result;
}
break;
case true:
var res = [opt.result, opt.name, opt.version, opt.decription];
return res;
break;
default:
return false;
}
};
/* ---- END FUNCTION isFlashEnabled ---- */
// .......
})(jQuery);
This jAscoos (jQuery Ascoos Library) function, checks whether the flash is installed and enabled on the Browser. Can be used and outside of the Ascoos Cms. Requires the function String.format ( https://codepad.co/snippet/AwpjAsux )
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.