Commit 0d07ebc9 by David Ormsbee

Merge branch 'master' into move_settings

Conflicts:
	static/simplewiki
parents 29b3b0cf 6c44d00a
......@@ -169,7 +169,7 @@ def grade_summary_6002x(totaled_scores):
homework_percentages = []
for i in range(12):
if i < len(homework_scores):
percentage = homework_scores[1].earned / float(homework_scores[i].possible)
percentage = homework_scores[i].earned / float(homework_scores[i].possible)
summary = "Homework {0} - {1} - {2:.0%} ({3:g}/{4:g})".format( i + 1, homework_scores[i].section , percentage, homework_scores[i].earned, homework_scores[i].possible )
else:
percentage = 0
......
......@@ -73,7 +73,9 @@ class Module(XModule):
content={'name':self.name,
'html':html}
check_button = True
# We using strings as truthy values, because the terminology of the check button
# is context-specific.
check_button = "Grade" if self.max_attempts else "Check"
reset_button = True
save_button = True
......@@ -96,10 +98,6 @@ class Module(XModule):
if not self.lcp.done:
reset_button = False
attempts_str = ""
if self.max_attempts != None:
attempts_str = " ({a}/{m})".format(a=self.attempts, m=self.max_attempts)
# We don't need a "save" button if infinite number of attempts and non-randomized
if self.max_attempts == None and self.rerandomize != "always":
save_button = False
......@@ -122,7 +120,8 @@ class Module(XModule):
'save_button' : save_button,
'answer_available' : self.answer_available(),
'ajax_url' : self.ajax_url,
'attempts': attempts_str,
'attempts_used': self.attempts,
'attempts_allowed': self.max_attempts,
'explain': explain
})
if encapsulate:
......
......@@ -3,14 +3,24 @@
Image Circuit Extension for Python-Markdown
======================================
circuit:name becomes the circuit.
Any single line beginning with circuit-schematic: and followed by data (which should be json data, but this
is not enforced at this level) will be displayed as a circuit schematic. This is simply an input element with
the value set to the data. It is left to javascript on the page to render that input as a circuit schematic.
ex:
circuit-schematic:[["r",[128,48,0],{"r":"1","_json_":0},["2","1"]],["view",0,0,2,null,null,null,null,null,null,null],["dc",{"0":0,"1":1,"I(_3)":-1}]]
(This is a schematic with a single one-ohm resistor. Note that this data is not meant to be user-editable.)
'''
import markdown
import re
import simplewiki.settings as settings
from mitxmako.shortcuts import render_to_response, render_to_string
from django.utils.html import escape
import markdown
try:
# Markdown 2.1.0 changed from 2.0.3. We try importing the new version first,
# but import the 2.0.3 version if it fails
......@@ -22,23 +32,40 @@ class CircuitExtension(markdown.Extension):
def __init__(self, configs):
for key, value in configs :
self.setConfig(key, value)
def add_inline(self, md, name, klass, re):
pattern = klass(re)
def extendMarkdown(self, md, md_globals):
## Because Markdown treats contigous lines as one block of text, it is hard to match
## a regex that must occupy the whole line (like the circuit regex). This is why we have
## a preprocessor that inspects the lines and replaces the matched lines with text that is
## easier to match
md.preprocessors.add('circuit', CircuitPreprocessor(md), "_begin")
pattern = CircuitLink(r'processed-schematic:(?P<data>.*?)processed-schematic-end')
pattern.md = md
pattern.ext = self
md.inlinePatterns.add(name, pattern, "<reference")
md.inlinePatterns.add('circuit', pattern, "<reference")
class CircuitPreprocessor(markdown.preprocessors.Preprocessor):
preRegex = re.compile(r'^circuit-schematic:(?P<data>.*)$')
def extendMarkdown(self, md, md_globals):
self.add_inline(md, 'circuit', CircuitLink, r'^circuit:(?P<name>[a-zA-Z0-9]*)$')
def run(self, lines):
def convertLine(line):
m = self.preRegex.match(line)
if m:
return 'processed-schematic:{0}processed-schematic-end'.format( m.group('data') )
else:
return line
return [ convertLine(line) for line in lines ]
class CircuitLink(markdown.inlinepatterns.Pattern):
def handleMatch(self, m):
name = m.group('name')
if not name.isalnum():
return etree.fromstring("<div>Circuit name must be alphanumeric</div>")
return etree.fromstring(render_to_string('show_circuit.html', {'name':name}))
data = m.group('data')
data = escape(data)
return etree.fromstring("<div align='center'><input type='hidden' parts='' value='" + data + "' analyses='' class='schematic ctrls' width='500' height='300'/></div>")
def makeExtension(configs=None) :
......
/*
================================================
autosuggest, inquisitor style
================================================
*/
body
{
position: relative;
}
div.autosuggest
{
position: absolute;
background-image: url(img_inquisitor/as_pointer.gif);
background-position: top;
background-repeat: no-repeat;
padding: 10px 0 0 0;
}
div.autosuggest div.as_header,
div.autosuggest div.as_footer
{
position: relative;
height: 6px;
padding: 0 6px;
background-image: url(img_inquisitor/ul_corner_tr.gif);
background-position: top right;
background-repeat: no-repeat;
overflow: hidden;
}
div.autosuggest div.as_footer
{
background-image: url(img_inquisitor/ul_corner_br.gif);
}
div.autosuggest div.as_header div.as_corner,
div.autosuggest div.as_footer div.as_corner
{
position: absolute;
top: 0;
left: 0;
height: 6px;
width: 6px;
background-image: url(img_inquisitor/ul_corner_tl.gif);
background-position: top left;
background-repeat: no-repeat;
}
div.autosuggest div.as_footer div.as_corner
{
background-image: url(img_inquisitor/ul_corner_bl.gif);
}
div.autosuggest div.as_header div.as_bar,
div.autosuggest div.as_footer div.as_bar
{
height: 6px;
overflow: hidden;
background-color: #333;
}
div.autosuggest ul
{
list-style: none;
margin: 0 0 -4px 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
div.autosuggest ul li
{
color: #ccc;
padding: 0;
margin: 0 4px 4px;
text-align: left;
}
div.autosuggest ul li a
{
color: #ccc;
display: block;
text-decoration: none;
background-color: transparent;
text-shadow: #000 0px 0px 5px;
position: relative;
padding: 0;
width: 100%;
}
div.autosuggest ul li a:hover
{
background-color: #444;
}
div.autosuggest ul li.as_highlight a:hover
{
background-color: #1B5CCD;
}
div.autosuggest ul li a span
{
display: block;
padding: 3px 6px;
font-weight: bold;
}
div.autosuggest ul li a span small
{
font-weight: normal;
color: #999;
}
div.autosuggest ul li.as_highlight a span small
{
color: #ccc;
}
div.autosuggest ul li.as_highlight a
{
color: #fff;
background-color: #1B5CCD;
background-image: url(img_inquisitor/hl_corner_br.gif);
background-position: bottom right;
background-repeat: no-repeat;
}
div.autosuggest ul li.as_highlight a span
{
background-image: url(img_inquisitor/hl_corner_bl.gif);
background-position: bottom left;
background-repeat: no-repeat;
}
div.autosuggest ul li a .tl,
div.autosuggest ul li a .tr
{
background-image: transparent;
background-repeat: no-repeat;
width: 6px;
height: 6px;
position: absolute;
top: 0;
padding: 0;
margin: 0;
}
div.autosuggest ul li a .tr
{
right: 0;
}
div.autosuggest ul li.as_highlight a .tl
{
left: 0;
background-image: url(img_inquisitor/hl_corner_tl.gif);
background-position: bottom left;
}
div.autosuggest ul li.as_highlight a .tr
{
right: 0;
background-image: url(img_inquisitor/hl_corner_tr.gif);
background-position: bottom right;
}
div.autosuggest ul li.as_warning
{
font-weight: bold;
text-align: center;
}
div.autosuggest ul em
{
font-style: normal;
color: #6EADE7;
}
\ No newline at end of file
body
{
font-family: 'Lucida Sans', 'Sans';
}
a img
{
border: 0;
}
div#wiki_article a {
color: #06d;
text-decoration: none;
}
div#wiki_article a:hover {
color: #f82;
text-decoration: underline;
}
hr
{
background-color: #def;
height: 2px;
border: 0;
}
div#wiki_article .toc a
{
color: #025
}
div#wiki_article p
{
/* font-size: 90%; looks funny when combined with lists/tables */
line-height: 140%;
}
div#wiki_article h1
{
font-size: 200%;
font-weight: normal;
color: #048;
}
div#wiki_article h2
{
font-size: 150%;
font-weight: normal;
color: #025;
}
div#wiki_article h3
{
font-size: 120%;
font-weight: bold;
color: #000;
}
table
{
border: 1px solid black;
border-collapse: collapse;
margin: 12px;
}
table tr.dark
{
background-color: #F3F3F3;
}
table thead tr
{
background-color: #def;
border-bottom: 2px solid black;
}
table td, th
{
padding: 6px 10px 6px 10px;
border: 1px solid black;
}
table thead th
{
padding-bottom: 8px;
padding-top: 8px;
}
div#wiki_panel
{
float: right;
}
div.wiki_box
{
width: 230px;
padding: 10px;
color: #fff;
font-size: 80%;
}
div.wiki_box div.wiki_box_contents
{ background-color: #222;
padding: 5px 10px;}
div.wiki_box div.wiki_box_header,
div.wiki_box div.wiki_box_footer
{
position: relative;
height: 6px;
padding: 0 6px;
background-image: url(../img/box_corner_tr.gif);
background-position: top right;
background-repeat: no-repeat;
overflow: hidden;
}
div.wiki_box div.wiki_box_footer
{
background-image: url(../img/box_corner_br.gif);
}
div.wiki_box div.wiki_box_header div.wiki_box_corner,
div.wiki_box div.wiki_box_footer div.wiki_box_corner
{
position: absolute;
top: 0;
left: 0;
height: 6px;
width: 6px;
background-image: url(../img/box_corner_tl.gif);
background-position: top left;
background-repeat: no-repeat;
}
div.wiki_box div.wiki_box_footer div.wiki_box_corner
{
background-image: url(../img/box_corner_bl.gif);
}
div.wiki_box div.wiki_box_header div.wiki_box_bar,
div.wiki_box div.wiki_box_footer div.wiki_box_bar
{
height: 6px;
overflow: hidden;
background-color: #222;
}
div.wiki_box a
{
color: #acf;
}
div.wiki_box p
{
margin: 5px 0;
}
div.wiki_box ul
{
padding-left: 20px;
margin-left: 0;
}
div.wiki_box div.wiki_box_title
{
margin-bottom: 5px;
font-size: 140%;
}
form#wiki_revision #id_contents
{
width:500px;
height: 400px;
font-family: monospace;
}
form#wiki_revision #id_title
{
width: 500px;
}
form#wiki_revision #id_revision_text
{
width: 500px;
}
table#wiki_revision_table
{
border: none;
border-collapse: collapse;
padding-right: 250px;
}
table#wiki_revision_table th
{
border: none;
text-align: left;
vertical-align: top;
}
table#wiki_revision_table td
{
border: none;
}
table#wiki_history_table
{
border-collapse: collapse;
border-spacing: 0;
padding-right: 250px;
}
table#wiki_history_table th#modified
{
width: 220px;
}
table#wiki_history_table td
{
border: none;
}
table#wiki_history_table tbody tr
{
border-bottom: 1px solid black;
}
table#wiki_history_table tbody td
{
vertical-align: top;
padding: 5px;
}
table#wiki_history_table tfoot td
{
border: none;
}
table#wiki_history_table tbody td.diff
{
font-family: monospace;
overflow: hidden;
border-left: 1px dotted black;
border-right: 1px dotted black;
}
table#wiki_history_table th
{
text-align: left;
}
div#wiki_attach_progress_container
{
background-color: #333;
width: 100%;
height: 20px;
display: none;
}
div#wiki_attach_progress
{
width: 25%;
background-color: #999;
}
blockquote {
margin-top: 15px;
margin-bottom: 15px;
margin-left: 50px;
padding-left: 15px;
border-left: 3px solid #666;
color: #999;
max-width: 400px ;
}
blockquote p {
margin-top: 8px;
margin-bottom: 8px;
}
......@@ -276,7 +276,6 @@ class Revision(models.Model):
# Create pre-parsed contents - no need to parse on-the-fly
ext = WIKI_MARKDOWN_EXTENSIONS
ext += ["wikipath(base_url=%s)" % reverse('wiki_view', args=('/',))]
print ext
self.contents_parsed = markdown(self.contents,
extensions=ext,
safe_mode='escape',)
......
......@@ -154,10 +154,11 @@ def create(request, wiki_url):
d = {'wiki_form': f,
'wiki_write': True,
'create_article' : True,
}
d.update(csrf(request))
return render_to_response('simplewiki_create.html', d)
return render_to_response('simplewiki_edit.html', d)
def edit(request, wiki_url):
if not request.user.is_authenticated():
......@@ -207,6 +208,7 @@ def edit(request, wiki_url):
'wiki_article': article,
'wiki_title' : article.title,
'wiki_attachments_write': article.can_attach(request.user),
'create_article' : False,
}
d.update(csrf(request))
......
......@@ -65,6 +65,7 @@ task :package do
"--depends=python-markdown",
"--depends=python-pygments",
"--depends=mysql-client",
"--provides=#{PACKAGE_NAME}",
"--name=#{DEPLOY_NAME}",
"--version=#{VERSION}",
"-a", "all",
......
......@@ -12,8 +12,8 @@ DEFAULT_GROUPS = []
STATIC_GRAB = False
DEV_CONTENT = True
LIB_URL = '/static/lib/'
LIB_URL = 'https://mitxstatic.s3.amazonaws.com/js/'
LIB_URL = '/static/js/'
# LIB_URL = 'https://mitxstatic.s3.amazonaws.com/js/' # No longer using S3 for this
BOOK_URL = '/static/book/'
BOOK_URL = 'https://mitxstatic.s3.amazonaws.com/book_images/'
......
This source diff could not be displayed because it is too large. You can view the blob instead.
.CodeMirror {
line-height: 1em;
font-family: monospace;
}
.CodeMirror-scroll {
overflow: auto;
height: 300px;
/* This is needed to prevent an IE[67] bug where the scrolled content
is visible outside of the scrolling box. */
position: relative;
outline: none;
}
.CodeMirror-gutter {
position: absolute; left: 0; top: 0;
z-index: 10;
background-color: #f7f7f7;
border-right: 1px solid #eee;
min-width: 2em;
height: 100%;
}
.CodeMirror-gutter-text {
color: #aaa;
text-align: right;
padding: .4em .2em .4em .4em;
white-space: pre !important;
}
.CodeMirror-lines {
padding: .4em;
white-space: pre;
}
.CodeMirror pre {
-moz-border-radius: 0;
-webkit-border-radius: 0;
-o-border-radius: 0;
border-radius: 0;
border-width: 0; margin: 0; padding: 0; background: transparent;
font-family: inherit;
font-size: inherit;
padding: 0; margin: 0;
white-space: pre;
word-wrap: normal;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;
}
.CodeMirror-wrap .CodeMirror-scroll {
overflow-x: hidden;
}
.CodeMirror textarea {
outline: none !important;
}
.CodeMirror pre.CodeMirror-cursor {
z-index: 10;
position: absolute;
visibility: hidden;
border-left: 1px solid black;
border-right:none;
width:0;
}
.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
.CodeMirror-focused pre.CodeMirror-cursor {
visibility: visible;
}
div.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused div.CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-searching {
background: #ffa;
background: rgba(255, 255, 0, .4);
}
/* Default theme */
.cm-s-default span.cm-keyword {color: #708;}
.cm-s-default span.cm-atom {color: #219;}
.cm-s-default span.cm-number {color: #164;}
.cm-s-default span.cm-def {color: #00f;}
.cm-s-default span.cm-variable {color: black;}
.cm-s-default span.cm-variable-2 {color: #05a;}
.cm-s-default span.cm-variable-3 {color: #085;}
.cm-s-default span.cm-property {color: black;}
.cm-s-default span.cm-operator {color: black;}
.cm-s-default span.cm-comment {color: #a50;}
.cm-s-default span.cm-string {color: #a11;}
.cm-s-default span.cm-string-2 {color: #f50;}
.cm-s-default span.cm-meta {color: #555;}
.cm-s-default span.cm-error {color: #f00;}
.cm-s-default span.cm-qualifier {color: #555;}
.cm-s-default span.cm-builtin {color: #30a;}
.cm-s-default span.cm-bracket {color: #cc7;}
.cm-s-default span.cm-tag {color: #170;}
.cm-s-default span.cm-attribute {color: #00c;}
.cm-s-default span.cm-header {color: #a0a;}
.cm-s-default span.cm-quote {color: #090;}
.cm-s-default span.cm-hr {color: #999;}
.cm-s-default span.cm-link {color: #00c;}
span.cm-header, span.cm-strong {font-weight: bold;}
span.cm-em {font-style: italic;}
span.cm-emstrong {font-style: italic; font-weight: bold;}
span.cm-link {text-decoration: underline;}
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
This source diff could not be displayed because it is too large. You can view the blob instead.
CodeMirror.defineMode("xml", function(config, parserConfig) {
var indentUnit = config.indentUnit;
var Kludges = parserConfig.htmlMode ? {
autoSelfClosers: {"br": true, "img": true, "hr": true, "link": true, "input": true,
"meta": true, "col": true, "frame": true, "base": true, "area": true},
doNotIndent: {"pre": true},
allowUnquoted: true,
allowMissing: false
} : {autoSelfClosers: {}, doNotIndent: {}, allowUnquoted: false, allowMissing: false};
var alignCDATA = parserConfig.alignCDATA;
// Return variables for tokenizers
var tagName, type;
function inText(stream, state) {
function chain(parser) {
state.tokenize = parser;
return parser(stream, state);
}
var ch = stream.next();
if (ch == "<") {
if (stream.eat("!")) {
if (stream.eat("[")) {
if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
else return null;
}
else if (stream.match("--")) return chain(inBlock("comment", "-->"));
else if (stream.match("DOCTYPE", true, true)) {
stream.eatWhile(/[\w\._\-]/);
return chain(doctype(1));
}
else return null;
}
else if (stream.eat("?")) {
stream.eatWhile(/[\w\._\-]/);
state.tokenize = inBlock("meta", "?>");
return "meta";
}
else {
type = stream.eat("/") ? "closeTag" : "openTag";
stream.eatSpace();
tagName = "";
var c;
while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
state.tokenize = inTag;
return "tag";
}
}
else if (ch == "&") {
var ok;
if (stream.eat("#")) {
if (stream.eat("x")) {
ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
} else {
ok = stream.eatWhile(/[\d]/) && stream.eat(";");
}
} else {
ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
}
return ok ? "atom" : "error";
}
else {
stream.eatWhile(/[^&<]/);
return null;
}
}
function inTag(stream, state) {
var ch = stream.next();
if (ch == ">" || (ch == "/" && stream.eat(">"))) {
state.tokenize = inText;
type = ch == ">" ? "endTag" : "selfcloseTag";
return "tag";
}
else if (ch == "=") {
type = "equals";
return null;
}
else if (/[\'\"]/.test(ch)) {
state.tokenize = inAttribute(ch);
return state.tokenize(stream, state);
}
else {
stream.eatWhile(/[^\s\u00a0=<>\"\'\/?]/);
return "word";
}
}
function inAttribute(quote) {
return function(stream, state) {
while (!stream.eol()) {
if (stream.next() == quote) {
state.tokenize = inTag;
break;
}
}
return "string";
};
}
function inBlock(style, terminator) {
return function(stream, state) {
while (!stream.eol()) {
if (stream.match(terminator)) {
state.tokenize = inText;
break;
}
stream.next();
}
return style;
};
}
function doctype(depth) {
return function(stream, state) {
var ch;
while ((ch = stream.next()) != null) {
if (ch == "<") {
state.tokenize = doctype(depth + 1);
return state.tokenize(stream, state);
} else if (ch == ">") {
if (depth == 1) {
state.tokenize = inText;
break;
} else {
state.tokenize = doctype(depth - 1);
return state.tokenize(stream, state);
}
}
}
return "meta";
};
}
var curState, setStyle;
function pass() {
for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]);
}
function cont() {
pass.apply(null, arguments);
return true;
}
function pushContext(tagName, startOfLine) {
var noIndent = Kludges.doNotIndent.hasOwnProperty(tagName) || (curState.context && curState.context.noIndent);
curState.context = {
prev: curState.context,
tagName: tagName,
indent: curState.indented,
startOfLine: startOfLine,
noIndent: noIndent
};
}
function popContext() {
if (curState.context) curState.context = curState.context.prev;
}
function element(type) {
if (type == "openTag") {
curState.tagName = tagName;
return cont(attributes, endtag(curState.startOfLine));
} else if (type == "closeTag") {
var err = false;
if (curState.context) {
err = curState.context.tagName != tagName;
} else {
err = true;
}
if (err) setStyle = "error";
return cont(endclosetag(err));
}
return cont();
}
function endtag(startOfLine) {
return function(type) {
if (type == "selfcloseTag" ||
(type == "endTag" && Kludges.autoSelfClosers.hasOwnProperty(curState.tagName.toLowerCase())))
return cont();
if (type == "endTag") {pushContext(curState.tagName, startOfLine); return cont();}
return cont();
};
}
function endclosetag(err) {
return function(type) {
if (err) setStyle = "error";
if (type == "endTag") { popContext(); return cont(); }
setStyle = "error";
return cont(arguments.callee);
}
}
function attributes(type) {
if (type == "word") {setStyle = "attribute"; return cont(attribute, attributes);}
if (type == "endTag" || type == "selfcloseTag") return pass();
setStyle = "error";
return cont(attributes);
}
function attribute(type) {
if (type == "equals") return cont(attvalue, attributes);
if (!Kludges.allowMissing) setStyle = "error";
return (type == "endTag" || type == "selfcloseTag") ? pass() : cont();
}
function attvalue(type) {
if (type == "string") return cont(attvaluemaybe);
if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return cont();}
setStyle = "error";
return (type == "endTag" || type == "selfCloseTag") ? pass() : cont();
}
function attvaluemaybe(type) {
if (type == "string") return cont(attvaluemaybe);
else return pass();
}
return {
startState: function() {
return {tokenize: inText, cc: [], indented: 0, startOfLine: true, tagName: null, context: null};
},
token: function(stream, state) {
if (stream.sol()) {
state.startOfLine = true;
state.indented = stream.indentation();
}
if (stream.eatSpace()) return null;
setStyle = type = tagName = null;
var style = state.tokenize(stream, state);
state.type = type;
if ((style || type) && style != "comment") {
curState = state;
while (true) {
var comb = state.cc.pop() || element;
if (comb(type || style)) break;
}
}
state.startOfLine = false;
return setStyle || style;
},
indent: function(state, textAfter, fullLine) {
var context = state.context;
if ((state.tokenize != inTag && state.tokenize != inText) ||
context && context.noIndent)
return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
if (context && /^<\//.test(textAfter))
context = context.prev;
while (context && !context.startOfLine)
context = context.prev;
if (context) return context.indent + indentUnit;
else return 0;
},
compareStates: function(a, b) {
if (a.indented != b.indented || a.tokenize != b.tokenize) return false;
for (var ca = a.context, cb = b.context; ; ca = ca.prev, cb = cb.prev) {
if (!ca || !cb) return ca == cb;
if (ca.tagName != cb.tagName) return false;
}
},
electricChars: "/"
};
});
CodeMirror.defineMIME("application/xml", "xml");
CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
......@@ -10,9 +10,12 @@
closeButton:'.modal_close'
}
var overlay = $("<div id='lean_overlay'></div>");
var overlay = $("#lean_overlay");
if (overlay.length == 0) {
overlay = $("<div id='lean_overlay'></div>");
$("body").append(overlay);
}
$("body").append(overlay);
options = $.extend(defaults, options);
......
(function(a){a.fn.extend({leanModal:function(b){function e(b){a("#lean_overlay").fadeOut(200);a(b).css({display:"none"})}var c={top:100,overlay:.5,closeButton:".modal_close"};var d=a("<div id='lean_overlay'></div>");a("body").append(d);b=a.extend(c,b);return this.each(function(){var c=b;a(this).click(function(b){var f=a(this).attr("href");a(".leanModal_box").css({display:"none"});a("body").append(d);a(".leanModal_box").append('<a class="modal_close" href="#">&#10006;</a>');a("#lean_overlay").click(function(){e(f)});a(c.closeButton).click(function(){e(f)});var g=a(f).outerHeight();var h=a(f).outerWidth();a("#lean_overlay").css({display:"block",opacity:0});a("#lean_overlay").fadeTo(200,c.overlay);a(f).css({display:"block",position:"fixed",opacity:0,"z-index":11e3,left:50+"%","margin-left":-(h/2)+"px",top:c.top+"px"});var i=a(f).offset().top+"px";a(f).css({position:"absolute",top:i});a(f).fadeTo(200,1);b.preventDefault()})})}})})(jQuery)
(function(a){a.fn.extend({leanModal:function(c){function g(d){a("#lean_overlay").fadeOut(200);a(d).css({display:"none"})}var e=a("#lean_overlay");0==e.length&&(e=a("<div id='lean_overlay'></div>"),a("body").append(e));c=a.extend({top:100,overlay:0.5,closeButton:".modal_close"},c);return this.each(function(){var d=c;a(this).click(function(c){var b=a(this).attr("href");a(".leanModal_box").css({display:"none"});a("body").append(e);a(".leanModal_box").append('<a class="modal_close" href="#">&#10006;</a>');
a("#lean_overlay").click(function(){g(b)});a(d.closeButton).click(function(){g(b)});a(b).outerHeight();var f=a(b).outerWidth();a("#lean_overlay").css({display:"block",opacity:0});a("#lean_overlay").fadeTo(200,d.overlay);a(b).css({display:"block",position:"fixed",opacity:0,"z-index":11E3,left:"50%","margin-left":-(f/2)+"px",top:d.top+"px"});f=a(b).offset().top+"px";a(b).css({position:"absolute",top:f});a(b).fadeTo(200,1);c.preventDefault()})})}})})(jQuery);
\ No newline at end of file
......@@ -352,6 +352,8 @@ function updateytplayerInfo() {
}
if (player_state == 1){
update_captions(getCurrentTime());
handle = $('.ui-slider-handle', $('#slider'));
handle.qtip('option', 'content.text', '' + format_time(getCurrentTime()));
}
// updateHTML("videoduration", getDuration());
// updateHTML("videotime", getCurrentTime());
......@@ -420,7 +422,7 @@ function stop() {
function getPlayerState() {
if (ytplayer) {
return ytplayer.getPlayerState();
return ytplayer.getPlayerState();
}
}
......
../djangoapps/simplewiki/media/
\ No newline at end of file
......@@ -5,7 +5,10 @@
<!--[if lte IE 8]>
<p class="ie-warning"> Enrollment requires a modern web browser with JavaScript enabled. You don't have this. You can&rsquo;t enroll without upgrading, since you couldn&rsquo;t take the course without upgrading. Feel free to download the latest version of <a href="http://www.mozilla.org/en-US/firefox/new/">Mozilla Firefox</a> or <a href="http://support.google.com/chrome/bin/answer.py?hl=en&answer=95346">Google Chrome</a>, for free, to enroll and take this course.</p>
<![endif]-->
<p class="disclaimer">
Please note that 6.002x has already started.
Several assignment due dates for 6.002x have already passed. It is now impossible for newly enrolled students to get 100% of the points in the course, although new students can still earn points for assignments whose due dates have not passed, and students have access to all of the course material that has been released for the course.
</p>
<form name="enroll" id="enroll_form" method="get">
<fieldset><% if 'error' in locals(): e = error %>
......@@ -69,5 +72,5 @@
</ol>
<input name="create_account_button" id="create_account_button" type="submit" value="Create Account">
</fieldset> </form>
</fieldset> </form>
</div>
......@@ -56,7 +56,7 @@
%for student in students:
<tr>
<td><a href="/discussion/users/${student['id']}/${student['username']}/">${student['username']}</a></td>
<td><a href="/profile/${student['id']}/">${student['username']}</a></td>
%for section in student['grade_info']['grade_summary']:
%if 'subscores' in section:
%for subsection in section['subscores']:
......@@ -73,4 +73,4 @@
%endif
</section>
</div>
</section>
\ No newline at end of file
</section>
<%inherit file="main.html" />
<%block name="js_extra">
<script>
$(document).ready(function(){
//if(!page) {
// cookie_page = $.cookie("book_page");
// if(cookie_page) {
// goto_page(cookie_page);
// }
//}
$(".handouts ol").treeview({collapsed:true, unique:true/*, cookieId: "treeview-book-nav", persist: "cookie"*/});
});
</script>
</%block>
<%block name="title"><title>Course Info - MITx 6.002x</title></%block>
<%include file="navigation.html" args="active_page='info'" />
......
......@@ -20,10 +20,10 @@
displayMath: [["\\[","\\]"]]}
});
</script>
<script type="text/javascript" src="${ settings.LIB_URL }mathjax-MathJax-c9db6ac/MathJax.js?config=TeX-AMS_HTML-full"></script>
<%block name="headextra"/>
<%block name="headextra"/>
<!-- This must appear after all mathjax-config blocks, so it is after the imports from the other templates -->
<script type="text/javascript" src="${ settings.LIB_URL }mathjax-MathJax-c9db6ac/MathJax.js?config=TeX-AMS_HTML-full"></script>
</head>
<body class="<%block name="bodyclass"/>">
......@@ -107,6 +107,7 @@
<script type="text/javascript" src="${ settings.LIB_URL }jquery.treeview.js"></script>
<script type="text/javascript" src="/static/js/jquery.leanModal.min.js"></script>
<script type="text/javascript" src="/static/js/jquery.qtip.min.js"></script>
<script type="text/javascript" src="/static/js/jquery.cookie.js"></script>
<script type="text/javascript" src="/static/js/video_player.js"></script>
<script type="text/javascript" src="/static/js/schematic.js"></script>
......
......@@ -7,10 +7,10 @@
<input type="hidden" name="problem_id" value="${ problem['name'] }">
% if check_button:
<input id="check_${ id }" type="button" value="Check ${ attempts }" >
<input id="check_${ id }" type="button" value="${ check_button }" >
% endif
% if reset_button:
<input id="reset_${ id }" type="button" value="Reset ${ attempts }" >
<input id="reset_${ id }" type="button" value="Reset" >
% endif
% if save_button:
<input id="save_${ id }" type="button" value="Save" >
......@@ -21,5 +21,10 @@
% if explain :
<a href="/courseware/6.002_Spring_2012/${ explain }" class="new-page">Explanation</a>
% endif
% if attempts_allowed :
<section class="submission_feedback">
You have used ${ attempts_used } of ${ attempts_allowed } submissions
</section>
% endif
</section>
</section>
......@@ -59,39 +59,115 @@ div.info-wrapper {
border-right: 0;
border-left: 1px solid #d3d3d3;
h1 {
padding: lh(.5) lh();
font-size: 18px;
margin: 0 ;
header {
@extend .bottom-border;
padding: lh(.5) lh(.75);
h1 {
font-size: 18px;
margin: 0 ;
}
p {
margin-bottom: 0;
margin-top: 4px;
font-size: 12px;
color: #666;
}
}
ol {
list-style: none;
background: none;
li {
@include box-shadow(0 1px 0 #eee);
border-bottom: 1px solid #d3d3d3;
@include box-sizing(border-box);
@extend .clearfix;
padding: 7px lh(.75);
background: none;
position: relative;
&.expandable,
&.collapsable {
h4 {
padding-left: 18px;
font-style: $body-font-size;
font-weight: normal;
}
}
ul {
background: none;
margin: 7px (-(lh(.75))) 0;
li {
padding-left: 18px + lh(.75);
@include box-shadow(inset 0 1px 0 #eee);
border-top: 1px solid #d3d3d3;
border-bottom: 0;
}
}
&:hover {
background-color: #e9e9e9;
}
div.hitarea {
background-image: url('/static/images/treeview-default.gif');
width: 100%;
height: 100%;
max-height: 20px;
display: block;
position: absolute;
left: lh(.75);
margin-left: 0;
&:hover {
opacity: 0.6;
filter: alpha(opacity=60);
}
&.expandable-hitarea {
background-position: -80px 1px;
}
&.collapsable-hitarea {
background-position: -64px -21px;
}
}
h3 {
border-bottom: 0;
text-transform: uppercase;
font-weight: bold;
color: #999;
@include box-shadow(none);
font-size: 12px;
}
p {
padding: 7px lh();
margin: 0;
text-transform: none;
letter-spacing: 0;
font-size: $body-font-size;
&:hover {
background: #efefef;
}
a {
display: inline;
padding: 0;
padding-right: 8px;
&:hover {
text-decoration: underline;
background: none;
&:before {
content: "•";
@include inline-block();
padding-right: 8px;
color: #ccc;
}
&:first-child {
&:before {
content: "";
padding-right: 0;
}
}
}
}
......@@ -99,12 +175,11 @@ div.info-wrapper {
a {
@include transition();
color: lighten($text-color, 10%);
display: block;
padding: 7px lh();
text-decoration: none;
@include inline-block();
&:hover {
background: #efefef;
color: $mit-red;
}
}
}
......
......@@ -104,7 +104,7 @@ div.profile-wrapper {
font-style: italic;
}
input {
input#pwd_reset_button {
background: none;
border: none;
@include box-shadow(none);
......
......@@ -4,7 +4,7 @@
@import "base/reset", "base/font-face";
@import "base/variables", "base/functions", "base/extends", "base/base";
@import "layout/layout", "layout/header", "layout/footer", "layout/calculator", "layout/leanmodal";
@import "plugins/jquery-ui-1.8.16.custom";
@import "plugins/jquery-ui-1.8.16.custom", "plugins/jquery.qtip.min";
// pages
@import "courseware/courseware", "courseware/sidebar", "courseware/video", "courseware/sequence-nav", "courseware/amplifier";
......
......@@ -46,6 +46,36 @@ h1.top-header {
}
}
.light-button, a.light-button {
@include box-shadow(inset 0 1px 0 #fff);
@include linear-gradient(#fff, lighten(#888, 40%));
@include border-radius(3px);
border: 1px solid #ccc;
padding: 4px 8px;
color: #666;
font: normal $body-font-size $body-font-family;
text-decoration: none;
cursor: pointer;
-webkit-font-smoothing: antialiased;
&:hover, &:focus {
@include linear-gradient(#fff, lighten(#888, 37%));
border: 1px solid #ccc;
text-decoration: none;
}
}
.action-link {
a {
color: $mit-red;
&:hover {
text-decoration: none;
color: darken($mit-red, 20%);
}
}
}
.content {
@include box-shadow(inset 0 0 2px 3px #f3f3f3);
@include box-sizing(border-box);
......
......@@ -175,6 +175,7 @@ div.course-wrapper {
}
div.staff_info {
@include clearfix();
white-space: pre-wrap;
border-top: 1px solid #ccc;
padding-top: lh();
......
section.course-content {
div.video-subtitles {
padding: 6px lh();
margin: 0 (-(lh()));
border-top: 1px solid #e1e1e1;
border-bottom: 1px solid #e1e1e1;
background: #f3f3f3;
position: relative;
@include clearfix();
div.video-wrapper {
float: left;
......@@ -56,6 +62,7 @@ section.course-content {
background: #333;
position: relative;
border: 1px solid #000;
border-top: 0;
color: #ccc;
div#slider {
......@@ -64,25 +71,77 @@ section.course-content {
@include box-shadow(inset 0 1px 0 #eee, 0 1px 0 #555);
background: #c2c2c2;
border: none;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
height: 14px;
height: 7px;
@include transition(height 2.0s ease-in-out);
div.ui-widget-header {
background: #777;
@include box-shadow(inset 0 1px 0 #999);
}
.ui-tooltip.qtip .ui-tooltip-content {
background: $mit-red;
border: 1px solid darken($mit-red, 20%);
@include border-radius(2px);
@include box-shadow(inset 0 1px 0 lighten($mit-red, 10%));
color: #fff;
font: bold 12px $body-font-family;
margin-bottom: 6px;
padding: 4px;
text-align: center;
-webkit-font-smoothing: antialiased;
text-shadow: 0 -1px 0 darken($mit-red, 10%);
overflow: visible;
&::after {
content: " ";
width: 7px;
height: 7px;
display: block;
position: absolute;
bottom: -5px;
left: 50%;
margin-left: -3px;
@include transform(rotate(45deg));
background: $mit-red;
border-right: 1px solid darken($mit-red, 20%);
border-bottom: 1px solid darken($mit-red, 20%);
}
}
a.ui-slider-handle {
@include border-radius(20px);
@include border-radius(15px);
@include box-shadow(inset 0 1px 0 lighten($mit-red, 10%));
background: $mit-red url(/static/images/slider-handle.png) center center no-repeat;
border: 1px solid darken($mit-red, 20%);
cursor: pointer;
height: 20px;
margin-left: -10px;
height: 15px;
margin-left: -7px;
top: -4px;
width: 20px;
width: 15px;
@include transition(height 2.0s ease-in-out, width 2.0s ease-in-out);
@include background-size(50%);
&:focus, &:hover {
background-color: lighten($mit-red, 10%);
outline: none;
}
}
&:hover {
height: 14px;
margin-top: -7px;
a.ui-slider-handle {
@include border-radius(20px);
height: 20px;
margin-left: -10px;
top: -4px;
width: 20px;
}
}
}
ul.vcr {
......@@ -100,9 +159,10 @@ section.course-content {
display: block;
cursor: pointer;
height: 14px;
padding: lh(.75) lh();
padding: lh(.75);
text-indent: -9999px;
width: 14px;
@include transition();
&.play {
background: url('/static/images/play-icon.png') center center no-repeat;
......@@ -123,7 +183,7 @@ section.course-content {
}
div#vidtime {
padding-left: lh();
padding-left: lh(.75);
font-weight: bold;
line-height: 46px; //height of play pause buttons
-webkit-font-smoothing: antialiased;
......@@ -135,65 +195,117 @@ section.course-content {
float: right;
div.speeds {
border-right: 1px solid #000;
border-left: 1px solid #000;
border-right: 1px solid #000;
@include box-shadow(1px 0 0 #555, inset 1px 0 0 #555);
float: left;
line-height: 46px; //height of play pause buttons
line-height: 0;
padding-right: lh(.25);
margin-right: 0;
-webkit-font-smoothing: antialiased;
opacity: .7;
@include transition();
cursor: pointer;
-webkit-font-smoothing: antialiased;
h3 {
@include inline-block();
padding: 0 lh(.5);
float: left;
padding: 0 lh(.25) 0 lh(.5);
font-weight: normal;
text-transform: uppercase;
font-size: 12px;
letter-spacing: 1px;
color: #999;
line-height: 46px; //height of play pause buttons
}
p.active {
@include inline-block();
padding: 0 lh(.5) 0 0;
margin-bottom: 0;
font-weight: bold;
display: none;
}
// fix for now
ol#video_speeds {
@include inline-block();
padding-right: lh(.5);
li {
cursor: pointer;
float: left;
color: #fff;
@include inline-block();
cursor: pointer;
padding: 0 lh(.25);
line-height: 46px; //height of play pause buttons
&.active {
font-weight: bold;
}
&:last-child {
border-bottom: 0;
margin-top: 0;
@include box-shadow(none);
}
&:hover {
color: #aaa;
background-color: #444;
}
}
}
&:hover {
opacity: 1;
background-color: #444;
}
}
a.hide-subtitles {
float: left;
display: block;
padding-right: lh(.5);
padding: 0 lh(.5);
margin-left: 0;
color: #797979;
padding-left: 50px;
line-height: 46px; //height of play pause buttons
width: 30px;
text-indent: -9999px;
font-weight: 800;
background: url('/static/images/cc.png') 16px center no-repeat;
background: url('/static/images/cc.png') center no-repeat;
-webkit-font-smoothing: antialiased;
@include transition();
opacity: 1;
position: relative;
&:after {
text-indent: 0;
position: absolute;
top: 0;
right: -40px;
content: "turn off";
display: block;
width: 70px;
opacity: 0;
visibility: hidden;
@include transition();
}
&:hover {
color: #fff;
text-decoration: none;
background-color: #444;
padding-right: 80px;
background-position: 11px center;
&:after {
right: 0;
opacity: 1;
visibility: visible;
}
}
&.off {
opacity: .7;
&:after {
content: "turn on";
}
}
}
}
......@@ -203,19 +315,21 @@ section.course-content {
ol.subtitles {
float: left;
width: flex-grid(3, 9);
height: 530px;
padding-top: 10px;
max-height: 460px;
overflow: hidden;
li {
margin-bottom: 0px;
cursor: pointer;
border: 0;
padding: 0;
color: #666;
cursor: pointer;
margin-bottom: 0px;
padding: 0;
@include transition(all, .5s, ease-in);
&.current {
background-color: #f3f3f3;
color: #333;
font-weight: 700;
}
&:hover {
......@@ -246,3 +360,9 @@ section.course-content {
}
}
}
div.course-wrapper.closed section.course-content div.video-subtitles {
ol.subtitles {
max-height: 577px;
}
}
// Base extends (Merge with main stylesheet later)
.light-button, a.light-button {
@include box-shadow(inset 0 1px 0 #fff);
@include linear-gradient(#fff, lighten(#888, 40%));
@include border-radius(3px);
border: 1px solid #ccc;
padding: 4px 8px;
color: #666;
font: normal $body-font-size $body-font-family;
text-decoration: none;
cursor: pointer;
-webkit-font-smoothing: antialiased;
&:hover, &:focus {
@include linear-gradient(#fff, lighten(#888, 37%));
border: 1px solid #ccc;
text-decoration: none;
}
}
.action-link {
a {
color: $mit-red;
&:hover {
text-decoration: none;
color: darken($mit-red, 20%);
}
}
}
// Layout
body.askbot {
......
......@@ -105,8 +105,8 @@ ul.question-list, div#question-list {
li.single-question {
border-bottom: 1px solid #eee;
list-style: none;
padding: 10px 3%;
margin-left: -3%;
padding: 10px lh();
margin-left: (-(lh()));
width: 100%;
&:hover {
......
......@@ -288,6 +288,7 @@ div.discussion-wrapper aside {
border-top: 0;
@include box-shadow(none);
}
a {
width: 100%;
@include box-sizing(border-box);
......@@ -295,6 +296,7 @@ div.discussion-wrapper aside {
padding: 10px;
display: block;
margin-top: 10px;
@extend .light-button;
&:first-child {
margin-top: 0;
......
.ui-tooltip,.qtip{position:absolute;left:-28000px;top:-28000px;display:none;max-width:280px;min-width:50px;font-size:10.5px;line-height:12px;}.ui-tooltip-fluid{display:block;visibility:hidden;position:static!important;float:left!important;}.ui-tooltip-content{position:relative;padding:5px 9px;overflow:hidden;border:1px solid #000001;text-align:left;word-wrap:break-word;overflow:hidden;}.ui-tooltip-titlebar{position:relative;min-height:14px;padding:5px 35px 5px 10px;overflow:hidden;border:1px solid #000001;border-width:1px 1px 0;font-weight:bold;}.ui-tooltip-titlebar+.ui-tooltip-content{border-top-width:0!important;}/*!Default close button class */ .ui-tooltip-titlebar .ui-state-default{position:absolute;right:4px;top:50%;margin-top:-9px;cursor:pointer;outline:medium none;border-width:1px;border-style:solid;}* html .ui-tooltip-titlebar .ui-state-default{top:16px;}.ui-tooltip-titlebar .ui-icon,.ui-tooltip-icon .ui-icon{display:block;text-indent:-1000em;}.ui-tooltip-icon,.ui-tooltip-icon .ui-icon{-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.ui-tooltip-icon .ui-icon{width:18px;height:14px;text-align:center;text-indent:0;font:normal bold 10px/13px Tahoma,sans-serif;color:inherit;background:transparent none no-repeat -100em -100em;}/*!Default tooltip style */ .ui-tooltip-default .ui-tooltip-titlebar,.ui-tooltip-default .ui-tooltip-content{border-color:#F1D031;background-color:#FFFFA3;color:#555;}.ui-tooltip-default .ui-tooltip-titlebar{background-color:#FFEF93;}.ui-tooltip-default .ui-tooltip-icon{border-color:#CCC;background:#F1F1F1;color:#777;}.ui-tooltip-default .ui-tooltip-titlebar .ui-state-hover{border-color:#AAA;color:#111;}
\ No newline at end of file
......@@ -7,7 +7,18 @@ form#wiki_revision {
display: block;
margin-bottom: 7px ;
}
.CodeMirror-scroll {
min-height: 550px;
width: 100%;
}
.CodeMirror {
@extend textarea;
@include box-sizing(border-box);
font-family: monospace;
margin-bottom: 20px;
}
textarea {
@include box-sizing(border-box);
margin-bottom: 20px;
......
......@@ -7,7 +7,7 @@
<!-- <link rel="stylesheet" media="print" href="/static/simplewiki/css/base_print.css" /> -->
<!-- <link rel="stylesheet" href="/static/simplewiki/css/autosuggest_inquisitor.css" /> -->
<!-- <link rel="stylesheet" href="/static/css/local.css" type="text/css" media="all" /> -->
<script type="text/javascript" src="/static/simplewiki/js/bsn.AutoSuggest_c_2.0.js"></script>
<script type="text/javascript" src="/static/js/simplewiki/bsn.AutoSuggest_c_2.0.js"></script>
<%!
from django.core.urlresolvers import reverse
......@@ -40,7 +40,7 @@
tex2jax: {inlineMath: [ ['$','$'], ["\\(","\\)"]],
displayMath: [ ['$$','$$'], ["\\[","\\]"]]}
});
</script> <script type="text/javascript" src="${ settings.LIB_URL }mathjax/MathJax.js?config=TeX-AMS_HTML-full"></script>
</script>
<script>
$(function(){
$.ajaxSetup ({
......
##This file is based on the template from the SimpleWiki source which carries the GPL license
<%inherit file="simplewiki_base.html"/>
<%block name="title"><title>Wiki – Create Article – MITx 6.002x</title></%block>
<%block name="wiki_page_title">
<h1>Create article</h1>
</%block>
<%block name="wiki_body">
<form method="POST" id="wiki_revision">
<div style="display:none">
<input type="hidden" name="csrfmiddlewaretoken" value="${csrf_token}"/>
</div>
${ wiki_form }
<input type="submit" value="Create article" /></td>
</form>
<%include file="simplewiki_instructions.html"/>
</%block>
......@@ -2,29 +2,58 @@
<%inherit file="simplewiki_base.html"/>
<%block name="title"><title>${"Edit " + wiki_title + " - " if wiki_title is not UNDEFINED else ""}MITx 6.002x Wiki</title></%block>
<%block name="title">
<title>
%if create_article:
Wiki – Create Article – MITx 6.002x
%else:
${"Edit " + wiki_title + " - " if wiki_title is not UNDEFINED else ""}MITx 6.002x Wiki
%endif
</title></%block>
<%block name="wiki_page_title">
%if create_article:
<h1>Create article</h1>
%else:
<h1>${ wiki_article.title }</h1>
%endif
</%block>
<%block name="wiki_head">
<script type="text/javascript" src="${ settings.LIB_URL }CodeMirror/codemirror.js"></script>
<link rel="stylesheet" href="${ settings.LIB_URL }CodeMirror/codemirror.css" />
<script type="text/javascript" src="${ settings.LIB_URL }CodeMirror/xml.js"></script>
<script type="text/javascript" src="${ settings.LIB_URL }CodeMirror/mitx_markdown.js"></script>
<script>
$(function() {
//Store the initial contents of #id_contents (the wiki body field) so we can compare for unsaved changes
$("#id_contents").data('initial_contents', $("#id_contents").val());
window.onbeforeunload = function askConfirm() { //Warn the user before they navigate away
if ( $("#id_contents").val() != $("#id_contents").data('initial_contents') ) {
return "You have made changes to the article that have not been saved yet.";
}
};
$("#submit_edit").click(function() {
$("#id_contents").data('initial_contents', $("#id_contents").val());
$(function(){
$(document).ready(function() {
var editor = CodeMirror.fromTextArea(document.getElementById("id_contents"), {
mode: 'mitx_markdown',
matchBrackets: true,
theme: "default",
lineWrapping: true,
});
//Store the inital contents so we can compare for unsaved changes
var initial_contents = editor.getValue();
window.onbeforeunload = function askConfirm() { //Warn the user before they navigate away
if ( editor.getValue() != initial_contents ) {
return "You have made changes to the article that have not been saved yet.";
}
};
$("#submit_edit").click(function() {
initial_contents = editor.getValue();
});
});
});
</script>
</%block>
......@@ -35,8 +64,12 @@
<input type="hidden" name="csrfmiddlewaretoken" value="${csrf_token}"/>
</div>
${wiki_form}
%if create_article:
<input type="submit" id="submit_edit" value="Create article" /></td>
%else:
<input type="submit" id="submit_edit" name="edit" value="Save Changes" />
<input type="submit" id="submit_delete" name="delete" value="Delete article" />
%endif
</form>
<%include file="simplewiki_instructions.html"/>
......
......@@ -2,7 +2,7 @@
This wiki uses <strong>Markdown</strong> for styling. There are several <a href="http://daringfireball.net/projects/markdown/basics">useful</a> <a href="http://greg.vario.us/doc/markdown.txt">guides</a> <a href="http://www.lowendtalk.com/discussion/6/miniature-markdown-guide">online</a>.
<br>
<br>MITx Additions:
<p class="markdown-example">circuit:basic</p>
<p class="markdown-example">circuit-schematic:</p>
<p class="markdown-example"><span>$</span>LaTeX Math Expression<span>$</span></p>
To create a new wiki article, create a link to it. Clicking the link gives you the creation page.
<p class="markdown-example">[Article Name](wiki:ArticleName)</p>
......
......@@ -29,10 +29,11 @@
<div class="secondary-controls">
<div class="speeds">
<h3>Speed</h3>
<p class="active"></p>
<ol id="video_speeds"></ol>
</div>
<a href="#" class="hide-subtitles">turn off</a>
<a href="#" class="hide-subtitles">Captions</a>
</div>
</section>
</section>
......@@ -54,7 +55,7 @@
<li id="stt_p5"><div id="std_p5" onclick="title_seek( 5);"></div></li>
<li id="stt_p6"><div id="std_p7" onclick="title_seek( 6);"></div></li>
<li id="stt_p6"><div id="std_p7" onclick="title_seek( 7);"></div></li>
<!-- <li id="stt_p6"><div id="std_p7" onclick="title_seek( 8);"></div></li> -->
<li id="stt_p6"><div id="std_p7" onclick="title_seek( 8);"></div></li>
</ol>
</div>
......@@ -65,8 +66,7 @@
$('.hide-subtitles').click(function() {
$('div.video-subtitles').toggleClass('closed');
var link_text = $('.hide-subtitles').text();
$(this).text((link_text == 'turn off') ? 'turn on' : 'turn off');
$(this).toggleClass("off");
return false;
});
});
......
......@@ -20,9 +20,47 @@ if (swfobject.hasFlashPlayerVersion("10.1")){
// Make sure the callback is called once API ready, YT seems to be buggy
loadHTML5Video();
}
var captions=0;
$("#slider").slider({slide:function(event,ui){seek_slide('slide',event.originalEvent,ui.value);},
stop:function(event,ui){seek_slide('stop',event.originalEvent,ui.value);}});
/* Cache a reference to our slider element */
var slider = $('#slider')
.slider({
range: "min",
slide: function(event,ui) {
var slider_time = format_time(ui.value)
seek_slide('slide',event.originalEvent,ui.value);
handle.qtip('option', 'content.text', '' + slider_time);
},
stop:function(event,ui){seek_slide('stop',event.originalEvent,ui.value);}
}),
/* Grab and cache the newly created slider handle */
handle = $('.ui-slider-handle', slider);
/*
* Selector needs changing here to match your elements.
*
* Notice the second argument to the $() constructor, which tells
* jQuery to use that as the top-level element to seareh down from.
*/
handle.qtip({
content: '' + slider.slider('option', 'value'), // Use the current value of the slider
position: {
my: 'bottom center',
at: 'top center',
container: handle // Stick it inside the handle element so it keeps the position synched up
},
hide: {
delay: 700 // Give it a longer delay so it doesn't hide frequently as we move the handle
},
style: {
classes: 'ui-tooltip-slider',
widget: true // Make it Themeroller compatible
}
});
function good() {
window['console'].log(ytplayer.getCurrentTime());
......@@ -37,7 +75,8 @@ function add_speed(key, stream) {
var id = 'speed_' + stream;
if (key == video_speed) {
$("#video_speeds").append(' <li class=active id="'+id+'">'+key+'x</li>');
$("#video_speeds").append(' <li class="active" id="'+id+'">'+key+'x</li>');
$("p.active").text(key + 'x');
} else {
$("#video_speeds").append(' <li id="'+id+'">'+key+'x</li>');
}
......@@ -46,6 +85,8 @@ function add_speed(key, stream) {
change_video_speed(key, stream);
$(this).siblings().removeClass("active");
$(this).addClass("active");
var active = $(this).text();
$("p.active").text(active);
});
}
......@@ -89,8 +130,6 @@ $(document).ready(function() {
});
function toggleVideo(){
if ($("#video_control").hasClass("play")){
play();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment