fixing javascripts
This commit is contained in:
@@ -1,2 +1,84 @@
|
|||||||
// Place your application-specific JavaScript functions and classes here
|
events = {};
|
||||||
// This file is automatically included by javascript_include_tag :defaults
|
|
||||||
|
events['#password:keyup'] = function(element, e) {
|
||||||
|
passmeter();
|
||||||
|
};
|
||||||
|
|
||||||
|
function startup() {
|
||||||
|
EventSelectors.start(events);
|
||||||
|
|
||||||
|
var validation_box = $('validation');
|
||||||
|
if(validation_box != null) new Effect.Appear(validation_box);
|
||||||
|
|
||||||
|
$$('.highlight').each(function(e) {
|
||||||
|
new Effect.Highlight(e, {duration: 1.5});
|
||||||
|
});
|
||||||
|
|
||||||
|
if(window.history_update) history_update();
|
||||||
|
}
|
||||||
|
|
||||||
|
spin_count = Array();
|
||||||
|
function spinner_start(s)
|
||||||
|
{
|
||||||
|
if(spin_count[s]) spin_count[s]++;
|
||||||
|
else spin_count[s] = 1;
|
||||||
|
|
||||||
|
$("spinner_" + s).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
function spinner_stop(s)
|
||||||
|
{
|
||||||
|
spin_count[s]--;
|
||||||
|
if(spin_count[s] == 0) $("spinner_" + s).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
function passmeter()
|
||||||
|
{
|
||||||
|
var pass = $F('password');
|
||||||
|
var meter = $('passmeter');
|
||||||
|
var nivel = 0;
|
||||||
|
|
||||||
|
if(pass.length == 0) {
|
||||||
|
meter.innerHTML = " ";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pass.length >= 6) {
|
||||||
|
if(/[a-z_]/.test(pass)) nivel++;
|
||||||
|
if(/[A-Z]/.test(pass)) nivel++;
|
||||||
|
if(/[0-9]/.test(pass)) nivel++;
|
||||||
|
if(/\W/.test(pass)) nivel++;
|
||||||
|
|
||||||
|
if(pass.length >= 10) nivel++;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(nivel) {
|
||||||
|
case 0: case 1:
|
||||||
|
msg = "senha muito fraca";
|
||||||
|
cor = "#d00";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
msg = "senha fraca";
|
||||||
|
cor = "#f50";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
msg = "senha moderada";
|
||||||
|
cor = "#090";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4: default:
|
||||||
|
msg = "senha forte";
|
||||||
|
cor = "#05f";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
meter.style.color = cor;
|
||||||
|
meter.innerHTML = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ajax.Responders.register({
|
||||||
|
onComplete: function() { EventSelectors.assign(events);}
|
||||||
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ events['#show_preview:click'] = function(element, e)
|
|||||||
spinner_stop("preview");
|
spinner_stop("preview");
|
||||||
Element.show('wiki_preview');
|
Element.show('wiki_preview');
|
||||||
new Effect.ScrollTo('wiki_preview');
|
new Effect.ScrollTo('wiki_preview');
|
||||||
|
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,9 @@
|
|||||||
%script{:type => 'text/javascript'}
|
%script{:type => 'text/javascript'}
|
||||||
== BASE_PATH = "#{App.base_path}";
|
== BASE_PATH = "#{App.base_path}";
|
||||||
= javascript_include_tag :base
|
= javascript_include_tag :base
|
||||||
|
= javascript_include_tag 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML'
|
||||||
|
%script{:type => 'text/x-mathjax-config'}
|
||||||
|
== MathJax.Hub.Config({tex2jax: {inlineMath: [['{$','$}']], displayMath: [['{$$','$$}']]}});
|
||||||
|
|
||||||
%body{'onload' => 'javascript: startup()'}
|
%body{'onload' => 'javascript: startup()'}
|
||||||
#wrapper
|
#wrapper
|
||||||
|
|||||||
18
vendor/gems/bluecloth/lib/bluecloth.rb
vendored
18
vendor/gems/bluecloth/lib/bluecloth.rb
vendored
@@ -396,7 +396,7 @@ class BlueCloth < String
|
|||||||
return rval
|
return rval
|
||||||
end
|
end
|
||||||
|
|
||||||
MimeTexURL = "http://isoron.org/tex/math.cgi"
|
MimeTexURL = "http://lupus.isoron.org/tex/math.cgi"
|
||||||
LatexBlockRegexp = %r{
|
LatexBlockRegexp = %r{
|
||||||
\{\$\$(.*?)\$\$\}
|
\{\$\$(.*?)\$\$\}
|
||||||
}xm
|
}xm
|
||||||
@@ -419,17 +419,19 @@ class BlueCloth < String
|
|||||||
|
|
||||||
# Block Latex
|
# Block Latex
|
||||||
rval = rval.gsub(LatexBlockRegexp) {|block|
|
rval = rval.gsub(LatexBlockRegexp) {|block|
|
||||||
codeblock = $1.strip.gsub("\n", '%0A').gsub(/[ \t]+/, " ")
|
tokenize("{$$#{$1.strip}$$}", rs)
|
||||||
codeblock = %{<div class="tex_block"><img src="#{MimeTexURL}?%s"/></div>} %
|
#codeblock = $1.strip.gsub("\n", '%0A').gsub(/[ \t]+/, " ")
|
||||||
[ encode_code( codeblock, rs ) ]
|
#codeblock = %{<div class="tex_block"><img src="#{MimeTexURL}?%s"/></div>} %
|
||||||
tokenize(codeblock, rs)
|
# [ encode_code( codeblock, rs ) ]
|
||||||
|
#tokenize(codeblock, rs)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Inline math
|
# Inline math
|
||||||
rval = rval.gsub( LatexInlineRegexp ) {|block|
|
rval = rval.gsub( LatexInlineRegexp ) {|block|
|
||||||
codeblock = $1.strip
|
tokenize("{$#{$1.strip}$}", rs)
|
||||||
codeblock = %{<img class="tex_inline" src="#{MimeTexURL}?\\small %s"/>} % [ encode_code( codeblock, rs ) ]
|
#codeblock = $1.strip
|
||||||
tokenize(codeblock, rs)
|
#codeblock = %{<img class="tex_inline" src="#{MimeTexURL}?\\small %s"/>} % [ encode_code( codeblock, rs ) ]
|
||||||
|
#tokenize(codeblock, rs)
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user