-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simple proof of concept. FF Only; uses jquery.
- Loading branch information
1 parent
3efcb9d
commit 6d2d6ee
Showing
4 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
(function() { | ||
|
||
function theTest() { | ||
return true; | ||
} | ||
|
||
function preTest() { | ||
return true; | ||
} | ||
|
||
function loadJsAsynch() { | ||
var script = document.createElement("script"); | ||
script.type = "text/javascript"; | ||
script.async = true; | ||
script.src = "main.js"; | ||
|
||
var target = document.getElementsByTagName("script")[0]; | ||
target.parentNode.insertBefore(script, target); | ||
} | ||
|
||
function insertFoucPreventer() { | ||
$(document.documentElement).removeClass("no-js").addClass("js loading"); | ||
|
||
var foucPreventer = $("<style/>").text(".loading .hideload {display:none};"); | ||
var target = document.getElementsByTagName("script")[0]; | ||
target.parentNode.insertBefore(foucPreventer.get(0), target); | ||
} | ||
|
||
function doIt() { | ||
if (preTest() && theTest()) { | ||
insertFoucPreventer(); | ||
loadJsAsynch(); | ||
} | ||
} | ||
|
||
doIt(); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(function() { | ||
$("#nojs").text("Content for Passing Browsers"); | ||
$("html").removeClass("loading"); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!doctype html> | ||
<html class="no-js" lang="en"> | ||
<head> | ||
<title>C Grade test page</title> | ||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js"></script> | ||
<script src="cgrade.js"></script> | ||
|
||
</head> | ||
|
||
<body> | ||
|
||
|
||
<h1 id="nojs" class="hideload">Content for Failing Browsers</h1> | ||
|
||
<h2>Content for everybody</h2> | ||
|
||
</body> | ||
</html> | ||
|