docs: Move example *.js and *.js.map files to another repository

This commit is contained in:
Hajime Hoshi 2015-01-10 00:38:17 +09:00
parent d96de18074
commit e7599a6d85
27 changed files with 208 additions and 428 deletions

2
_docs/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
public/example/*.js
public/example/*.js.map

View File

@ -1,3 +1,25 @@
<!DOCTYPE html> <!DOCTYPE html>
{{comment .License}} {{comment .License}}
<script src="{{.Example.Name}}.js"></script> <script>
'use strict';
window.addEventListener('load', function() {
function isProduction() {
var l = window.top.location;
if (l.hash === '#_production') {
return true;
}
if (l.hostname === 'localhost' || l.hostname === '127.0.0.1') {
return false;
}
return true;
}
var s = document.createElement('script');
var src = '{{.Example.Name}}.js';
if (isProduction()) {
src = 'http://hajimehoshi.github.io/ebiten.pagestorage/{{.CurrentBranch}}/' + src;
}
s.src = src;
document.body.appendChild(s);
});
</script>

View File

@ -55,7 +55,6 @@ func init() {
} }
var stableVersion = "" var stableVersion = ""
var devVersion = "" var devVersion = ""
func init() { func init() {
@ -66,6 +65,15 @@ func init() {
stableVersion = strings.TrimSpace(string(b)) stableVersion = strings.TrimSpace(string(b))
} }
func currentBranch() string {
r, err := ioutil.ReadFile("../.git/HEAD")
if err != nil {
panic(err)
}
rr := strings.TrimSpace(string(r))
return regexp.MustCompile(`^ref: refs/heads/(.+)$`).FindStringSubmatch(rr)[1]
}
func init() { func init() {
b, err := exec.Command("git", "show", "master:version.txt").Output() b, err := exec.Command("git", "show", "master:version.txt").Output()
if err != nil { if err != nil {
@ -217,9 +225,10 @@ func outputExampleContent(e *example) error {
} }
data := map[string]interface{}{ data := map[string]interface{}{
"License": license, "License": license,
"Copyright": copyright, "Copyright": copyright,
"Example": e, "CurrentBranch": currentBranch(),
"Example": e,
} }
if err := t.Funcs(funcs).Execute(f, data); err != nil { if err := t.Funcs(funcs).Execute(f, data); err != nil {
return err return err

View File

@ -35,7 +35,7 @@ pre {
</ul> </ul>
</li> </li>
<li><a href="http://godoc.org/github.com/hajimehoshi/ebiten">API Docs</a></li> <li><a href="http://godoc.org/github.com/hajimehoshi/ebiten">API Docs</a></li>
<li><a href="http://github.com/hajimehoshi/ebiten">Source Code</a> (Development version: v{{.DevVersion}})</li> <li><a href="http://github.com/hajimehoshi/ebiten">GitHub project page</a> (Development version: v{{.DevVersion}})</li>
</ul> </ul>
<h2>Features</h2> <h2>Features</h2>

View File

@ -14,4 +14,26 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<script src="blocks.js"></script> <script>
'use strict';
window.addEventListener('load', function() {
function isProduction() {
var l = window.top.location;
if (l.hash === '#_production') {
return true;
}
if (l.hostname === 'localhost' || l.hostname === '127.0.0.1') {
return false;
}
return true;
}
var s = document.createElement('script');
var src = 'blocks.js';
if (isProduction()) {
src = 'http://hajimehoshi.github.io/ebiten.pagestorage/master/' + src;
}
s.src = src;
document.body.appendChild(s);
});
</script>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -14,4 +14,26 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<script src="hue.js"></script> <script>
'use strict';
window.addEventListener('load', function() {
function isProduction() {
var l = window.top.location;
if (l.hash === '#_production') {
return true;
}
if (l.hostname === 'localhost' || l.hostname === '127.0.0.1') {
return false;
}
return true;
}
var s = document.createElement('script');
var src = 'hue.js';
if (isProduction()) {
src = 'http://hajimehoshi.github.io/ebiten.pagestorage/master/' + src;
}
s.src = src;
document.body.appendChild(s);
});
</script>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -14,4 +14,26 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<script src="keyboard.js"></script> <script>
'use strict';
window.addEventListener('load', function() {
function isProduction() {
var l = window.top.location;
if (l.hash === '#_production') {
return true;
}
if (l.hostname === 'localhost' || l.hostname === '127.0.0.1') {
return false;
}
return true;
}
var s = document.createElement('script');
var src = 'keyboard.js';
if (isProduction()) {
src = 'http://hajimehoshi.github.io/ebiten.pagestorage/master/' + src;
}
s.src = src;
document.body.appendChild(s);
});
</script>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -14,4 +14,26 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<script src="mosaic.js"></script> <script>
'use strict';
window.addEventListener('load', function() {
function isProduction() {
var l = window.top.location;
if (l.hash === '#_production') {
return true;
}
if (l.hostname === 'localhost' || l.hostname === '127.0.0.1') {
return false;
}
return true;
}
var s = document.createElement('script');
var src = 'mosaic.js';
if (isProduction()) {
src = 'http://hajimehoshi.github.io/ebiten.pagestorage/master/' + src;
}
s.src = src;
document.body.appendChild(s);
});
</script>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -14,4 +14,26 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<script src="paint.js"></script> <script>
'use strict';
window.addEventListener('load', function() {
function isProduction() {
var l = window.top.location;
if (l.hash === '#_production') {
return true;
}
if (l.hostname === 'localhost' || l.hostname === '127.0.0.1') {
return false;
}
return true;
}
var s = document.createElement('script');
var src = 'paint.js';
if (isProduction()) {
src = 'http://hajimehoshi.github.io/ebiten.pagestorage/master/' + src;
}
s.src = src;
document.body.appendChild(s);
});
</script>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -14,4 +14,26 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<script src="perspective.js"></script> <script>
'use strict';
window.addEventListener('load', function() {
function isProduction() {
var l = window.top.location;
if (l.hash === '#_production') {
return true;
}
if (l.hostname === 'localhost' || l.hostname === '127.0.0.1') {
return false;
}
return true;
}
var s = document.createElement('script');
var src = 'perspective.js';
if (isProduction()) {
src = 'http://hajimehoshi.github.io/ebiten.pagestorage/master/' + src;
}
s.src = src;
document.body.appendChild(s);
});
</script>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -14,4 +14,26 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<script src="rotate.js"></script> <script>
'use strict';
window.addEventListener('load', function() {
function isProduction() {
var l = window.top.location;
if (l.hash === '#_production') {
return true;
}
if (l.hostname === 'localhost' || l.hostname === '127.0.0.1') {
return false;
}
return true;
}
var s = document.createElement('script');
var src = 'rotate.js';
if (isProduction()) {
src = 'http://hajimehoshi.github.io/ebiten.pagestorage/master/' + src;
}
s.src = src;
document.body.appendChild(s);
});
</script>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -49,7 +49,7 @@ pre {
</ul> </ul>
</li> </li>
<li><a href="http://godoc.org/github.com/hajimehoshi/ebiten">API Docs</a></li> <li><a href="http://godoc.org/github.com/hajimehoshi/ebiten">API Docs</a></li>
<li><a href="http://github.com/hajimehoshi/ebiten">Source Code</a> (Development version: v1.1.0-alpha)</li> <li><a href="http://github.com/hajimehoshi/ebiten">GitHub project page</a> (Development version: v1.1.0-alpha)</li>
</ul> </ul>
<h2>Features</h2> <h2>Features</h2>

View File

@ -62,13 +62,14 @@ func SwapBuffers() {
} }
func init() { func init() {
ch := make(chan struct{})
js.Global.Get("window").Set("onload", func() {
close(ch)
})
<-ch
doc := js.Global.Get("document") doc := js.Global.Get("document")
if doc.Get("body") == nil {
ch := make(chan struct{})
js.Global.Get("window").Call("addEventListener", "load", func() {
close(ch)
})
<-ch
}
doc.Set("onkeydown", func(e js.Object) bool { doc.Set("onkeydown", func(e js.Object) bool {
code := e.Get("keyCode").Int() code := e.Get("keyCode").Int()
// Backspace // Backspace