working on javascript injection
This commit is contained in:
parent
a90cebd373
commit
cacf38d5f8
|
@ -1230,7 +1230,10 @@ if(this['plt'] === undefined) { this['plt'] = {}; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Extensions. A small experiment.
|
|
||||||
|
|
||||||
|
|
||||||
|
// Javascript-specific extensions. A small experiment.
|
||||||
installPrimitiveProcedure(
|
installPrimitiveProcedure(
|
||||||
'viewport-width',
|
'viewport-width',
|
||||||
0,
|
0,
|
||||||
|
|
|
@ -6,9 +6,23 @@
|
||||||
racket/sandbox
|
racket/sandbox
|
||||||
(for-label racket/base)
|
(for-label racket/base)
|
||||||
racket/runtime-path
|
racket/runtime-path
|
||||||
|
"scribble-helpers.rkt"
|
||||||
"../js-assembler/get-js-vm-implemented-primitives.rkt")
|
"../js-assembler/get-js-vm-implemented-primitives.rkt")
|
||||||
|
|
||||||
|
|
||||||
|
@inject-javascript|{
|
||||||
|
var _gaq = _gaq || [];
|
||||||
|
_gaq.push(['_setAccount', 'UA-24146890-1']);
|
||||||
|
_gaq.push(['_trackPageview']);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||||
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||||
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||||
|
})();
|
||||||
|
}|
|
||||||
|
|
||||||
|
|
||||||
@(define-runtime-path whalesong-path "..")
|
@(define-runtime-path whalesong-path "..")
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,6 +40,14 @@
|
||||||
@author+email["Danny Yoo" "dyoo@cs.wpi.edu"]
|
@author+email["Danny Yoo" "dyoo@cs.wpi.edu"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@centered{@smaller{Source code can be found at:
|
||||||
|
@url{https://github.com/dyoo/whalesong}. The latest version of this
|
||||||
|
document lives in @url{http://hashcollision.org/whalesong}.}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
@;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@; Warning Will Robinson, Warning!
|
@; Warning Will Robinson, Warning!
|
||||||
@;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
@;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@ -35,6 +57,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
@;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@section{Introduction}
|
@section{Introduction}
|
||||||
@;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
@;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@ -442,7 +466,7 @@ time of this writing, it does NOT check for cycles.
|
||||||
|
|
||||||
|
|
||||||
@subsection{Vectors}
|
@subsection{Vectors}
|
||||||
Vectors can be constructed with @{plt.runtime.makeVector(x ...)}, which takes
|
Vectors can be constructed with @tt{plt.runtime.makeVector(x ...)}, which takes
|
||||||
in any number of arguments. They can be tested with @tt{plt.runtime.isVector},
|
in any number of arguments. They can be tested with @tt{plt.runtime.isVector},
|
||||||
and support the following methods and attributes:
|
and support the following methods and attributes:
|
||||||
@itemlist[
|
@itemlist[
|
||||||
|
|
20
scribblings/scribble-helpers.rkt
Normal file
20
scribblings/scribble-helpers.rkt
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#lang racket/base
|
||||||
|
|
||||||
|
(provide inject-javascript)
|
||||||
|
|
||||||
|
(require scribble/core
|
||||||
|
scribble/html-properties
|
||||||
|
scriblib/render-cond)
|
||||||
|
|
||||||
|
;; Adds JavaScript if we're rendering in HTML.
|
||||||
|
(define (inject-javascript . body)
|
||||||
|
(cond-element
|
||||||
|
[latex ""]
|
||||||
|
[html (make-element (make-style #f (list (make-script-property "text/javascript"
|
||||||
|
body)))
|
||||||
|
'())]
|
||||||
|
[text ""]))
|
||||||
|
|
||||||
|
|
||||||
|
;;(define (google-analytics)
|
||||||
|
;; (make-tag
|
Loading…
Reference in New Issue
Block a user