PageSourceSearch

https://peelander-z.net/wp-content/plugins/player/js/flash_detect.js?ver=7.1.3

js peelander-z.net collected 2026-10-10 00:36:21 UTC 7,248 bytes, 200 lines download raw bytes

1/*
2Copyright (c) Copyright (c) 2007, Carl S. Yestrau All rights reserved.
3Code licensed under the BSD License: http://www.featureblend.com/license.txt
4Version: 1.0.4
5*/
6var FlashDetect = new function(){
7    var self = this;
8    self.installed = false;
9    self.raw = "";
10    self.major = -1;
11    self.minor = -1;
12    self.revision = -1;
13    self.revisionStr = "";
14    var activeXDetectRules = [
15        {
16            "name":"ShockwaveFlash.ShockwaveFlash.7",
17            "version":function(obj){
18                return getActiveXVersion(obj);
19            }
20        },
21        {
22            "name":"ShockwaveFlash.ShockwaveFlash.6",
23            "version":function(obj){
24                var version = "6,0,21";
25                try{
26                    obj.AllowScriptAccess = "always";
27                    version = getActiveXVersion(obj);
28                }catch(err){}
29                return version;
30            }
31        },
32        {
33            "name":"ShockwaveFlash.ShockwaveFlash",
34            "version":function(obj){
35                return getActiveXVersion(obj);
36            }
37        }
38    ];
39    /**
40     * Extract the ActiveX version of the plugin.
41     * 
42     * @param {Object} The flash ActiveX object.
43     * @type String
44     */
45    var getActiveXVersion = function(activeXObj){
46        var version = -1;
47        try{
48            version = activeXObj.GetVariable("$version");
49        }catch(err){}
50        return version;
51    };
52    /**
53     * Try and retrieve an ActiveX object having a specified name.
54     * 
55     * @param {String} name The ActiveX object name lookup.
56     * @return One of ActiveX object or a simple object having an attribute of activeXError with a value of true.
57     * @type Object
58     */
59    var getActiveXObject = function(name){
60        var obj = -1;
61        try{
62            obj = new ActiveXObject(name);
63        }catch(err){
64            obj = {activeXError:true};
65        }
66        return obj;
67    };
68    /**
69     * Parse an ActiveX $version string into an object.
70     * 
71     * @param {String} str The ActiveX Object GetVariable($version) return value. 
72     * @return An object having raw, major, minor, revision and revisionStr attributes.
73     * @type Object
74     */
75    var parseActiveXVersion = function(str){
76        var versionArray = str.split(",");//replace with regex
77        return {
78            "raw":str,
79            "major":parseInt(versionArray[0].split(" ")[1], 10),
80            "minor":parseInt(versionArray[1], 10),
81            "revision":parseInt(versionArray[2], 10),
82            "revisionStr":versionArray[2]
83        };
84    };
85    /**
86     * Parse a standard enabledPlugin.description into an object.
87     * 
88     * @param {String} str The enabledPlugin.description value.
89     * @return An object having raw, major, minor, revision and revisionStr attributes.
90     * @type Object
91     */
92    var parseStandardVersion = function(str){
93        var descParts = str.split(/ +/);
94        var majorMinor = descParts[2].split(/\./);
95        var revisionStr = descParts[3];
96        return {
97            "raw":str,
98            "major":parseInt(majorMinor[0], 10),
99            "minor":parseInt(majorMinor[1], 10), 
100            "revisionStr":revisionStr,
101            "revision":parseRevisionStrToInt(revisionStr)
102        };
103    };
104    /**
105     * Parse the plugin revision string into an integer.
106     * 
107     * @param {String} The revision in string format.
108     * @type Number
109     */
110    var parseRevisionStrToInt = function(str){
111        return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision;
112    };
113    /**
114     * Is the major version greater than or equal to a specified version.
115     * 
116     * @param {Number} version The minimum required major version.
117     * @type Boolean
118     */
119    self.majorAtLeast = function(version){
120        return self.major >= version;
121    };
122    /**
123     * Is the minor version greater than or equal to a specified version.
124     * 
125     * @param {Number} version The minimum required minor version.
126     * @type Boolean
127     */
128    self.minorAtLeast = function(version){
129        return self.minor >= version;
130    };
131    /**
132     * Is the revision version greater than or equal to a specified version.
133     * 
134     * @param {Number} version The minimum required revision version.
135     * @type Boolean
136     */
137    self.revisionAtLeast = function(version){
138        return self.revision >= version;
139    };
140    /**
141     * Is the version greater than or equal to a specified major, minor and revision.
142     * 
143     * @param {Number} major The minimum required major version.
144     * @param {Number} (Optional) minor The minimum required minor version.
145     * @param {Number} (Optional) revision The minimum required revision version.
146     * @type Boolean
147     */
148    self.versionAtLeast = function(major){
149        var properties = [self.major, self.minor, self.revision];
150        var len = Math.min(properties.length, arguments.length);
151        for(i=0; i<len; i++){
152            if(properties[i]>=arguments[i]){
153                if(i+1<len && properties[i]==arguments[i]){
154                    continue;
155                }else{
156                    return true;
157                }
158            }else{
159                return false;
160            }
161        }
162    };
163    /**
164     * Constructor, sets raw, major, minor, revisionStr, revision and installed public properties.
165     */
166    self.FlashDetect = function(){
167        if(navigator.plugins && navigator.plugins.length>0){
168            var type = 'application/x-shockwave-flash';
169            var mimeTypes = navigator.mimeTypes;
170            if(mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description){
171                var version = mimeTypes[type].enabledPlugin.description;
172                var versionObj = parseStandardVersion(version);
173                self.raw = versionObj.raw;
174                self.major = versionObj.major;
175                self.minor = versionObj.minor; 
176                self.revisionStr = versionObj.revisionStr;
177                self.revision = versionObj.revision;
178                self.installed = true;
179            }
180        }else if(navigator.appVersion.indexOf("Mac")==-1 && window.execScript){
181            var version = -1;
182            for(var i=0; i<activeXDetectRules.length && version==-1; i++){
183                var obj = getActiveXObject(activeXDetectRules[i].name);
184                if(!obj.activeXError){
185                    self.installed = true;
186                    version = activeXDetectRules[i].version(obj);
187                    if(version!=-1){
188                        var versionObj = parseActiveXVersion(version);
189                        self.raw = versionObj.raw;
190                        self.major = versionObj.major;
191                        self.minor = versionObj.minor; 
192                        self.revision = versionObj.revision;
193                        self.revisionStr = versionObj.revisionStr;
194                    }
195                }
196            }
197        }
198    }();
199};
200FlashDetect.JS_RELEASE = "1.0.4";

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.