David Winterbottom 14 лет назад
Родитель
Сommit
1fe4e247b0
1 измененных файлов: 64 добавлений и 67 удалений
  1. 64
    67
      oscar/static/js/snowcone/snowcone.js

+ 64
- 67
oscar/static/js/snowcone/snowcone.js Просмотреть файл

@@ -1,68 +1,65 @@
1
-//Script to ensure Snowcone will work for legacy browsers, that don't support the :before pseudo class
1
+// Script to ensure Snowcone will work for legacy browsers, that don't support the :before pseudo class
2
+var snowcone = {
3
+    icons: {
4
+        ico_alert: "A",
5
+        ico_cross: "B",
6
+        outofstock: "B", //cross also used for out of stock items
7
+        ico_tick: "C",
8
+        instock: "C", //tick also used for in stock items
9
+        ico_expand: "D",
10
+        ico_contract: "E",
11
+        ico_view: "F",
12
+        ico_sync: "G",
13
+        ico_home: "H",
14
+        ico_outline_down: "I",
15
+        ico_outline_up: "J",
16
+        ico_outline_right: "K",
17
+        ico_outline_left: "L",
18
+        ico_stop: "M",
19
+        ico_mapmarker: "N",
20
+        ico_favourite: "O",
21
+        ico_profile: "P",
22
+        ico_magnify: "Q",
23
+        ico_comment: "R",
24
+        ico_settings: "S",
25
+        ico_edit: "T",
26
+        ico_email: "U",
27
+        ico_shop_bag: "V",
28
+        ico_logout: "W", 
29
+        ico_heart: "X", 
30
+        ico_rss: "Z", 
31
+        ico_link: "a", 
32
+        ico_fill_down: "b", 
33
+        ico_fill_up: "c", 
34
+        ico_fill_right: "d", 
35
+        ico_fill_left: "e", 
36
+        ico_facebook: "f", 
37
+        ico_twitter: "g", 
38
+        ico_googleplus: "h", 
39
+        ico_blacklist: "i", 
40
+        ico_twitter_bird: "t", 
41
+        ico_twitter_plain: "u", 
42
+        ico_tag: "t", 
43
+        ico_speedo: "y",  
44
+        ico_tangentsnowball: "z"
45
+    },
46
+    init: function() {
47
+        if (!$.browser.msie) return;
48
+        var version = parseInt($.browser.version, 10);
49
+        if (version == 6 || version == 7) {
50
+            $(".app-ico").each(function(){
51
+                var icon = $(this).attr("class").split(/\s/);
52
+                for (var key in snowcone.icons) {
53
+                    if ([key] == icon[1]) {
54
+                        $(this).prepend("<span class='app-legacy_ico'>" + snowcone.icons[key] + "</span>");
55
+                    }
56
+                }
57
+            });
58
+        }
59
+    }
60
+};
2 61
 
3
-function addicons(){
4
-	//Create object with list of icons
5
-		var icons = {
6
-		  ico_alert: "A",
7
-		  ico_cross: "B",
8
-		  outofstock: "B", //cross also used for out of stock items
9
-		  ico_tick: "C",
10
-		  instock: "C", //tick also used for in stock items
11
-			ico_expand: "D",
12
-			ico_contract: "E",
13
-			ico_view: "F",
14
-			ico_sync: "G",
15
-			ico_home: "H",
16
-			ico_outline_down: "I",
17
-			ico_outline_up: "J",
18
-			ico_outline_right: "K",
19
-			ico_outline_left: "L",
20
-			ico_stop: "M",
21
-			ico_mapmarker: "N",
22
-			ico_favourite: "O",
23
-			ico_profile: "P",
24
-			ico_magnify: "Q",
25
-			ico_comment: "R",
26
-			ico_settings: "S",
27
-			ico_edit: "T",
28
-			ico_email: "U",
29
-			ico_shop_bag: "V",
30
-			ico_logout: "W", 
31
-			ico_heart: "X", 
32
-			ico_rss: "Z", 
33
-			ico_link: "a", 
34
-			ico_fill_down: "b", 
35
-			ico_fill_up: "c", 
36
-			ico_fill_right: "d", 
37
-			ico_fill_left: "e", 
38
-			ico_facebook: "f", 
39
-			ico_twitter: "g", 
40
-			ico_googleplus: "h", 
41
-			ico_blacklist: "i", 
42
-			ico_twitter_bird: "t", 
43
-			ico_twitter_plain: "u", 
44
-			ico_tag: "t", 
45
-			ico_speedo: "y",  
46
-			ico_tangentsnowball: "z"
47
-		};
48
-	//Detect IE version	
49
-		var browserver = parseInt($.browser.version, 10)
50
-	
51
-	//Run icon insertion	
52
-		if ($.browser.msie && browserver == 6 || browserver == 7){
53
-			$(".app-ico").each(function(){
54
-				var icon = $(this).attr("class").split(/\s/);
55
-				for(key in icons){
56
-					if([key]==icon[1]){
57
-						$(this).prepend("<span class='app-legacy_ico'>" + icons[key] + "</span>");
58
-					};
59
-				}
60
-			});
61
-		}
62
-}
63
-
64
-//Run function
65
-	$(document).ready(function(){
66
-		addicons();
67
-	});
68
-	
62
+$(function(){
63
+    snowcone.init();
64
+});
65
+    

Загрузка…
Отмена
Сохранить