Skip to content

Commit

Permalink
support for Opera Next
Browse files Browse the repository at this point in the history
  • Loading branch information
Victoria French committed Feb 28, 2014
1 parent a6b0b25 commit e22190c
Show file tree
Hide file tree
Showing 10 changed files with 223 additions and 30 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
### HEAD

### 1.1.1 (February 28, 2014)

* Added Support for Opera Next
* Updated Readme.md
* Updated Changelog.md

### 1.1.0 (February 8, 2013)

* Added simple Test Page
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contributing to HTML5 Boilerplate
# Contributing to Defunctr

[Defunctr](http://github.com/victoriafrench/defunctr) and want to get involved?
Thanks! There are plenty of ways you can help!
Expand Down
40 changes: 19 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,32 @@ Defunctr has the ability to exclude testing and tagging by appending any of the
* `defunctr-version-off`: Defunctr will not add browser version classes to the `<head>` element
* `defunctr-lt-off`: Defunctr will not add less than version classes to the `<head>` elememnt
* `defunctr-gt-off`: Defunctr will not add greater than version classes to the `<head>` element
### Classes created by Defunctr

* `.ie` or `.no-ie`: Defines if the browser is Internet Explorer. This feature is always on.
* `.chrome` or `.no-chrome`: Defines if the browser is Chrome. This feature is turned off by adding `defunctr-ie-only`.
* `.safari` or `.no-safari`: Defines if the browser is Safari. This feature is turned off by adding `defunctr-ie-only`.
* `.webkit` or `.no-webkit`: Defines if the browser is Webkit including Chrome and Safari. This feature is turned off by adding `defunctr-ie-only`.
* `.firefox` or `.no-firefox`: Defines if the browser is Firefox. This feature is turned off by adding `defunctr-ie-only`.
* `.opera` or `.no-opera`: Defines if the browser is Opera. This feature is turned off by adding `defunctr-ie-only`.


* `.ie-version-7` and `.no-ie-version-7`: Defines if the browser is IE 7. This feature is turned off by adding `defunctr-version-off`.
* `.ie-version-8` and `.no-ie-version-8`: Defines if the browser is IE 8. This feature is turned off by adding `defunctr-version-off`.
* `.ie-version-9` and `.no-ie-version-9`: Defines if the browser is IE 9. This feature is turned off by adding `defunctr-version-off`.

* `.ie-gt-6` and `.no-ie-gt-6`: Defines if the browser is IE 7+. This feature is turned off by adding `defunctr-gt-off`.
* `.ie-gt-7` and `.no-ie-gt-7`: Defines if the browser is IE 8+. This feature is turned off by adding `defunctr-gt-off`.
* `.ie-gt-8` and `.no-ie-gt-8`: Defines if the browser is IE 9+. This feature is turned off by adding `defunctr-gt-off`.
* `.ie-gt-9` and `.no-ie-gt-9`: Defines if the browser is IE 10+. This feature is turned off by adding `defunctr-gt-off`.

* `.ie-lt-7` and `.no-ie-lt-7`: Defines if the browser is less than IE 7. This feature is turned off by adding `defunctr-lt-off`.
* `.ie-lt-8` and `.no-ie-lt-8`: Defines if the browser is less than IE 8. This feature is turned off by adding `defunctr-lt-off`.
* `.ie-lt-9` and `.no-ie-lt-9`: Defines if the browser is less than IE 9. This feature is turned off by adding `defunctr-lt-off`.
* `.ie-lt-10` and `.no-ie-lt-10`: Defines if the browser is less than IE 10. This feature is turned off by adding `defunctr-lt-off`.
* `.chrome` or `.no-chrome`: Defines if the browser is Chrome.
* `.safari` or `.no-safari`: Defines if the browser is Safari.
* `.webkit` or `.no-webkit`: Defines if the browser is Webkit including Chrome, Safari, and Opera Next.
* `.firefox` or `.no-firefox`: Defines if the browser is Firefox.
* `.opera` or `.no-opera`: Defines if the browser is Opera (non-webkit).
* `.opera-next` or `.no-opera-next`: Defines if the browser is Opera Next (webkit).
* `.ie-version-7` and `.no-ie-version-7`: Defines if the browser is IE 7.
* `.ie-version-8` and `.no-ie-version-8`: Defines if the browser is IE 8.
* `.ie-version-9` and `.no-ie-version-9`: Defines if the browser is IE 9.
* `.ie-gt-6` and `.no-ie-gt-6`: Defines if the browser is IE 7+.
* `.ie-gt-7` and `.no-ie-gt-7`: Defines if the browser is IE 8+.
* `.ie-gt-8` and `.no-ie-gt-8`: Defines if the browser is IE 9+.
* `.ie-gt-9` and `.no-ie-gt-9`: Defines if the browser is IE 10+.
* `.ie-lt-7` and `.no-ie-lt-7`: Defines if the browser is less than IE 7.
* `.ie-lt-8` and `.no-ie-lt-8`: Defines if the browser is less than IE 8.
* `.ie-lt-9` and `.no-ie-lt-9`: Defines if the browser is less than IE 9.
* `.ie-lt-10` and `.no-ie-lt-10`: Defines if the browser is less than IE 10.

### Limitations on this release

* Opera can only be detected from version 8.0+
* Opera Next is detected as Opera-Next not Opera.
* Firefox can only be detected from version 0.8+
* Safari can only be detected from version 3.0+
* Chrome can only be detected from version 1.0+
Expand Down
Binary file added nuget/Defunctr.1.1.1.nupkg
Binary file not shown.
10 changes: 5 additions & 5 deletions nuget/Defunctr.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Defunctr</id>
<version>1.1.0</version>
<version>1.1.1</version>
<title>Defunctr</title>
<authors>Victoria French</authors>
<owners>Victoria French</owners>
<projectUrl>http://github.com/victoriafrench/defunctr</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Defunctr is a module for Modernizr that will detect the current browser using feature detection. It will then append browser informational classes to the head element of the page, giving the designer the ability to override CSS styles without using older browser hacks. Changing the browsers compatability mode will cause the correct classes to be applied and changing a user-agent will have not effect on the class generation.</description>
<summary>Defunctr is a module for Modernizr that will append browser versioning information into the head element of your web pages using feature detection.</summary>
<releaseNotes>Better detection of Internet Explorer and experimental support for KHtml</releaseNotes>
<copyright>2013 Victoria French</copyright>
<releaseNotes>Now includes support for Opera Next.</releaseNotes>
<copyright>2013, 2104 Victoria French</copyright>
<tags>Modernizr, Browser Detection, HTML5, Shiv</tags>
<dependencies>
<dependency id="Modernizr" version="2.6.2" />
</dependencies>
</metadata>
<files>
<file src="..\src\defunctr-1.1.0.js" target="content\Scripts\Vendor\Defunctr\defunctr-1.1.0.js" />
<file src="..\src\defunctr-1.1.0.min.js" target="content\Scripts\Vendor\Defunctr\defunctr-1.1.0.min.js" />
<file src="..\src\defunctr-1.1.1.js" target="content\Scripts\Vendor\Defunctr\defunctr-1.1.1.js" />
<file src="..\src\defunctr-1.1.1.min.js" target="content\Scripts\Vendor\Defunctr\defunctr-1.1.1.min.js" />
</files>
</package>
93 changes: 93 additions & 0 deletions src/defunctr-1.1.1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/* Defunctr 1.1.1 | MIT & BSD | Copyright 2013, 2014 Victoria French | http://github.com/victoriafrench/defunctr */
window.Defunctr = (function (window, document, undefined) {
var version = '1.1.0',
r = {};
docElement = document.documentElement,
docHead = document.head || document.getElementsByTagName('head')[0],
defunctr = 'defunctr';
prefix = '',
gtoff = docElement.className.indexOf('defunctr-gt-off') > 0,
ltoff = docElement.className.indexOf('defunctr-lt-off') > 0,
voff = docElement.className.indexOf('defunctr-version-off') > 0,
onlyie = docElement.className.indexOf('defunctr-ie-only') > 0,
tests = [];

r.detective = (function (window, document, undefined) {
var r = {};
r.isWebkit = (function (document, undefined) { return 'WebkitTransform' in document.documentElement.style; /* v 1+ */})(document);
r.isOpera = (function (window, undefined) { return !!(window.opera && window.opera.version); /* 8.0+ */ })(window);
r.isIE = (function (window, undefined) { return 'ActiveXObject' in window; /*return (document.all != undefined) && !self.isOpera;*/ })(window);
r.isFirefox = (function (document, undefined) { return 'MozBoxSizing' in document.documentElement.style; /* 0.8+ */ })(document);
r.isSafari = (function (window, undefined) { return Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; /*v 3+ */ })(window);
r.isKhtml = (function (document, undefined) { return 'KhtmlMarquee' in document.documentElement.style })(document);
r.isOperaNext = (function (self, navigator, undefined) { return self.isWebkit && /(Opera|OPR)/.test(navigator.userAgent); })(r, navigator);
r.isChrome = (function (self, undefined) { return !self.isSafari && !self.isOperaNext && self.isWebkit; })(r);

r.ieBelowVersion6 = (function (self, document, undefined) { return self.isIE && !(document.compatMode != undefined); })(r, document);
r.ieBelowVersion7 = (function (self, window, undefined) { return self.isIE && !(window.XMLHttpRequest != undefined); })(r, window);
r.ieBelowVersion8 = (function (self, document, undefined) { return self.isIE && !(document.querySelector != undefined); })(r, document);
r.ieBelowVersion9 = (function (self, document, undefined) { return self.isIE && !(document.addEventListener != undefined); })(r, document);
r.ieBelowVersion10 = (function (self, window, undefined) { return self.isIE && !(window.atob != undefined); })(r, window);
r.ieAboveVersion5 = (function (self, window, undefined) { return self.isIE && (document.compatMode != undefined); })(r, window);
r.ieAboveVersion6 = (function (self, window, undefined) { return self.isIE && (window.XMLHttpRequest != undefined); })(r, window);
r.ieAboveVersion7 = (function (self, document, undefined) { return r.isIE && (document.querySelector != undefined); })(r, document);
r.ieAboveVersion8 = (function (self, window, undefined) { return self.isIE && (document.addEventListener != undefined); })(r, window);
r.ieAboveVersion9 = (function (self, window, undefined) { return self.isIE && (window.atob != undefined); })(r, window);
r.ieIsVersion6 = (function (self, undefined) { return self.ieAboveVersion5 && self.ieBelowVersion7; })(r);
r.ieIsVersion7 = (function (self, undefined) { return self.ieAboveVersion6 && self.ieBelowVersion8; })(r);
r.ieIsVersion8 = (function (self, undefined) { return self.ieAboveVersion7 && self.ieBelowVersion9; })(r);
r.ieIsVersion9 = (function (self, undefined) { return self.ieAboveVersion8 && self.ieBelowVersion10; })(r);


r.chromeIsAbove15 = (function (window, undefined) { return !!(window.chrome && window.chrome.webstore && window.chrome.webstore.install); })(window);


r.standardsCompliant = (function (self, undefined) { return r.ieAboveVersion9; })(r);
return r;
})(window, document);

tests[prefix + 'ie'] = function () { return r.detective.isIE; };
if (!onlyie) {
tests[prefix + 'chrome'] = function () { return r.detective.isChrome; };
tests[prefix + 'safari'] = function () { return r.detective.isSafari; };
tests[prefix + 'opera'] = function () { return r.detective.isOpera; };
tests[prefix + 'opera-next'] = function() { return r.detective.isOperaNext; };
tests[prefix + 'firefox'] = function () { return r.detective.isFirefox; };
tests[prefix + 'khtml'] = function () { return r.detective.isKhtml; };
tests[prefix + 'webkit'] = function () { return r.detective.isWebkit; };
}

if (!ltoff) {
tests[prefix + 'ie-lt-7'] = function () { return r.detective.ieBelowVersion7; };
tests[prefix + 'ie-lt-8'] = function () { return r.detective.ieBelowVersion8; };
tests[prefix + 'ie-lt-9'] = function () { return r.detective.ieBelowVersion9; };
tests[prefix + 'ie-lt-10'] = function () { return r.detective.ieBelowVersion10; };
}

if (!gtoff) {
tests[prefix + 'ie-gt-6'] = function () { return r.detective.ieAboveVersion6; };
tests[prefix + 'ie-gt-7'] = function () { return r.detective.ieAboveVersion7; };
tests[prefix + 'ie-gt-8'] = function () { return r.detective.ieAboveVersion8; };
tests[prefix + 'ie-gt-9'] = function () { return r.detective.ieAboveVersion9; };
}

if (!voff) {
tests[prefix + 'ie-version-7'] = function () { return r.detective.ieIsVersion7; };
tests[prefix + 'ie-version-8'] = function () { return r.detective.ieIsVersion8; };
tests[prefix + 'ie-version-9'] = function () { return r.detective.ieIsVersion9; };
}

r.version = version;

for (key in tests) {
window.Modernizr.addTest(key, tests[key]);
}

docElement.className = docElement.className.replace(/\bdefunctr-gt-off\b/, '');
docElement.className = docElement.className.replace(/\bdefunctr-lt-off\b/, '');
docElement.className = docElement.className.replace(/\bdefunctr-version-off\b/, '');
docElement.className = docElement.className.replace(/\bdefunctr-ie-only\b/, '');

return r;
})(this, this.document);

2 changes: 2 additions & 0 deletions src/defunctr-1.1.1.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e22190c

Please sign in to comment.