Skip to content

Commit

Permalink
Added more documentation on how to use prefix auto-completion.
Browse files Browse the repository at this point in the history
  • Loading branch information
msporny committed Jan 8, 2011
1 parent 6db14f2 commit dc42ca8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ <h1 class="largebutton">Prefix Editor</h1>
<p>The prefix editor allows you to add and remove prefixes from the current
document. To add a prefix, just type the short name, such as "dc" or "foaf"
into the box below and the prefix URL will be automatically filled out for
you if it is known. Press the 'Esc' key to close this editor.</p>
you if it is known. Press the 'Enter' key to add it to the list of
prefixes for the document. Click the '-' icon to remove a prefix.
Press the 'Esc' key to close this editor.</p>
<div id="prefix-list"></div>
<div id="prefix-list-editor"></div>
</div>
Expand All @@ -60,6 +62,8 @@ <h1 class="largebutton">Prefix Editor</h1>
<pre id="code-epilogue">&lt;/html&gt;</pre>
</div>

<div>Hover over the &lt;html> element above to add prefixes to the document.</div>

<img id="triples-loading" style="margin: 2px 2px; float: left; display: none;"
src="loading.gif" />

Expand Down
28 changes: 23 additions & 5 deletions live-loop.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,13 @@

// show and set focus on the prefix editor
//pe.show();
var prefixCount = 0;
for(i in liveloop.vocabs) prefixCount++;
$("#prefix-input").focus();
$("#prefix-editor").modal({maxWidth: ($(document).width() / 4) * 3});
$("#prefix-editor").modal({
maxWidth: ($(document).width() / 4) * 3,
minHeight: 210 + (liveloop.getLineHeight() * prefixCount)
});
};

/**
Expand Down Expand Up @@ -162,6 +167,21 @@
});
}

/**
* Retrieve the standard line height for the page.
*
* @return the standard line height on the page in pixels.
*/
liveloop.getLineHeight = function()
{
var rval = 10;
var div = $('<div style="height: 1em;"></div>').appendTo('body');
var rval = div.height();
div.remove();

return rval;
}

/**
* Performs a check on the prefix editor counter. If the counter hits 0, an
* XMLHttpRequest is sent to the server for processing.
Expand Down Expand Up @@ -192,11 +212,9 @@
$("#prefix-loading").hide();

// adjust the size of the prefix editor
var div = $('<div style="height: 1em;"></div>').appendTo('body');
var em = div.height();
div.remove();
var smcheight = $("#simplemodal-container").height();
$("#simplemodal-container").height(smcheight + 2*em);
$("#simplemodal-container").height(
smcheight + 2 * liveloop.getLineHeight());

// append to the prefix list
liveloop.addPrefixListItem(prefix, resolved);
Expand Down

0 comments on commit dc42ca8

Please sign in to comment.