1
1
<!DOCTYPE html>
2
- <html >
3
- <head >
4
- <title >Style Guide for a Specific Pattern Sub-Type</title >
5
- <meta charset =" UTF-8" >
6
- <meta name =" viewport" content =" width=device-width" />
7
- <link rel =" stylesheet" href =" ../../styleguide/css/styleguide.css" media =" all" />
8
- <link rel =" stylesheet" href =" ../../css/style.css" media =" all" />
9
- </head >
10
- <body class =" pattern-list" >
11
-
12
- <!-- Style Guide Main Content-->
13
- <div class =" sg-main" role =" main" >
14
-
15
- <!-- Patterns-->
16
- <div id =" patterns" >
17
- { {# partials } }
18
- <div class =" sg-pattern" >
19
- <h2 class =" sg-head sg-sub" ><a href =" ../../patterns/{ { patternLink } } " class =" patternLink" data-patternpartial =" { { patternPartialPath } } " >{ { patternName } }</a ></h2 >
20
- { {{ patternPartial } }}
21
- </div >
22
- { {/ partials } }
23
- </div > <!-- end #patterns-->
24
-
25
- </div ><!-- end .sg-main-->
26
- <script >
27
-
28
- // alert the iframe parent that the pattern has loaded. for page follow.
29
- if (self != top) {
30
- var targetOrigin = (window.location.protocol == " file:" ) ? " *" : window.location.protocol+" //" +window.location.host;
31
- parent.postMessage( { " patternpartial" : " { { patternPartial } } " , " path" : window.location.toString() } , targetOrigin);
32
- }
33
-
34
- // if there are clicks on the iframe make sure the nav in the iframe parent closes
35
- var body = document .getElementsByTagName (' body' );
36
- body[0 ].onclick = function () {
37
- var targetOrigin = (window.location.protocol == " file:" ) ? " *" : window.location.protocol+" //" +window.location.host;
38
- parent.postMessage( { " bodyclick" :" bodyclick" } , targetOrigin)
39
- } ;
40
-
41
- // find all links and add an onclick handler for replacing the iframe address so the history works
42
- if (self != top) {
43
- var aTags = document.getElementsByTagName(' a' );
44
- for (a in aTags) {
45
- aTags[a].onclick = function(e) {
46
- e.preventDefault();
47
- window.location.replace(this.getAttribute(" href" ));
48
- } ;
49
- }
50
- }
51
-
52
- // watch the iframe source so that it can be sent back to everyone else.
53
- function receiveIframeMessage (event ) {
2
+ <html id =" patternlab-html" >
3
+ <head id =" patternlab-head" >
4
+ <title >Pattern Lab Sub-type Style Guide</title >
5
+ <meta charset =" UTF-8" >
6
+ <meta name =" viewport" content =" width=device-width" />
7
+ <link rel =" stylesheet" href =" ../../styleguide/css/styleguide.css" media =" all" />
8
+ <link rel =" stylesheet" href =" ../../css/style.css" media =" all" />
9
+ </head >
10
+ <body id =" patternlab-body" class =" pattern-list" >
54
11
55
- // does the origin sending the message match the current host? if not dev/null the request
56
- if ((window.location.protocol != " file:" ) && (event.origin !== window.location.protocol+" //" +window.location.host)) {
57
- return;
58
- }
12
+ <!-- View All Patterns in a Pattern Sub-Type -->
13
+ <div class =" sg-main" role =" main" >
14
+
15
+ <!-- Patterns -->
16
+ <div id =" patterns" >
17
+ { {# partials } }
18
+ <div class =" sg-pattern" >
19
+ <h2 class =" sg-head sg-sub" ><a href =" ../../patterns/{ { patternLink } } " class =" patternLink" data-patternpartial =" { { patternPartialPath } } " >{ { patternName } }</a ></h2 >
20
+ { {{ patternPartial } }}
21
+ </div >
22
+ { {/ partials } }
23
+ </div > <!-- end #patterns-->
24
+
25
+ </div ><!-- end .sg-main-->
59
26
60
- if (event.data.path != undefined) {
61
- var re = /patterns\/(.*)$/;
62
- var path = window.location.protocol+" //" +window.location.host+window.location.pathname.replace(re,' ' )+event.data.path;
63
- window.location.replace(path);
64
- } else if (event.data.reload != undefined) {
65
- window.location.reload();
66
- }
27
+ <!-- JS to hook everything together and do annotations -->
28
+ <script >
29
+ // handle injection of items from PHP
30
+ var patternPartial = " { { patternPartial } } " ;
31
+ var lineage = " " ;
32
+ </script >
33
+ <script src =" ../../styleguide/js/postmessage.js" ></script >
34
+ <script src =" ../../data/annotations.js" ></script >
35
+ <script src =" ../../styleguide/js/annotations-pattern.js" ></script >
67
36
68
- }
69
- window .addEventListener (" message" , receiveIframeMessage, false );
70
-
71
- </script >
72
- <script src =" ../../data/annotations.js" ></script >
73
- <script src =" ../../styleguide/js/annotations-pattern.js" ></script >
74
- </body >
37
+ </body >
75
38
</html >
0 commit comments