Permalink
Browse files

some code for driving a lite from the surrounding "text"

  • Loading branch information...
1 parent 889d727 commit f1976381639f1c5927599a5a6746c626181e7cab @cognominal committed Jul 6, 2012
Showing with 34 additions and 8 deletions.
  1. +1 −0 .#talk
  2. +6 −0 css/zbrew.css
  3. +5 −0 i.html
  4. +14 −5 js/LiteViewport.js
  5. +8 −3 src/LiteViewport.coffee
View
1 .#talk
View
@@ -1,3 +1,9 @@
+.liteRegex { color: #000080; }
+.liteRegex:hover { color: #0000FF; }
+.liteText { color: #000080; }
+.liteText:hover { color: #0000FF; }
+
+
.liteViewport {
border-width: 2px;
border-color : #A0A0A0;
View
5 i.html
@@ -1,6 +1,7 @@
<!doctype html>
<html>
<head>
+
<title>Code Hiliter Early </title>
<link rel="stylesheet" type="text/css" href="css/zbrew.css"/>
<script type="text/javascript" src="js/jquery.js"></script>
@@ -27,5 +28,9 @@
<div id="viewport-dh"></div>
<div class="text">The second portview shows how json is parsed used a Perl 6 grammar. We note a problem when hovering over 666. I don't know how to select a rule after its longname. So using the short name, there is ambiguity and we
peek the wrong rule</div>
+
+This directive will hilite the string <span class="liteText" data='"name"'>"name"</span> and DH stuff in the associate lite accordingly. Need to think escaping in data, and textual representation to generate this directive.
+
+
<div id="viewport-parsed"></div>
</body>
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -88,8 +88,11 @@ $ ->
lSel = liteSel elt
toggleLiteViewport lSel
- $(".parsePathItem").live 'vmouseover', (ev) ->
+ $(".liteText").live 'vmouseover', (ev) ->
elt = ev.currentTarget
+ data = $(elt).attr 'data'
+ re = new RegExp data
+ consol.log $ "#{litePane('parsed','codePane')}"
$(".parsePathSubitem").live 'vmouseover', (ev) ->
return unless dynamicHiliteP
@@ -124,14 +127,16 @@ $ ->
# A viewport is constituted of panes.
# Each pane of a viewport (including the view port) has an html id of the form
# "paneName-viewPortSpecificSuffix". Each pane has a unique `paneName` within a viewport.
-# so far we have only one viewport type which is "liteViewPort".
+# so far we have only one viewport type which is "liteViewport".
# get the css selector for a pane named `paneNm` that is a parent of `elt`
- paneSel = (elt, paneNm) -> "##{paneNm}-#{liteNm elt}"
+ paneSel = (elt, paneNm = 'liteViewport') ->
+ "##{paneNm}-#{ if typeof elt eq 'string' then elt else liteNm elt}"
liteId = (elt) -> $(elt).parents().add($(elt)).filter(".liteViewport").attr('id')
liteNm = (elt) -> /-(\w+)$/.exec(liteId elt)[1]
liteSel = (elt) -> paneSel elt, 'liteViewport'
+ litePane = (liteNm, paneNm) -> $("#liteViewport-#{liteNm} .#{paneNm}")[0]
# given an `elt`, extract the associated rule name
# from the class name of the form rule-*.

0 comments on commit f197638

Please sign in to comment.