This repository has been archived by the owner on Dec 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
108 additions
and
8 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Element Preview</title> | ||
|
||
<script src="../../components/platform/platform.js"></script> | ||
<link rel="import" href="x-gist-element-preview.html"> | ||
|
||
<style> | ||
|
||
body, html { | ||
margin: 0; | ||
height: 100%; | ||
} | ||
|
||
x-gist-element-preview { | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
} | ||
|
||
</style> | ||
|
||
</head> | ||
<body unresolved> | ||
|
||
<x-gist-element-preview id="preview"></x-gist-element-preview> | ||
<script> | ||
addEventListener('polymer-ready', function() { | ||
var fileId = window.location.hash.replace('#', '') | ||
document.getElementById('preview').open(fileId); | ||
}) | ||
|
||
</script> | ||
|
||
</body> | ||
</html> |
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,42 @@ | ||
<!-- | ||
Copyright 2013 The Polymer Authors. All rights reserved. | ||
Use of this source code is governed by a BSD-style | ||
license that can be found in the LICENSE file. | ||
--> | ||
|
||
<link rel="import" href="x-preview.html"> | ||
<link rel="import" href="x-github-info.html"> | ||
<link rel="import" href="../../components/github-elements/github-elements.html"> | ||
|
||
<polymer-element name="x-gist-element-preview" extends="x-preview-iframe"> | ||
<template> | ||
<github-element id="github" token="{{token}}" on-files-loaded="{{documentLoaded}}" on-token-changed="{{tokenChangeHandler}}"></github-element> | ||
<x-github-info id="info" token="{{token}}"></x-github-info> | ||
<shadow></shadow> | ||
</template> | ||
<script> | ||
|
||
(function() { | ||
|
||
Polymer('x-gist-element-preview', { | ||
|
||
open: function(id) { | ||
this.$.github.load(id); | ||
}, | ||
|
||
documentLoaded: function(e, detail) { | ||
var doc = detail && detail[this.$.info.fileName]; | ||
var re = /<polymer-element[^>]*name=(?:'|")([^'"]*)(?:'|")/; | ||
var match = doc && doc.content && doc.content.match(re); | ||
if (match) { | ||
var name = match[1]; | ||
this.htmlContent = doc.content + '\n\n<' + name +'></' + name + '>'; | ||
} | ||
} | ||
|
||
}); | ||
|
||
})(); | ||
|
||
</script> | ||
</polymer-element> |
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 @@ | ||
<!-- | ||
Copyright 2013 The Polymer Authors. All rights reserved. | ||
Use of this source code is governed by a BSD-style | ||
license that can be found in the LICENSE file. | ||
--> | ||
|
||
<polymer-element name="x-github-info" attributes="fileName user token"> | ||
<script> | ||
|
||
Polymer('x-github-info', { | ||
|
||
fileName: 'designer.html', | ||
user: 'designer-polymer', | ||
token: '77777d8808da580cd6134b7390b5fd306c66d1d6' | ||
|
||
}); | ||
|
||
</script> | ||
</polymer-element> |
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