Permalink
Browse files

allows browser specific hacks as part of target script

  • Loading branch information...
sgrebnov committed Aug 16, 2012
1 parent d288586 commit 694107cca5fdc762737b2702a5b7209696ef8e71
@@ -4,12 +4,28 @@
<meta name="viewport" content="user-scalable=no, width=device-width, height=device-height"/>
<title>weinre demo</title>
<link rel="stylesheet" href="weinre-demo.css"/>
-<script src="wp-hacks.js"></script>
<script>try {window.WeinreServerId = location.hash.split("#")[1]} catch(e) {window.WeinreServerId = "anonymous"}</script>
<script src="/target/target-script-min.js"></script>
<script src="weinre-demo.js"></script>
</head>
-
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
<body onload="onLoad()">
<input id="button-start-stuff" type="button" value="start stuff">
@@ -1,3 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta name="viewport" content="user-scalable=no, width=device-width, height=device-height">
+<title>weinre demo</title>
+<link rel="stylesheet" href="weinre-demo.css">
+<script>try {window.WeinreServerId = location.hash.split("#")[1]} catch(e) {window.WeinreServerId = "anonymous"}</script>
+<script src="../target/target-script.js"></script>
+<script src="weinre-demo.js"></script>
+</head>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -16,17 +26,6 @@
* specific language governing permissions and limitations
* under the License.
-->
-
-<html>
-<head>
-<meta name="viewport" content="user-scalable=no, width=device-width, height=device-height">
-<title>weinre demo</title>
-<link rel="stylesheet" href="weinre-demo.css">
-<script>try {window.WeinreServerId = location.hash.split("#")[1]} catch(e) {window.WeinreServerId = "anonymous"}</script>
-<script src="../target/target-script.js"></script>
-<script src="weinre-demo.js"></script>
-</head>
-
<body onload="onLoad()">
<input id="button-start-stuff" type="button" value="start stuff">
@@ -1,28 +0,0 @@
-// a place for hacks
-
-
-weinreIE9Hacks = function () {
-
- // check for quirks mode
- if(typeof document.addEventListener === 'undefined')
- {
- alert ("Opps. It seems the page runs in compatibility mode. Please fix and try again.");
- return;
- }
-
-
- if (typeof(Element) != "object") {
- Element = function () {};
- }
-
- if (typeof(Node) != "object") {
- Node = function () {};
- }
-}
-
-var isIE = window.navigator.userAgent.indexOf("MSIE") != -1;
-
-if (isIE) {
- weinreIE9Hacks();
-}
-
@@ -0,0 +1,25 @@
+# a place for browser specific hacks
+
+module.exports = class BrowsersHacks
+
+ constructor: ->
+
+ @apply: ->
+ isIE = window.navigator.userAgent.indexOf("MSIE") isnt -1
+
+ internetExplorerHacks() if isIE
+
+ internetExplorerHacks = ->
+
+ # check for quirks mode
+ if typeof document.addEventListener is "undefined"
+ alert "Oops. It seems the page runs in compatibility mode. Please fix it and try again."
+ return
+
+ if typeof (window.Element) is "undefined"
+ window.Element = ->
+
+ if typeof (window.Node) is "undefined"
+ window.Node = ->
+
+require("../common/MethodNamer").setNamesForClass(module.exports)
@@ -18,6 +18,8 @@
# under the License.
#---------------------------------------------------------------------------------
+require('./BrowserHacks').apply()
+
Ex = require('../common/Ex')
Binding = require('../common/Binding')
Callback = require('../common/Callback')

0 comments on commit 694107c

Please sign in to comment.