# HG changeset patch # User Steve Losh # Date 1231893441 18000 # Node ID 5d5a567385bb7292518ad7cbac5fb825762a5a68 Initial open-source revision of the site. diff -r 000000000000 -r 5d5a567385bb .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Tue Jan 13 19:37:21 2009 -0500 @@ -0,0 +1,12 @@ +syntax: glob +*.pyc +.DS_Store +*.log +*.tmproj + +fabfile.py +deploy*.py +*.db + +site-media/storage/* + diff -r 000000000000 -r 5d5a567385bb __init__.py diff -r 000000000000 -r 5d5a567385bb blog/__init__.py diff -r 000000000000 -r 5d5a567385bb blog/admin.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/blog/admin.py Tue Jan 13 19:37:21 2009 -0500 @@ -0,0 +1,29 @@ +from stevelosh.blog.models import Entry, Comment +from django.contrib import admin + +class EntryAdmin(admin.ModelAdmin): + fieldsets = [ + ('Entry', { 'fields': ['title', 'snip', 'body'], }), + ('Publishing', { 'fields': ['pub_date', 'published'], + 'description': "The entry won't be shown on the site unless the Published box is checked." }), + ('Advanced', { 'fields': ['slug',], + 'classes': ['collapse'], }), + ] + list_display = ('title', 'snip', 'pub_date',) + search_fields = ('title', 'snip', 'body') + list_filter = ('pub_date',) + date_hierarchy = 'pub_date' + ordering = ('-pub_date',) + prepopulated_fields = { 'slug': ('title',) } + +class CommentAdmin(admin.ModelAdmin): + fields = ('name', 'body', 'submitted', 'entry') + list_display = ('entry', 'name', 'submitted', 'body') + search_fields = ('name', 'body') + list_filter = ('name', 'entry') + date_hierarchy = 'submitted' + ordering = ('-submitted',) + + +admin.site.register(Entry, EntryAdmin) +admin.site.register(Comment, CommentAdmin) \ No newline at end of file diff -r 000000000000 -r 5d5a567385bb blog/models.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/blog/models.py Tue Jan 13 19:37:21 2009 -0500 @@ -0,0 +1,32 @@ +from django.db import models +import datetime + +class Entry(models.Model): + title = models.CharField(max_length=140) + snip = models.CharField(max_length=140) + slug = models.SlugField() + pub_date = models.DateTimeField('Date Published', + default=datetime.datetime.now) + body = models.TextField() + published = models.BooleanField(default=False) + + def get_absolute_url(self): + return "/blog/entry/%i/%i/%i/%s/" % (self.pub_date.year, + self.pub_date.month, self.pub_date.day, self.slug) + + def __unicode__(self): + return u'%s' % (self.title,) + +class Comment(models.Model): + name = models.CharField('Commenter', blank=False, null=False, + max_length=40) + body = models.TextField('Comment', blank=False, null=False) + submitted = models.DateTimeField(default=datetime.datetime.now) + entry = models.ForeignKey(Entry) + + def get_absolute_url(self): + return self.entry.get_absolute_url() + "#comment-" + str(self.id) + + def __unicode__(self): + return u'%s on %s' % (self.name, self.entry.title) + diff -r 000000000000 -r 5d5a567385bb blog/views.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/blog/views.py Tue Jan 13 19:37:21 2009 -0500 @@ -0,0 +1,45 @@ +from stevelosh.blog.models import Entry, Comment +from markdown import markdown +from django.shortcuts import get_object_or_404, render_to_response +from django.http import HttpResponseRedirect, HttpResponsePermanentRedirect +from django.core.urlresolvers import reverse + + +ENTRIES_PER_PAGE = 10 + +def entry(request, year, month, day, slug): + entry = get_object_or_404(Entry, slug=slug, pub_date__year=year, + pub_date__month=month, pub_date__day=day,) + return render_to_response('blog/entry.html', { 'entry': entry, }) + +def old_entry(request, year, month, day, slug): + return HttpResponsePermanentRedirect(reverse('blog-entry', + args=(year, month, day, slug))) + +def list(request, page=0): + page = int(page) + start_index = page * ENTRIES_PER_PAGE + end_index = start_index + ENTRIES_PER_PAGE + entries = Entry.objects.all().order_by('-pub_date') + entries = entries.filter(published=True)[start_index:end_index] + return render_to_response('blog/list.html', + { 'entries': entries, + 'older_page': page+1 if end_index < Entry.objects.count() else None, + 'newer_page': page-1 if page != 0 else None } ) + +def comment(request): + fields = request.POST + entry = Entry.objects.get(pk=fields['entry-id']) + + if ( fields.has_key('name') and (not fields['name'].strip() == '') and + fields.has_key('body') and not fields['body'].strip() == ''): + new_comment = Comment(name=fields['name'], + body=fields['body'], + entry=entry) + new_comment.save() + + return HttpResponseRedirect(reverse('stevelosh.blog.views.entry', + args=(entry.pub_date.year, + entry.pub_date.month, + entry.pub_date.day, + entry.slug))) diff -r 000000000000 -r 5d5a567385bb manage.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/manage.py Tue Jan 13 19:37:21 2009 -0500 @@ -0,0 +1,11 @@ +#!/usr/bin/env python +from django.core.management import execute_manager +try: + import settings # Assumed to be in the same directory. +except ImportError: + import sys + sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) + sys.exit(1) + +if __name__ == "__main__": + execute_manager(settings) diff -r 000000000000 -r 5d5a567385bb projects/__init__.py diff -r 000000000000 -r 5d5a567385bb projects/admin.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/projects/admin.py Tue Jan 13 19:37:21 2009 -0500 @@ -0,0 +1,36 @@ +from stevelosh.projects.models import Project, ProjectFile, ProjectPhoto, Comment +from django.contrib import admin + +class ProjectAdmin(admin.ModelAdmin): + list_display = ('name', 'snip', 'type', 'posted',) + search_fields = ('name', 'snip', 'body') + list_filter = ('type',) + date_hierarchy = 'posted' + ordering = ('-posted',) + prepopulated_fields = { 'slug': ('name',) } + +class ProjectPhotoAdmin(admin.ModelAdmin): + fields = ('title', 'description', 'project', 'position', 'photo') + list_display = ('project', 'title', 'description', 'height', 'width') + search_fields = ('title', 'description',) + list_filter = ('project',) + +class ProjectFileAdmin(admin.ModelAdmin): + fields = ('title', 'description', 'project', 'file',) + list_display = ('project', 'title', 'description',) + search_fields = ('title', 'description',) + list_filter = ('project',) + +class CommentAdmin(admin.ModelAdmin): + fields = ('name', 'body', 'submitted', 'project') + list_display = ('project', 'name', 'submitted', 'body') + search_fields = ('name', 'body') + list_filter = ('name', 'project') + date_hierarchy = 'submitted' + ordering = ('-submitted',) + + +admin.site.register(Project, ProjectAdmin) +admin.site.register(ProjectPhoto, ProjectPhotoAdmin) +admin.site.register(ProjectFile, ProjectFileAdmin) +admin.site.register(Comment, CommentAdmin) diff -r 000000000000 -r 5d5a567385bb projects/models.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/projects/models.py Tue Jan 13 19:37:21 2009 -0500 @@ -0,0 +1,55 @@ +from django.db import models +import datetime + + +class Project(models.Model): + """A model of a project.""" + + name = models.CharField(blank=False, max_length=140) + snip = models.CharField(blank=False, max_length=140) + type = models.CharField(blank=True, max_length=15) + body = models.TextField(blank=True) + posted = models.DateTimeField(blank=False, default=datetime.datetime.now) + slug = models.SlugField() + + def __unicode__(self): + return u"%s" % (self.name,) + + +class ProjectFile(models.Model): + """A single file for a project.""" + + title = models.CharField(blank=False, max_length=140) + description = models.TextField(blank=True, null=True) + file = models.FileField(upload_to='storage/projects/files') + project = models.ForeignKey(Project) + + def __unicode__(self): + return u"%s - %s" % (self.project.name, self.title) + + +class ProjectPhoto(models.Model): + """A single photograph for a project.""" + + title = models.CharField(blank=False, max_length=140) + description = models.TextField(blank=True, null=True) + height = models.IntegerField(blank=True, null=True) + width = models.IntegerField(blank=True, null=True) + photo = models.ImageField(upload_to='storage/projects/images', + height_field='height', width_field='width') + project = models.ForeignKey(Project) + position = models.IntegerField(blank=True, null=True) + + def __unicode__(self): + return u"%s - %s" % (self.project.name, self.title) + + +class Comment(models.Model): + name = models.CharField(blank=False, null=False, max_length=40) + body = models.TextField(blank=False, null=False) + submitted = models.DateTimeField(default=datetime.datetime.now) + project = models.ForeignKey(Project) + + def __unicode__(self): + return u'%s on %s' % (self.name, self.entry.title) + diff -r 000000000000 -r 5d5a567385bb projects/views.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/projects/views.py Tue Jan 13 19:37:21 2009 -0500 @@ -0,0 +1,34 @@ +from stevelosh.projects.models import Project, Comment +from markdown import markdown +from django.shortcuts import render_to_response, get_object_or_404 +from django.http import HttpResponseRedirect +from django.core.urlresolvers import reverse + + +def project(request, slug): + project = get_object_or_404(Project, slug=slug) + return render_to_response('projects/project.html', + { 'project': project, }) + +def list(request): + projects = Project.objects.all().order_by('-posted') + return render_to_response('projects/list.html', { 'projects': projects, }) + +def comment(request): + fields = request.POST + project = Project.objects.get(pk=fields['project-id']) + + if ( fields.has_key('name') and + not fields['name'].strip() == '' and + not len(fields['name']) < 3 and + fields.has_key('body') and + not fields['body'].strip() == '' and + not len(fields['body']) < 3 and + not len(fields['body']) > 15000): + new_comment = Comment(name=fields['name'], + body=fields['body'], + project=project) + new_comment.save() + + return HttpResponseRedirect(reverse('stevelosh.projects.views.project', + args=(project.slug,))) \ No newline at end of file diff -r 000000000000 -r 5d5a567385bb settings.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/settings.py Tue Jan 13 19:37:21 2009 -0500 @@ -0,0 +1,86 @@ +import deploy + +DEBUG = deploy.DEBUG +TEMPLATE_DEBUG = DEBUG + +ADMINS = ( + ('Steve Losh', 'steve@stevelosh.com'), +) + +MANAGERS = ADMINS + +DATABASE_ENGINE = deploy.DATABASE_ENGINE +DATABASE_NAME = deploy.DATABASE_NAME +DATABASE_USER = deploy.DATABASE_USER +DATABASE_PASSWORD = deploy.DATABASE_PASSWORD +DATABASE_HOST = deploy.DATABASE_HOST +DATABASE_PORT = deploy.DATABASE_PORT + +# Local time zone for this installation. Choices can be found here: +# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name +# although not all choices may be available on all operating systems. +# If running in a Windows environment this must be set to the same as your +# system time zone. +TIME_ZONE = 'America/New_York' + +# Language code for this installation. All choices can be found here: +# http://www.i18nguy.com/unicode/language-identifiers.html +LANGUAGE_CODE = 'en-us' + +SITE_ID = 1 + +# If you set this to False, Django will make some optimizations so as not +# to load the internationalization machinery. +USE_I18N = True + +# Base directory. +BASE_DIR = deploy.BASE_DIR + +# Absolute path to the directory that holds media. +# Example: "/home/media/media.lawrence.com/" +MEDIA_ROOT = BASE_DIR + 'site-media/' + +# URL that handles the media served from MEDIA_ROOT. Make sure to use a +# trailing slash if there is a path component (optional in other cases). +# Examples: "http://media.lawrence.com", "http://example.com/media/" +MEDIA_URL = '/site-media/' + +# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a +# trailing slash. +# Examples: "http://foo.com/media/", "/media/". +ADMIN_MEDIA_PREFIX = '/media/' + +# Make this unique, and don't share it with anybody. +SECRET_KEY = deploy.SECRET_KEY + +# List of callables that know how to import templates from various sources. +TEMPLATE_LOADERS = ( + 'django.template.loaders.filesystem.load_template_source', + 'django.template.loaders.app_directories.load_template_source', +) + +MIDDLEWARE_CLASSES = ( + 'django.middleware.common.CommonMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', +) + +ROOT_URLCONF = 'stevelosh.urls' + +TEMPLATE_DIRS = ( + BASE_DIR + 'templates/', +) + +INSTALLED_APPS = ( + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.admin', + 'django.contrib.markup', + 'django.contrib.flatpages', + 'stevelosh.blog', + 'stevelosh.projects', + 'stevelosh.thoughts', +) diff -r 000000000000 -r 5d5a567385bb site-media/scripts/jquery.validate.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site-media/scripts/jquery.validate.min.js Tue Jan 13 19:37:21 2009 -0500 @@ -0,0 +1,16 @@ +/* + * jQuery validation plug-in 1.5 + * + * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ + * http://docs.jquery.com/Plugins/Validation + * + * Copyright (c) 2006 - 2008 Jörn Zaefferer + * + * $Id: jquery.validate.js 5952 2008-11-25 19:12:30Z joern.zaefferer $ + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ +(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){validator.settings.submitHandler.call(validator,validator.currentForm);return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=false;var validator=$(this[0].form).validate();this.each(function(){valid|=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(){result[this]=$element.attr(this);$element.removeAttr(this);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;},push:function(t){return this.setArray(this.add(t).get());}});$.extend($.expr[":"],{blank:function(a){return!$.trim(a.value);},filled:function(a){return!!$.trim(a.value);},unchecked:function(a){return!a.checked;}});$.format=function(source,params){if(arguments.length==1)return function(){var args=$.makeArray(arguments);args.unshift(source);return $.format.apply(this,args);};if(arguments.length>2&¶ms.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.validator=function(options,form){this.settings=$.extend({},$.validator.defaults,options);this.currentForm=form;this.init();};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);},highlight:function(element,errorClass){$(element).addClass(errorClass);},unhighlight:function(element,errorClass){$(element).removeClass(errorClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",dateDE:"Bitte geben Sie ein gültiges Datum ein.",number:"Please enter a valid number.",numberDE:"Bitte geben Sie eine Nummer ein.",digits:"Please enter only digits",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.format("Please enter no more than {0} characters."),minlength:$.format("Please enter at least {0} characters."),rangelength:$.format("Please enter a value between {0} and {1} characters long."),range:$.format("Please enter a value between {0} and {1}."),max:$.format("Please enter a value less than or equal to {0}."),min:$.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator");validator.settings["on"+event.type]&&validator.settings["on"+event.type].call(validator,this[0]);}$(this.currentForm).delegate("focusin focusout keyup",":text, :password, :file, select, textarea",delegate).delegate("click",":radio, :checkbox",delegate);if(this.settings.invalidHandler)$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())$(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide.push(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)$(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus();}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules()))return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.formSubmitted=false;this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().push(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value,element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id ++", check the '"+rule.method+"' method");throw e;}}if(dependencyMismatch)return;if(this.objectLength(rules))this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$.metadata)return;var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;iWarning: No message defined for "+element.name+"");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method);if(typeof message=="function")message=message.call(this,rule.parameters,element);this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)toToggle.push(toToggle.parents(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow.push(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+">").parent();}if(!this.labelContainer.append(label).length)this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow.push(label);},errorsFor:function(element){return this.errors().filter("[@for='"+this.idOrName(element)+"']");},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $("option:selected",element).length;case'input':if(this.checkable(element))return this.findByName(element.name).filter(':checked').length;}return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",previous={old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr('class');classes&&$.each(classes.split(' '),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules;},metadataRules:function(element){if(!$.metadata)return{};var meta=$.data(element.form,'validator').settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,'validator');if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message;if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))return"dependency-mismatch";switch(element.nodeName.toLowerCase()){case'select':var options=$("option:selected",element);return options.length>0&&(element.type=="select-multiple"||($.browser.msie&&!(options[0].attributes['value'].specified)?options[0].text:options[0].value).length>0);case'input':if(this.checkable(element))return this.getLength(value,element)>0;default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])this.settings.messages[element.name]={};this.settings.messages[element.name].remote=typeof previous.message=="function"?previous.message(value):previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){if(response){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};errors[element.name]=response||validator.defaultMessage(element,"remote");validator.showErrors(errors);}previous.valid=response;validator.stopRequest(element,response);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength(value,element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength(value,element)<=param;},rangelength:function(value,element,param){var length=this.getLength(value,element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},dateDE:function(value,element){return this.optional(element)||/^\d\d?\.\d\d?\.\d\d\d?\d?$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},numberDE:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:\.\d{3})+)(?:,\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))return"dependency-mismatch";if(/[^0-9-]+/.test(value))return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)nDigit-=9;}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param:"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){return value==$(param).val();}}});})(jQuery);;(function($){var ajax=$.ajax;var pendingRequests={};$.ajax=function(settings){settings=$.extend(settings,$.extend({},$.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};})(jQuery);;(function($){$.each({focus:'focusin',blur:'focusout'},function(original,fix){$.event.special[fix]={setup:function(){if($.browser.msie)return false;this.addEventListener(original,$.event.special[fix].handler,true);},teardown:function(){if($.browser.msie)return false;this.removeEventListener(original,$.event.special[fix].handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};});$.extend($.fn,{delegate:function(type,delegate,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});},triggerEvent:function(type,target){return this.triggerHandler(type,[$.event.fix({type:type,target:target})]);}})})(jQuery); \ No newline at end of file diff -r 000000000000 -r 5d5a567385bb site-media/scripts/validate-comment-form.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site-media/scripts/validate-comment-form.js Tue Jan 13 19:37:21 2009 -0500 @@ -0,0 +1,32 @@ +$(document).ready(function() { + var validator = $("#new-comment-form").validate({ + errorClass: 'invalid', + rules: { + name: { + required: true, + minlength: 3, + maxlength: 40 + }, + body: { + required: true, + minlength: 4, + maxlength: 15000 + } + }, + messages: { + name: { + required: "Please enter your name.", + minlength: jQuery.format("It has to be at least {0} letters."), + maxlength: jQuery.format("It can't be more than {0} letters."), + }, + body: { + required: "Please enter a comment.", + minlength: jQuery.format("It has to be at least {0} letters."), + maxlength: jQuery.format("It can't be more than {0} letters."), + }, + }, + errorPlacement: function(error, element) { + error.appendTo( element.parent() ); + }, + }); +}); \ No newline at end of file diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/images/bg-fill.png Binary file site-media/scripts/wmd/images/bg-fill.png has changed diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/images/bg.png Binary file site-media/scripts/wmd/images/bg.png has changed diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/images/blockquote.png Binary file site-media/scripts/wmd/images/blockquote.png has changed diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/images/bold.png Binary file site-media/scripts/wmd/images/bold.png has changed diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/images/code.png Binary file site-media/scripts/wmd/images/code.png has changed diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/images/h1.png Binary file site-media/scripts/wmd/images/h1.png has changed diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/images/hr.png Binary file site-media/scripts/wmd/images/hr.png has changed diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/images/img.png Binary file site-media/scripts/wmd/images/img.png has changed diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/images/italic.png Binary file site-media/scripts/wmd/images/italic.png has changed diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/images/link.png Binary file site-media/scripts/wmd/images/link.png has changed diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/images/ol.png Binary file site-media/scripts/wmd/images/ol.png has changed diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/images/redo.png Binary file site-media/scripts/wmd/images/redo.png has changed diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/images/separator.png Binary file site-media/scripts/wmd/images/separator.png has changed diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/images/ul.png Binary file site-media/scripts/wmd/images/ul.png has changed diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/images/undo.png Binary file site-media/scripts/wmd/images/undo.png has changed diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/images/wmd-on.png Binary file site-media/scripts/wmd/images/wmd-on.png has changed diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/images/wmd.png Binary file site-media/scripts/wmd/images/wmd.png has changed diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/showdown.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site-media/scripts/wmd/showdown.js Tue Jan 13 19:37:21 2009 -0500 @@ -0,0 +1,421 @@ +var Attacklab=Attacklab||{}; +Attacklab.showdown=Attacklab.showdown||{}; +Attacklab.showdown.converter=function(){ +this.obfuscation; +var _1; +var _2; +var _3; +var _4=0; +this.makeHtml=function(_5){ +_1=new Array(); +_2=new Array(); +_3=new Array(); +_5=_5.replace(/~/g,"~T"); +_5=_5.replace(/\$/g,"~D"); +_5=_5.replace(/\r\n/g,"\n"); +_5=_5.replace(/\r/g,"\n"); +_5="\n\n"+_5+"\n\n"; +_5=_6(_5); +_5=_5.replace(/^[ \t]+$/mg,""); +_5=_7(_5); +_5=_8(_5); +_5=_9(_5); +_5=_a(_5); +_5=_5.replace(/~D/g,"$$"); +_5=_5.replace(/~T/g,"~"); +return _5; +}; +var _8=function(_b){ +var _b=_b.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|\Z)/gm,function(_c,m1,m2,m3,m4){ +m1=m1.toLowerCase(); +_1[m1]=_11(m2); +if(m3){ +return m3+m4; +}else{ +if(m4){ +_2[m1]=m4.replace(/"/g,"""); +} +} +return ""; +}); +return _b; +}; +var _7=function(_12){ +_12=_12.replace(/\n/g,"\n\n"); +var _13="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del"; +var _14="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math"; +_12=_12.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,_15); +_12=_12.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,_15); +_12=_12.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,_15); +_12=_12.replace(/(\n\n[ ]{0,3}[ \t]*(?=\n{2,}))/g,_15); +_12=_12.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,_15); +_12=_12.replace(/\n\n/g,"\n"); +return _12; +}; +var _15=function(_16,m1){ +var _18=m1; +_18=_18.replace(/\n\n/g,"\n"); +_18=_18.replace(/^\n/,""); +_18=_18.replace(/\n+$/g,""); +_18="\n\n~K"+(_3.push(_18)-1)+"K\n\n"; +return _18; +}; +var _9=function(_19){ +_19=_1a(_19); +var key=_1c("
"); +_19=_19.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,key); +_19=_19.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,key); +_19=_19.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,key); +_19=_1d(_19); +_19=_1e(_19); +_19=_1f(_19); +_19=_7(_19); +_19=_20(_19); +return _19; +}; +var _21=function(_22){ +_22=_23(_22); +_22=_24(_22); +_22=_25(_22); +_22=_26(_22); +_22=_27(_22); +_22=_28(_22); +_22=_11(_22); +_22=_29(_22); +_22=_22.replace(/ +\n/g,"
\n"); +return _22; +}; +var _24=function(_2a){ +var _2b=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|)/gi; +_2a=_2a.replace(_2b,function(_2c){ +var tag=_2c.replace(/(.)<\/?code>(?=.)/g,"$1`"); +tag=_2e(tag,"\\`*_"); +return tag; +}); +return _2a; +}; +var _27=function(_2f){ +_2f=_2f.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,_30); +_2f=_2f.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,_30); +_2f=_2f.replace(/(\[([^\[\]]+)\])()()()()()/g,_30); +return _2f; +}; +var _30=function(_31,m1,m2,m3,m4,m5,m6,m7){ +if(m7==undefined){ +m7=""; +} +var _39=m1; +var _3a=m2; +var _3b=m3.toLowerCase(); +var url=m4; +var _3d=m7; +if(url==""){ +if(_3b==""){ +_3b=_3a.toLowerCase().replace(/ ?\n/g," "); +} +url="#"+_3b; +if(_1[_3b]!=undefined){ +url=_1[_3b]; +if(_2[_3b]!=undefined){ +_3d=_2[_3b]; +} +}else{ +if(_39.search(/\(\s*\)$/m)>-1){ +url=""; +}else{ +return _39; +} +} +} +url=_2e(url,"*_"); +var _3e=""; +return _3e; +}; +var _26=function(_3f){ +_3f=_3f.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,_40); +_3f=_3f.replace(/(!\[(.*?)\]\s?\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,_40); +return _3f; +}; +var _40=function(_41,m1,m2,m3,m4,m5,m6,m7){ +var _49=m1; +var _4a=m2; +var _4b=m3.toLowerCase(); +var url=m4; +var _4d=m7; +if(!_4d){ +_4d=""; +} +if(url==""){ +if(_4b==""){ +_4b=_4a.toLowerCase().replace(/ ?\n/g," "); +} +url="#"+_4b; +if(_1[_4b]!=undefined){ +url=_1[_4b]; +if(_2[_4b]!=undefined){ +_4d=_2[_4b]; +} +}else{ +return _49; +} +} +_4a=_4a.replace(/"/g,"""); +url=_2e(url,"*_"); +var _4e="\""+_4a+"\"";"+_21(m1)+""); +}); +_4f=_4f.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(_52,m1){ +return _1c("

"+_21(m1)+"

"); +}); +_4f=_4f.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(_54,m1,m2){ +var _57=m1.length; +return _1c(""+_21(m2)+""); +}); +return _4f; +}; +var _58; +var _1d=function(_59){ +_59+="~0"; +var _5a=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm; +if(_4){ +_59=_59.replace(_5a,function(_5b,m1,m2){ +var _5e=m1; +var _5f=(m2.search(/[*+-]/g)>-1)?"ul":"ol"; +_5e=_5e.replace(/\n{2,}/g,"\n\n\n"); +var _60=_58(_5e); +_60=_60.replace(/\s+$/,""); +_60="<"+_5f+">"+_60+"\n"; +return _60; +}); +}else{ +_5a=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g; +_59=_59.replace(_5a,function(_61,m1,m2,m3){ +var _65=m1; +var _66=m2; +var _67=(m3.search(/[*+-]/g)>-1)?"ul":"ol"; +var _66=_66.replace(/\n{2,}/g,"\n\n\n"); +var _68=_58(_66); +_68=_65+"<"+_67+">\n"+_68+"\n"; +return _68; +}); +} +_59=_59.replace(/~0/,""); +return _59; +}; +_58=function(_69){ +_4++; +_69=_69.replace(/\n{2,}$/,"\n"); +_69+="~0"; +_69=_69.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(_6a,m1,m2,m3,m4){ +var _6f=m4; +var _70=m1; +var _71=m2; +if(_70||(_6f.search(/\n{2,}/)>-1)){ +_6f=_9(_72(_6f)); +}else{ +_6f=_1d(_72(_6f)); +_6f=_6f.replace(/\n$/,""); +_6f=_21(_6f); +} +return "
  • "+_6f+"
  • \n"; +}); +_69=_69.replace(/~0/g,""); +_4--; +return _69; +}; +var _1e=function(_73){ +_73+="~0"; +_73=_73.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(_74,m1,m2){ +var _77=m1; +var _78=m2; +_77=_79(_72(_77)); +_77=_6(_77); +_77=_77.replace(/^\n+/g,""); +_77=_77.replace(/\n+$/g,""); +_77="
    "+_77+"\n
    "; +return _1c(_77)+_78; +}); +_73=_73.replace(/~0/,""); +return _73; +}; +var _1c=function(_7a){ +_7a=_7a.replace(/(^\n+|\n+$)/g,""); +return "\n\n~K"+(_3.push(_7a)-1)+"K\n\n"; +}; +var _23=function(_7b){ +_7b=_7b.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(_7c,m1,m2,m3,m4){ +var c=m3; +c=c.replace(/^([ \t]*)/g,""); +c=c.replace(/[ \t]*$/g,""); +c=_79(c); +return m1+""+c+""; +}); +return _7b; +}; +var _79=function(_82){ +_82=_82.replace(/&/g,"&"); +_82=_82.replace(//g,">"); +_82=_2e(_82,"*_{}[]\\",false); +return _82; +}; +var _29=function(_83){ +_83=_83.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"$2"); +_83=_83.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"$2"); +return _83; +}; +this.hidetable; +var _1f=function(_84){ +_84=_84.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(_85,m1){ +var bq=m1; +bq=bq.replace(/^[ \t]*>[ \t]?/gm,"~0"); +bq=bq.replace(/~0/g,""); +bq=bq.replace(/^[ \t]+$/gm,""); +bq=_9(bq); +bq=bq.replace(/(^|\n)/g,"$1 "); +bq=bq.replace(/(\s*
    [^\r]+?<\/pre>)/gm,function(_88,m1){
    +var pre=m1;
    +pre=pre.replace(/^  /mg,"~0");
    +pre=pre.replace(/~0/g,"");
    +return pre;
    +});
    +return _1c("
    \n"+bq+"\n
    "); +}); +return _84; +}; +var _20=function(_8b){ +_8b=_8b.replace(/^\n+/g,""); +_8b=_8b.replace(/\n+$/g,""); +var _8c=_8b.split(/\n{2,}/g); +var _8d=new Array(); +var end=_8c.length; +for(var i=0;i=0){ +_8d.push(str); +}else{ +if(str.search(/\S/)>=0){ +str=_21(str); +str=str.replace(/^([ \t]*)/g,"

    "); +str+="

    "; +_8d.push(str); +} +} +} +end=_8d.length; +for(var i=0;i=0){ +var _91=_3[RegExp.$1]; +_91=_91.replace(/\$/g,"$$$$"); +_8d[i]=_8d[i].replace(/~K\d+K/,_91); +} +} +return _8d.join("\n\n"); +}; +var _11=function(_92){ +_92=_92.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&"); +_92=_92.replace(/<(?![a-z\/?\$!])/gi,"<"); +return _92; +}; +var _25=function(_93){ +_93=_93.replace(/\\(\\)/g,_94); +_93=_93.replace(/\\([`*_{}\[\]()>#+-.!])/g,_94); +return _93; +}; +var _28=function(_95){ +_95=_95.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,"
    $1"); +_95=_95.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(_96,m1){ +return _98(_a(m1)); +}); +return _95; +}; +var _98=function(_99){ +function char2hex(ch){ +var _9b="0123456789ABCDEF"; +var dec=ch.charCodeAt(0); +return (_9b.charAt(dec>>4)+_9b.charAt(dec&15)); +} +var _9d=[function(ch){ +return "&#"+ch.charCodeAt(0)+";"; +},function(ch){ +return "&#x"+char2hex(ch)+";"; +},function(ch){ +return ch; +}]; +_99="mailto:"+_99; +_99=_99.replace(/./g,function(ch){ +if(ch=="@"){ +ch=_9d[Math.floor(Math.random()*2)](ch); +}else{ +if(ch!=":"){ +var r=Math.random(); +ch=(r>0.9?_9d[2](ch):r>0.45?_9d[1](ch):_9d[0](ch)); +} +} +return ch; +}); +_99=""+_99+""; +_99=_99.replace(/">.+:/g,"\">"); +return _99; +}; +var _a=function(_a3){ +_a3=_a3.replace(/~E(\d+)E/g,function(_a4,m1){ +var _a6=parseInt(m1); +return String.fromCharCode(_a6); +}); +return _a3; +}; +var _72=function(_a7){ +_a7=_a7.replace(/^(\t|[ ]{1,4})/gm,"~0"); +_a7=_a7.replace(/~0/g,""); +return _a7; +}; +var _6=function(_a8){ +_a8=_a8.replace(/\t(?=\t)/g," "); +_a8=_a8.replace(/\t/g,"~A~B"); +_a8=_a8.replace(/~B(.+?)~A/g,function(_a9,m1,m2){ +var _ac=m1; +var _ad=4-_ac.length%4; +for(var i=0;i<_ad;i++){ +_ac+=" "; +} +return _ac; +}); +_a8=_a8.replace(/~A/g," "); +_a8=_a8.replace(/~B/g,""); +return _a8; +}; +var _2e=function(_af,_b0,_b1){ +var _b2="(["+_b0.replace(/([\[\]\\])/g,"\\$1")+"])"; +if(_b1){ +_b2="\\\\"+_b2; +} +var _b3=new RegExp(_b2,"g"); +_af=_af.replace(_b3,_94); +return _af; +}; +var _94=function(_b4,m1){ +var _b6=m1.charCodeAt(0); +return "~E"+_b6+"E"; +}; +this.obfuscation; +}; +var Showdown=Attacklab.showdown; +if(Attacklab.fileLoaded){ +Attacklab.fileLoaded("showdown.js"); +} + diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/wmd-base.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site-media/scripts/wmd/wmd-base.js Tue Jan 13 19:37:21 2009 -0500 @@ -0,0 +1,1799 @@ +var Attacklab=Attacklab||{}; +Attacklab.wmdBase=function(){ +var _1=top; +var _2=_1["Attacklab"]; +var _3=_1["document"]; +var _4=_1["RegExp"]; +var _5=_1["navigator"]; +_2.Util={}; +_2.Position={}; +_2.Command={}; +var _6=_2.Util; +var _7=_2.Position; +var _8=_2.Command; +_2.Util.IE=(_5.userAgent.indexOf("MSIE")!=-1); +_2.Util.oldIE=(_5.userAgent.indexOf("MSIE 6.")!=-1||_5.userAgent.indexOf("MSIE 5.")!=-1); +_2.Util.newIE=!_2.Util.oldIE&&(_5.userAgent.indexOf("MSIE")!=-1); +_6.makeElement=function(_9,_a){ +var _b=_3.createElement(_9); +if(!_a){ +var _c=_b.style; +_c.margin="0"; +_c.padding="0"; +_c.clear="none"; +_c.cssFloat="none"; +_c.textAlign="left"; +_c.position="relative"; +_c.lineHeight="1em"; +_c.border="none"; +_c.color="black"; +_c.backgroundRepeat="no-repeat"; +_c.backgroundImage="none"; +_c.minWidth=_c.minHeight="0"; +_c.maxWidth=_c.maxHeight="90000px"; +} +return _b; +}; +_6.getStyle=function(_d,_e){ +var _f=function(_10){ +return _10.replace(/-(\S)/g,function(_11,_12){ +return _12.toUpperCase(); +}); +}; +if(_d.currentStyle){ +_e=_f(_e); +return _d.currentStyle[_e]; +}else{ +if(_1.getComputedStyle){ +return _3.defaultView.getComputedStyle(_d,null).getPropertyValue(_e); +} +} +return ""; +}; +_6.getElementsByClass=function(_13,_14,_15){ +var _16=[]; +if(_14==null){ +_14=_3; +} +if(_15==null){ +_15="*"; +} +var _17=_14.getElementsByTagName(_15); +var _18=_17.length; +var _19=new _4("(^|\\s)"+_13+"(\\s|$)"); +for(var i=0,j=0;i<_18;i++){ +if(_19.test(_17[i].className.toLowerCase())){ +_16[j]=_17[i]; +j++; +} +} +return _16; +}; +_6.addEvent=function(_1c,_1d,_1e){ +if(_1c.attachEvent){ +_1c.attachEvent("on"+_1d,_1e); +}else{ +_1c.addEventListener(_1d,_1e,false); +} +}; +_6.removeEvent=function(_1f,_20,_21){ +if(_1f.detachEvent){ +_1f.detachEvent("on"+_20,_21); +}else{ +_1f.removeEventListener(_20,_21,false); +} +}; +_6.regexToString=function(_22){ +var _23={}; +var _24=_22.toString(); +_23.expression=_24.replace(/\/([gim]*)$/,""); +_23.flags=_4.$1; +_23.expression=_23.expression.replace(/(^\/|\/$)/g,""); +return _23; +}; +_6.stringToRegex=function(_25){ +return new _4(_25.expression,_25.flags); +}; +_6.elementOk=function(_26){ +if(!_26||!_26.parentNode){ +return false; +} +if(_6.getStyle(_26,"display")=="none"){ +return false; +} +return true; +}; +_6.skin=function(_27,_28,_29,_2a){ +var _2b; +var _2c=(_5.userAgent.indexOf("MSIE")!=-1); +if(_2c){ +_6.fillers=[]; +} +var _2d=_29/2; +for(var _2e=0;_2e<4;_2e++){ +var _2f=_6.makeElement("div"); +_2b=_2f.style; +_2b.overflow="hidden"; +_2b.padding="0"; +_2b.margin="0"; +_2b.lineHeight="0px"; +_2b.height=_2d+"px"; +_2b.width="50%"; +_2b.maxHeight=_2d+"px"; +_2b.position="absolute"; +if(_2e&1){ +_2b.top="0"; +}else{ +_2b.bottom=-_29+"px"; +} +_2b.zIndex="-1000"; +if(_2e&2){ +_2b.left="0"; +}else{ +_2b.marginLeft="50%"; +} +if(_2c){ +var _30=_6.makeElement("span"); +_2b=_30.style; +_2b.height="100%"; +_2b.width=_2a; +_2b.filter="progid:DXImageTransform.Microsoft."+"AlphaImageLoader(src='"+_2.basePath+"images/bg.png')"; +_2b.position="absolute"; +if(_2e&1){ +_2b.top="0"; +}else{ +_2b.bottom="0"; +} +if(_2e&2){ +_2b.left="0"; +}else{ +_2b.right="0"; +} +_2f.appendChild(_30); +}else{ +_2b.backgroundImage="url("+_28+")"; +_2b.backgroundPosition=(_2e&2?"left":"right")+" "+(_2e&1?"top":"bottom"); +} +_27.appendChild(_2f); +} +var _31=function(_32){ +var _33=_6.makeElement("div"); +if(_6.fillers){ +_6.fillers.push(_33); +} +_2b=_33.style; +_2b.overflow="hidden"; +_2b.padding="0"; +_2b.margin="0"; +_2b.marginTop=_2d+"px"; +_2b.lineHeight="0px"; +_2b.height="100%"; +_2b.width="50%"; +_2b.position="absolute"; +_2b.zIndex="-1000"; +if(_2c){ +var _34=_6.makeElement("span"); +_2b=_34.style; +_2b.height="100%"; +_2b.width=_2a; +_2b.filter="progid:DXImageTransform.Microsoft."+"AlphaImageLoader(src='"+_2.basePath+"images/bg-fill.png',sizingMethod='scale')"; +_2b.position="absolute"; +_33.appendChild(_34); +if(_32){ +_2b.left="0"; +} +if(!_32){ +_2b.right="0"; +} +} +if(!_2c){ +_2b.backgroundImage="url("+_2.basePath+"images/bg-fill.png)"; +_2b.backgroundRepeat="repeat-y"; +if(_32){ +_2b.backgroundPosition="left top"; +} +if(!_32){ +_2b.backgroundPosition="right top"; +} +} +if(!_32){ +_33.style.marginLeft="50%"; +} +return _33; +}; +_27.appendChild(_31(true)); +_27.appendChild(_31(false)); +}; +_6.setImage=function(_35,_36,_37,_38){ +_36=_2.basePath+_36; +if(_5.userAgent.indexOf("MSIE")!=-1){ +var _39=_35.firstChild; +var _3a=_39.style; +_3a.filter="progid:DXImageTransform.Microsoft."+"AlphaImageLoader(src='"+_36+"')"; +}else{ +_35.src=_36; +} +return _35; +}; +_6.createImage=function(_3b,_3c,_3d){ +_3b=_2.basePath+_3b; +if(_5.userAgent.indexOf("MSIE")!=-1){ +var _3e=_6.makeElement("span"); +var _3f=_3e.style; +_3f.display="inline-block"; +_3f.height="1px"; +_3f.width="1px"; +_3e.unselectable="on"; +var _40=_6.makeElement("span"); +_3f=_40.style; +_3f.display="inline-block"; +_3f.height="1px"; +_3f.width="1px"; +_3f.filter="progid:DXImageTransform.Microsoft."+"AlphaImageLoader(src='"+_3b+"')"; +_40.unselectable="on"; +_3e.appendChild(_40); +}else{ +var _3e=_6.makeElement("img"); +_3e.style.display="inline"; +_3e.src=_3b; +} +_3e.style.border="none"; +_3e.border="0"; +if(_3c&&_3d){ +_3e.style.width=_3c+"px"; +_3e.style.height=_3d+"px"; +} +return _3e; +}; +_6.prompt=function(_41,_42,_43){ +var _44; +var _45,_46,_47; +var _48=function(_49){ +var _4a=(_49.charCode||_49.keyCode); +if(_4a==27){ +_4b(true); +} +}; +var _4b=function(_4c){ +_6.removeEvent(_3.body,"keydown",_48); +var _4d=_47.value; +if(_4c){ +_4d=null; +} +_45.parentNode.removeChild(_45); +_46.parentNode.removeChild(_46); +_43(_4d); +return false; +}; +if(_42==undefined){ +_42=""; +} +var _4e=function(){ +_46=_6.makeElement("div"); +_44=_46.style; +_3.body.appendChild(_46); +_44.position="absolute"; +_44.top="0"; +_44.left="0"; +_44.backgroundColor="#000"; +_44.zIndex="1000"; +var _4f=/konqueror/.test(_5.userAgent.toLowerCase()); +if(_4f){ +_44.backgroundColor="transparent"; +}else{ +_44.opacity="0.5"; +_44.filter="alpha(opacity=50)"; +} +var _50=_7.getPageSize(); +_44.width="100%"; +_44.height=_50[1]+"px"; +}; +var _51=function(){ +_45=_3.createElement("div"); +_45.style.border="3px solid #333"; +_45.style.backgroundColor="#ccc"; +_45.style.padding="10px;"; +_45.style.borderTop="3px solid white"; +_45.style.borderLeft="3px solid white"; +_45.style.position="fixed"; +_45.style.width="400px"; +_45.style.zIndex="1001"; +var _52=_6.makeElement("div"); +_44=_52.style; +_44.fontSize="14px"; +_44.fontFamily="Helvetica, Arial, Verdana, sans-serif"; +_44.padding="5px"; +_52.innerHTML=_41; +_45.appendChild(_52); +var _53=_6.makeElement("form"); +_53.onsubmit=function(){ +return _4b(); +}; +_44=_53.style; +_44.padding="0"; +_44.margin="0"; +_44.cssFloat="left"; +_44.width="100%"; +_44.textAlign="center"; +_44.position="relative"; +_45.appendChild(_53); +_47=_3.createElement("input"); +_47.value=_42; +_44=_47.style; +_44.display="block"; +_44.width="80%"; +_44.marginLeft=_44.marginRight="auto"; +_44.backgroundColor="white"; +_44.color="black"; +_53.appendChild(_47); +var _54=_3.createElement("input"); +_54.type="button"; +_54.onclick=function(){ +return _4b(); +}; +_54.value="OK"; +_44=_54.style; +_44.margin="10px"; +_44.display="inline"; +_44.width="7em"; +var _55=_3.createElement("input"); +_55.type="button"; +_55.onclick=function(){ +return _4b(true); +}; +_55.value="Cancel"; +_44=_55.style; +_44.margin="10px"; +_44.display="inline"; +_44.width="7em"; +if(/mac/.test(_5.platform.toLowerCase())){ +_53.appendChild(_55); +_53.appendChild(_54); +}else{ +_53.appendChild(_54); +_53.appendChild(_55); +} +_6.addEvent(_3.body,"keydown",_48); +_45.style.top="50%"; +_45.style.left="50%"; +_45.style.display="block"; +if(_2.Util.oldIE){ +var _56=_7.getPageSize(); +_45.style.position="absolute"; +_45.style.top=_3.documentElement.scrollTop+200+"px"; +_45.style.left="50%"; +} +_3.body.appendChild(_45); +_45.style.marginTop=-(_7.getHeight(_45)/2)+"px"; +_45.style.marginLeft=-(_7.getWidth(_45)/2)+"px"; +}; +_4e(); +_1.setTimeout(function(){ +_51(); +var _57=_42.length; +if(_47.selectionStart!=undefined){ +_47.selectionStart=0; +_47.selectionEnd=_57; +}else{ +if(_47.createTextRange){ +var _58=_47.createTextRange(); +_58.collapse(false); +_58.moveStart("character",-_57); +_58.moveEnd("character",_57); +_58.select(); +} +} +_47.focus(); +},0); +}; +_6.objectsEqual=function(_59,_5a){ +for(var _5b in _59){ +if(_59[_5b]!=_5a[_5b]){ +return false; +} +} +for(_5b in _5a){ +if(_59[_5b]!=_5a[_5b]){ +return false; +} +} +return true; +}; +_6.cloneObject=function(_5c){ +var _5d={}; +for(var _5e in _5c){ +_5d[_5e]=_5c[_5e]; +} +return _5d; +}; +_6.escapeUnderscores=function(_5f){ +_5f=_5f.replace(/(\S)(_+)(\S)/g,function(_60,_61,_62,_63){ +_62=_62.replace(/_/g,"_"); +return _61+_62+_63; +}); +return _5f; +}; +_7.getPageSize=function(){ +var _64,_65; +var _66,_67; +if(_1.innerHeight&&_1.scrollMaxY){ +_64=_3.body.scrollWidth; +_65=_1.innerHeight+_1.scrollMaxY; +}else{ +if(_3.body.scrollHeight>_3.body.offsetHeight){ +_64=_3.body.scrollWidth; +_65=_3.body.scrollHeight; +}else{ +_64=_3.body.offsetWidth; +_65=_3.body.offsetHeight; +} +} +var _68,_69; +if(self.innerHeight){ +_68=self.innerWidth; +_69=self.innerHeight; +}else{ +if(_3.documentElement&&_3.documentElement.clientHeight){ +_68=_3.documentElement.clientWidth; +_69=_3.documentElement.clientHeight; +}else{ +if(_3.body){ +_68=_3.body.clientWidth; +_69=_3.body.clientHeight; +} +} +} +if(_65<_69){ +_67=_69; +}else{ +_67=_65; +} +if(_64<_68){ +_66=_68; +}else{ +_66=_64; +} +var _6a=[_66,_67,_68,_69]; +return _6a; +}; +_7.getPixelVal=function(_6b){ +if(_6b&&/^(-?\d+(\.\d*)?)px$/.test(_6b)){ +return _4.$1; +} +return undefined; +}; +_7.getTop=function(_6c,_6d){ +var _6e=_6c.offsetTop; +if(!_6d){ +while(_6c=_6c.offsetParent){ +_6e+=_6c.offsetTop; +} +} +return _6e; +}; +_7.setTop=function(_6f,_70,_71){ +var _72=_7.getPixelVal(_6f.style.top); +if(_72==undefined){ +_6f.style.top=_70+"px"; +_72=_70; +} +var _73=_7.getTop(_6f,_71)-_72; +_6f.style.top=(_70-_73)+"px"; +}; +_7.getLeft=function(_74,_75){ +var _76=_74.offsetLeft; +if(!_75){ +while(_74=_74.offsetParent){ +_76+=_74.offsetLeft; +} +} +return _76; +}; +_7.setLeft=function(_77,_78,_79){ +var _7a=_7.getPixelVal(_77.style.left); +if(_7a==undefined){ +_77.style.left=_78+"px"; +_7a=_78; +} +var _7b=_7.getLeft(_77,_79)-_7a; +_77.style.left=(_78-_7b)+"px"; +}; +_7.getHeight=function(_7c){ +var _7d=_7c.offsetHeight; +if(!_7d){ +_7d=_7c.scrollHeight; +} +return _7d; +}; +_7.setHeight=function(_7e,_7f){ +var _80=_7.getPixelVal(_7e.style.height); +if(_80==undefined){ +_7e.style.height=_7f+"px"; +_80=_7f; +} +var _81=_7.getHeight(_7e)-_80; +if(_81>_7f){ +_81=_7f; +} +_7e.style.height=(_7f-_81)+"px"; +}; +_7.getWidth=function(_82){ +var _83=_82.offsetWidth; +if(!_83){ +_83=_82.scrollWidth; +} +return _83; +}; +_7.setWidth=function(_84,_85){ +var _86=_7.getPixelVal(_84.style.width); +if(_86==undefined){ +_84.style.width=_85+"px"; +_86=_85; +} +var _87=_7.getWidth(_84)-_86; +if(_87>_85){ +_87=_85; +} +_84.style.width=(_85-_87)+"px"; +}; +_7.getWindowHeight=function(){ +if(_1.innerHeight){ +return _1.innerHeight; +}else{ +if(_3.documentElement&&_3.documentElement.clientHeight){ +return _3.documentElement.clientHeight; +}else{ +if(_3.body){ +return _3.body.clientHeight; +} +} +} +}; +_2.inputPoller=function(_88,_89,_8a){ +var _8b=this; +var _8c; +var _8d; +var _8e,_8f; +this.tick=function(){ +if(!_6.elementOk(_88)){ +return; +} +if(_88.selectionStart||_88.selectionStart==0){ +var _90=_88.selectionStart; +var _91=_88.selectionEnd; +if(_90!=_8c||_91!=_8d){ +_8c=_90; +_8d=_91; +if(_8e!=_88.value){ +_8e=_88.value; +return true; +} +} +} +return false; +}; +var _92=function(){ +if(_6.getStyle(_88,"display")=="none"){ +return; +} +if(_8b.tick()){ +_89(); +} +}; +var _93=function(){ +if(_8a==undefined){ +_8a=500; +} +_8f=_1.setInterval(_92,_8a); +}; +this.destroy=function(){ +_1.clearInterval(_8f); +}; +_93(); +}; +_2.undoManager=function(_94,_95){ +var _96=this; +var _97=[]; +var _98=0; +var _99="none"; +var _9a; +var _9b; +var _9c; +var _9d; +var _9e=function(_9f,_a0){ +if(_99!=_9f){ +_99=_9f; +if(!_a0){ +_a1(); +} +} +if(!_2.Util.IE||_99!="moving"){ +_9c=_1.setTimeout(_a2,1); +}else{ +_9d=null; +} +}; +var _a2=function(){ +_9d=new _2.textareaState(_94); +_9b.tick(); +_9c=undefined; +}; +this.setCommandMode=function(){ +_99="command"; +_a1(); +_9c=_1.setTimeout(_a2,0); +}; +this.canUndo=function(){ +return _98>1; +}; +this.canRedo=function(){ +if(_97[_98+1]){ +return true; +} +return false; +}; +this.undo=function(){ +if(_96.canUndo()){ +if(_9a){ +_9a.restore(); +_9a=null; +}else{ +_97[_98]=new _2.textareaState(_94); +_97[--_98].restore(); +if(_95){ +_95(); +} +} +} +_99="none"; +_94.focus(); +_a2(); +}; +this.redo=function(){ +if(_96.canRedo()){ +_97[++_98].restore(); +if(_95){ +_95(); +} +} +_99="none"; +_94.focus(); +_a2(); +}; +var _a1=function(){ +var _a3=_9d||new _2.textareaState(_94); +if(!_a3){ +return false; +} +if(_99=="moving"){ +if(!_9a){ +_9a=_a3; +} +return; +} +if(_9a){ +if(_97[_98-1].text!=_9a.text){ +_97[_98++]=_9a; +} +_9a=null; +} +_97[_98++]=_a3; +_97[_98+1]=null; +if(_95){ +_95(); +} +}; +var _a4=function(_a5){ +var _a6=false; +if(_a5.ctrlKey||_a5.metaKey){ +var _a7=(_a5.charCode||_a5.keyCode)|96; +var _a8=String.fromCharCode(_a7); +switch(_a8){ +case "y": +_96.redo(); +_a6=true; +break; +case "z": +if(!_a5.shiftKey){ +_96.undo(); +}else{ +_96.redo(); +} +_a6=true; +break; +} +} +if(_a6){ +if(_a5.preventDefault){ +_a5.preventDefault(); +} +if(_1.event){ +_1.event.returnValue=false; +} +return; +} +}; +var _a9=function(_aa){ +if(!_aa.ctrlKey&&!_aa.metaKey){ +var _ab=_aa.keyCode; +if((_ab>=33&&_ab<=40)||(_ab>=63232&&_ab<=63235)){ +_9e("moving"); +}else{ +if(_ab==8||_ab==46||_ab==127){ +_9e("deleting"); +}else{ +if(_ab==13){ +_9e("newlines"); +}else{ +if(_ab==27){ +_9e("escape"); +}else{ +if((_ab<16||_ab>20)&&_ab!=91){ +_9e("typing"); +} +} +} +} +} +} +}; +var _ac=function(){ +_6.addEvent(_94,"keypress",function(_ad){ +if((_ad.ctrlKey||_ad.metaKey)&&(_ad.keyCode==89||_ad.keyCode==90)){ +_ad.preventDefault(); +} +}); +var _ae=function(){ +if(_2.Util.IE||(_9d&&_9d.text!=_94.value)){ +if(_9c==undefined){ +_99="paste"; +_a1(); +_a2(); +} +} +}; +_9b=new _2.inputPoller(_94,_ae,100); +_6.addEvent(_94,"keydown",_a4); +_6.addEvent(_94,"keydown",_a9); +_6.addEvent(_94,"mousedown",function(){ +_9e("moving"); +}); +_94.onpaste=_ae; +_94.ondrop=_ae; +}; +var _af=function(){ +_ac(); +_a2(); +_a1(); +}; +this.destroy=function(){ +if(_9b){ +_9b.destroy(); +} +}; +_af(); +}; +_2.editor=function(_b0,_b1){ +if(!_b1){ +_b1=function(){ +}; +} +var _b2=28; +var _b3=4076; +var _b4=0; +var _b5,_b6; +var _b7=this; +var _b8,_b9; +var _ba,_bb,_bc; +var _bd,_be,_bf; +var _c0=[]; +var _c1=function(_c2){ +if(_bd){ +_bd.setCommandMode(); +} +var _c3=new _2.textareaState(_b0); +if(!_c3){ +return; +} +var _c4=_c3.getChunks(); +var _c5=function(){ +_b0.focus(); +if(_c4){ +_c3.setChunks(_c4); +} +_c3.restore(); +_b1(); +}; +var _c6=_c2(_c4,_c5); +if(!_c6){ +_c5(); +} +}; +var _c7=function(_c8){ +_b0.focus(); +if(_c8.textOp){ +_c1(_c8.textOp); +} +if(_c8.execute){ +_c8.execute(_b7); +} +}; +var _c9=function(_ca,_cb){ +var _cc=_ca.style; +if(_cb){ +_cc.opacity="1.0"; +_cc.KHTMLOpacity="1.0"; +if(_2.Util.newIE){ +_cc.filter=""; +} +if(_2.Util.oldIE){ +_cc.filter="chroma(color=fuchsia)"; +} +_cc.cursor="pointer"; +_ca.onmouseover=function(){ +_cc.backgroundColor="lightblue"; +_cc.border="1px solid blue"; +}; +_ca.onmouseout=function(){ +_cc.backgroundColor=""; +_cc.border="1px solid transparent"; +if(_2.Util.oldIE){ +_cc.borderColor="fuchsia"; +_cc.filter="chroma(color=fuchsia)"+_cc.filter; +} +}; +}else{ +_cc.opacity="0.4"; +_cc.KHTMLOpacity="0.4"; +if(_2.Util.oldIE){ +_cc.filter="chroma(color=fuchsia) alpha(opacity=40)"; +} +if(_2.Util.newIE){ +_cc.filter="alpha(opacity=40)"; +} +_cc.cursor=""; +_cc.backgroundColor=""; +if(_ca.onmouseout){ +_ca.onmouseout(); +} +_ca.onmouseover=_ca.onmouseout=null; +} +}; +var _cd=function(_ce){ +_ce&&_c0.push(_ce); +}; +var _cf=function(){ +_c0.push("|"); +}; +var _d0=function(){ +var _d1=_6.createImage("images/separator.png",20,20); +_d1.style.padding="4px"; +_d1.style.paddingTop="0px"; +_b9.appendChild(_d1); +}; +var _d2=function(_d3){ +if(_d3.image){ +var _d4=_6.createImage(_d3.image,16,16); +_d4.border=0; +if(_d3.description){ +var _d5=_d3.description; +if(_d3.key){ +var _d6=" Ctrl+"; +_d5+=_d6+_d3.key.toUpperCase(); +} +_d4.title=_d5; +} +_c9(_d4,true); +var _d7=_d4.style; +_d7.margin="0px"; +_d7.padding="1px"; +_d7.marginTop="7px"; +_d7.marginBottom="5px"; +_d4.onmouseout(); +var _d8=_d4; +_d8.onclick=function(){ +if(_d8.onmouseout){ +_d8.onmouseout(); +} +_c7(_d3); +return false; +}; +_b9.appendChild(_d8); +return _d8; +} +return; +}; +var _d9=function(){ +for(var _da in _c0){ +if(_c0[_da]=="|"){ +_d0(); +}else{ +_d2(_c0[_da]); +} +} +}; +var _db=function(){ +if(_bd){ +_c9(_be,_bd.canUndo()); +_c9(_bf,_bd.canRedo()); +} +}; +var _dc=function(){ +if(_b0.offsetParent){ +_ba=_6.makeElement("div"); +var _dd=_ba.style; +_dd.visibility="hidden"; +_dd.top=_dd.left=_dd.width="0px"; +_dd.display="inline"; +_dd.cssFloat="left"; +_dd.overflow="visible"; +_dd.opacity="0.999"; +_b8.style.position="absolute"; +_ba.appendChild(_b8); +_b0.style.marginTop=""; +var _de=_7.getTop(_b0); +_b0.style.marginTop="0"; +var _df=_7.getTop(_b0); +_b4=_de-_df; +_e0(); +_b0.parentNode.insertBefore(_ba,_b0); +_e1(); +_6.skin(_b8,_2.basePath+"images/bg.png",_b2,_b3); +_dd.visibility="visible"; +return true; +} +return false; +}; +var _e2=function(){ +var _e3=_2.wmd_env.buttons.split(/\s+/); +for(var _e4 in _e3){ +switch(_e3[_e4]){ +case "|": +_cf(); +break; +case "bold": +_cd(_8.bold); +break; +case "italic": +_cd(_8.italic); +break; +case "link": +_cd(_8.link); +break; +} +if(_2.full){ +switch(_e3[_e4]){ +case "blockquote": +_cd(_8.blockquote); +break; +case "code": +_cd(_8.code); +break; +case "image": +_cd(_8.img); +break; +case "ol": +_cd(_8.ol); +break; +case "ul": +_cd(_8.ul); +break; +case "heading": +_cd(_8.h1); +break; +case "hr": +_cd(_8.hr); +break; +} +} +} +return; +}; +var _e5=function(){ +if(/\?noundo/.test(_3.location.href)){ +_2.nativeUndo=true; +} +if(!_2.nativeUndo){ +_bd=new _2.undoManager(_b0,function(){ +_b1(); +_db(); +}); +} +var _e6=_b0.parentNode; +_b8=_6.makeElement("div"); +_b8.style.display="block"; +_b8.style.zIndex=100; +if(!_2.full){ +_b8.title+="\n(Free Version)"; +} +_b8.unselectable="on"; +_b8.onclick=function(){ +_b0.focus(); +}; +_b9=_6.makeElement("span"); +var _e7=_b9.style; +_e7.height="auto"; +_e7.paddingBottom="2px"; +_e7.lineHeight="0"; +_e7.paddingLeft="15px"; +_e7.paddingRight="65px"; +_e7.display="block"; +_e7.position="absolute"; +_b9.unselectable="on"; +_b8.appendChild(_b9); +_cd(_8.autoindent); +var _e8=_6.createImage("images/bg.png"); +var _e9=_6.createImage("images/bg-fill.png"); +_e2(); +_d9(); +if(_bd){ +_d0(); +_be=_d2(_8.undo); +_bf=_d2(_8.redo); +var _ea=_5.platform.toLowerCase(); +if(/win/.test(_ea)){ +_be.title+=" - Ctrl+Z"; +_bf.title+=" - Ctrl+Y"; +}else{ +if(/mac/.test(_ea)){ +_be.title+=" - Ctrl+Z"; +_bf.title+=" - Ctrl+Shift+Z"; +}else{ +_be.title+=" - Ctrl+Z"; +_bf.title+=" - Ctrl+Shift+Z"; +} +} +} +var _eb="keydown"; +if(_5.userAgent.indexOf("Opera")!=-1){ +_eb="keypress"; +} +_6.addEvent(_b0,_eb,function(_ec){ +var _ed=false; +if(_ec.ctrlKey||_ec.metaKey){ +var _ee=(_ec.charCode||_ec.keyCode); +var _ef=String.fromCharCode(_ee).toLowerCase(); +for(var _f0 in _c0){ +var _f1=_c0[_f0]; +if(_f1.key&&_ef==_f1.key||_f1.keyCode&&_ec.keyCode==_f1.keyCode){ +_c7(_f1); +_ed=true; +} +} +} +if(_ed){ +if(_ec.preventDefault){ +_ec.preventDefault(); +} +if(_1.event){ +_1.event.returnValue=false; +} +} +}); +_6.addEvent(_b0,"keyup",function(_f2){ +if(_f2.shiftKey&&!_f2.ctrlKey&&!_f2.metaKey){ +var _f3=(_f2.charCode||_f2.keyCode); +switch(_f3){ +case 13: +_c7(_8.autoindent); +break; +} +} +}); +if(!_dc()){ +_bc=_1.setInterval(function(){ +if(_dc()){ +_1.clearInterval(_bc); +} +},100); +} +_6.addEvent(_1,"resize",_e1); +_bb=_1.setInterval(_e1,100); +if(_b0.form){ +var _f4=_b0.form.onsubmit; +_b0.form.onsubmit=function(){ +_f5(); +if(_f4){ +return _f4.apply(this,arguments); +} +}; +} +_db(); +}; +var _f5=function(){ +if(_2.showdown){ +var _f6=new _2.showdown.converter(); +} +var _f7=_b0.value; +var _f8=function(){ +_b0.value=_f7; +}; +_f7=_6.escapeUnderscores(_f7); +if(!/markdown/.test(_2.wmd_env.output.toLowerCase())){ +if(_f6){ +_b0.value=_f6.makeHtml(_f7); +_1.setTimeout(_f8,0); +} +} +return true; +}; +var _e0=function(){ +var _f9=_6.makeElement("div"); +var _fa=_f9.style; +_fa.paddingRight="15px"; +_fa.height="100%"; +_fa.display="block"; +_fa.position="absolute"; +_fa.right="0"; +_f9.unselectable="on"; +var _fb=_6.makeElement("a"); +_fa=_fb.style; +_fa.position="absolute"; +_fa.right="10px"; +_fa.top="5px"; +_fa.display="inline"; +_fa.width="50px"; +_fa.height="25px"; +_fb.href="http://www.wmd-editor.com/"; +_fb.target="_blank"; +_fb.title="WMD: The Wysiwym Markdown Editor"; +var _fc=_6.createImage("images/wmd.png"); +var _fd=_6.createImage("images/wmd-on.png"); +_fb.appendChild(_fc); +_fb.onmouseover=function(){ +_6.setImage(_fc,"images/wmd-on.png"); +_fb.style.cursor="pointer"; +}; +_fb.onmouseout=function(){ +_6.setImage(_fc,"images/wmd.png"); +}; +_b8.appendChild(_fb); +}; +var _e1=function(){ +if(!_6.elementOk(_b0)){ +_b8.style.display="none"; +return; +} +if(_b8.style.display=="none"){ +_b8.style.display="block"; +} +var _fe=_7.getWidth(_b0); +var _ff=_7.getHeight(_b0); +var _100=_7.getLeft(_b0); +if(_b8.style.width==_fe+"px"&&_b5==_ff&&_b6==_100){ +if(_7.getTop(_b8)<_7.getTop(_b0)){ +return; +} +} +_b5=_ff; +_b6=_100; +var _101=100; +_b8.style.width=Math.max(_fe,_101)+"px"; +var root=_b8.offsetParent; +var _103=_7.getHeight(_b9); +var _104=_103-_b2+"px"; +_b8.style.height=_104; +if(_6.fillers){ +_6.fillers[0].style.height=_6.fillers[1].style.height=_104; +} +var _105=3; +_b0.style.marginTop=_103+_105+_b4+"px"; +var _106=_7.getTop(_b0); +var _100=_7.getLeft(_b0); +_7.setTop(root,_106-_103-_105); +_7.setLeft(root,_100); +_b8.style.opacity=_b8.style.opacity||0.999; +return; +}; +this.undo=function(){ +if(_bd){ +_bd.undo(); +} +}; +this.redo=function(){ +if(_bd){ +_bd.redo(); +} +}; +var init=function(){ +_e5(); +}; +this.destroy=function(){ +if(_bd){ +_bd.destroy(); +} +if(_ba.parentNode){ +_ba.parentNode.removeChild(_ba); +} +if(_b0){ +_b0.style.marginTop=""; +} +_1.clearInterval(_bb); +_1.clearInterval(_bc); +}; +init(); +}; +_2.textareaState=function(_108){ +var _109=this; +var _10a=function(_10b){ +if(_6.getStyle(_108,"display")=="none"){ +return; +} +var _10c=_5.userAgent.indexOf("Opera")!=-1; +if(_10b.selectionStart!=undefined&&!_10c){ +_10b.focus(); +_10b.selectionStart=_109.start; +_10b.selectionEnd=_109.end; +_10b.scrollTop=_109.scrollTop; +}else{ +if(_3.selection){ +if(_3.activeElement&&_3.activeElement!=_108){ +return; +} +_10b.focus(); +var _10d=_10b.createTextRange(); +_10d.moveStart("character",-_10b.value.length); +_10d.moveEnd("character",-_10b.value.length); +_10d.moveEnd("character",_109.end); +_10d.moveStart("character",_109.start); +_10d.select(); +} +} +}; +this.init=function(_10e){ +if(_10e){ +_108=_10e; +} +if(_6.getStyle(_108,"display")=="none"){ +return; +} +_10f(_108); +_109.scrollTop=_108.scrollTop; +if(!_109.text&&_108.selectionStart||_108.selectionStart=="0"){ +_109.text=_108.value; +} +}; +var _110=function(_111){ +_111=_111.replace(/\r\n/g,"\n"); +_111=_111.replace(/\r/g,"\n"); +return _111; +}; +var _10f=function(){ +if(_108.selectionStart||_108.selectionStart=="0"){ +_109.start=_108.selectionStart; +_109.end=_108.selectionEnd; +}else{ +if(_3.selection){ +_109.text=_110(_108.value); +var _112=_3.selection.createRange(); +var _113=_110(_112.text); +var _114="\x07"; +var _115=_114+_113+_114; +_112.text=_115; +var _116=_110(_108.value); +_112.moveStart("character",-_115.length); +_112.text=_113; +_109.start=_116.indexOf(_114); +_109.end=_116.lastIndexOf(_114)-_114.length; +var _117=_109.text.length-_110(_108.value).length; +if(_117){ +_112.moveStart("character",-_113.length); +while(_117--){ +_113+="\n"; +_109.end+=1; +} +_112.text=_113; +} +_10a(_108); +} +} +return _109; +}; +this.restore=function(_118){ +if(!_118){ +_118=_108; +} +if(_109.text!=undefined&&_109.text!=_118.value){ +_118.value=_109.text; +} +_10a(_118,_109); +_118.scrollTop=_109.scrollTop; +}; +this.getChunks=function(){ +var _119=new _2.Chunks(); +_119.before=_110(_109.text.substring(0,_109.start)); +_119.startTag=""; +_119.selection=_110(_109.text.substring(_109.start,_109.end)); +_119.endTag=""; +_119.after=_110(_109.text.substring(_109.end)); +_119.scrollTop=_109.scrollTop; +return _119; +}; +this.setChunks=function(_11a){ +_11a.before=_11a.before+_11a.startTag; +_11a.after=_11a.endTag+_11a.after; +var _11b=_5.userAgent.indexOf("Opera")!=-1; +if(_11b){ +_11a.before=_11a.before.replace(/\n/g,"\r\n"); +_11a.selection=_11a.selection.replace(/\n/g,"\r\n"); +_11a.after=_11a.after.replace(/\n/g,"\r\n"); +} +_109.start=_11a.before.length; +_109.end=_11a.before.length+_11a.selection.length; +_109.text=_11a.before+_11a.selection+_11a.after; +_109.scrollTop=_11a.scrollTop; +}; +this.init(); +}; +_2.Chunks=function(){ +}; +_2.Chunks.prototype.findTags=function(_11c,_11d){ +var _11e,_11f; +var _120=this; +if(_11c){ +_11f=_6.regexToString(_11c); +_11e=new _4(_11f.expression+"$",_11f.flags); +this.before=this.before.replace(_11e,function(_121){ +_120.startTag=_120.startTag+_121; +return ""; +}); +_11e=new _4("^"+_11f.expression,_11f.flags); +this.selection=this.selection.replace(_11e,function(_122){ +_120.startTag=_120.startTag+_122; +return ""; +}); +} +if(_11d){ +_11f=_6.regexToString(_11d); +_11e=new _4(_11f.expression+"$",_11f.flags); +this.selection=this.selection.replace(_11e,function(_123){ +_120.endTag=_123+_120.endTag; +return ""; +}); +_11e=new _4("^"+_11f.expression,_11f.flags); +this.after=this.after.replace(_11e,function(_124){ +_120.endTag=_124+_120.endTag; +return ""; +}); +} +}; +_2.Chunks.prototype.trimWhitespace=function(_125){ +this.selection=this.selection.replace(/^(\s*)/,""); +if(!_125){ +this.before+=_4.$1; +} +this.selection=this.selection.replace(/(\s*)$/,""); +if(!_125){ +this.after=_4.$1+this.after; +} +}; +_2.Chunks.prototype.skipLines=function(_126,_127,_128){ +if(_126==undefined){ +_126=1; +} +if(_127==undefined){ +_127=1; +} +_126++; +_127++; +var _129,_12a; +this.selection=this.selection.replace(/(^\n*)/,""); +this.startTag=this.startTag+_4.$1; +this.selection=this.selection.replace(/(\n*$)/,""); +this.endTag=this.endTag+_4.$1; +this.startTag=this.startTag.replace(/(^\n*)/,""); +this.before=this.before+_4.$1; +this.endTag=this.endTag.replace(/(\n*$)/,""); +this.after=this.after+_4.$1; +if(this.before){ +_129=_12a=""; +while(_126--){ +_129+="\\n?"; +_12a+="\n"; +} +if(_128){ +_129="\\n*"; +} +this.before=this.before.replace(new _4(_129+"$",""),_12a); +} +if(this.after){ +_129=_12a=""; +while(_127--){ +_129+="\\n?"; +_12a+="\n"; +} +if(_128){ +_129="\\n*"; +} +this.after=this.after.replace(new _4(_129,""),_12a); +} +}; +_8.prefixes="(?:\\s{4,}|\\s*>|\\s*-\\s+|\\s*\\d+\\.|=|\\+|-|_|\\*|#|\\s*\\[[^\n]]+\\]:)"; +_8.unwrap=function(_12b){ +var _12c=new _4("([^\\n])\\n(?!(\\n|"+_8.prefixes+"))","g"); +_12b.selection=_12b.selection.replace(_12c,"$1 $2"); +}; +_8.wrap=function(_12d,len){ +_8.unwrap(_12d); +var _12f=new _4("(.{1,"+len+"})( +|$\\n?)","gm"); +_12d.selection=_12d.selection.replace(_12f,function(_130,line){ +if(new _4("^"+_8.prefixes,"").test(_130)){ +return _130; +} +return line+"\n"; +}); +_12d.selection=_12d.selection.replace(/\s+$/,""); +}; +_8.doBold=function(_132){ +return _8.doBorI(_132,2,"strong text"); +}; +_8.doItalic=function(_133){ +return _8.doBorI(_133,1,"emphasized text"); +}; +_8.doBorI=function(_134,_135,_136){ +_134.trimWhitespace(); +_134.selection=_134.selection.replace(/\n{2,}/g,"\n"); +_134.before.search(/(\**$)/); +var _137=_4.$1; +_134.after.search(/(^\**)/); +var _138=_4.$1; +var _139=Math.min(_137.length,_138.length); +if((_139>=_135)&&(_139!=2||_135!=1)){ +_134.before=_134.before.replace(_4("[*]{"+_135+"}$",""),""); +_134.after=_134.after.replace(_4("^[*]{"+_135+"}",""),""); +return; +} +if(!_134.selection&&_138){ +_134.after=_134.after.replace(/^([*_]*)/,""); +_134.before=_134.before.replace(/(\s?)$/,""); +var _13a=_4.$1; +_134.before=_134.before+_138+_13a; +return; +} +if(!_134.selection&&!_138){ +_134.selection=_136; +} +var _13b=_135<=1?"*":"**"; +_134.before=_134.before+_13b; +_134.after=_13b+_134.after; +}; +_8.stripLinkDefs=function(_13c,_13d){ +_13c=_13c.replace(/^[ ]{0,3}\[(\d+)\]:[ \t]*\n?[ \t]*?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|$)/gm,function(_13e,id,_140,_141,_142){ +_13d[id]=_13e.replace(/\s*$/,""); +if(_141){ +_13d[id]=_13e.replace(/["(](.+?)[")]$/,""); +return _141+_142; +} +return ""; +}); +return _13c; +}; +_8.addLinkDef=function(_143,_144){ +var _145=0; +var _146={}; +_143.before=_8.stripLinkDefs(_143.before,_146); +_143.selection=_8.stripLinkDefs(_143.selection,_146); +_143.after=_8.stripLinkDefs(_143.after,_146); +var _147=""; +var _148=/(\[(?:\[[^\]]*\]|[^\[\]])*\][ ]?(?:\n[ ]*)?\[)(\d+)(\])/g; +var _149=function(def){ +_145++; +def=def.replace(/^[ ]{0,3}\[(\d+)\]:/," ["+_145+"]:"); +_147+="\n"+def; +}; +var _14b=function(_14c,_14d,id,end){ +if(_146[id]){ +_149(_146[id]); +return _14d+_145+end; +} +return _14c; +}; +_143.before=_143.before.replace(_148,_14b); +if(_144){ +_149(_144); +}else{ +_143.selection=_143.selection.replace(_148,_14b); +} +var _150=_145; +_143.after=_143.after.replace(_148,_14b); +if(_143.after){ +_143.after=_143.after.replace(/\n*$/,""); +} +if(!_143.after){ +_143.selection=_143.selection.replace(/\n*$/,""); +} +_143.after+="\n\n"+_147; +return _150; +}; +_8.doLinkOrImage=function(_151,_152,_153){ +_151.trimWhitespace(); +_151.findTags(/\s*!?\[/,/\][ ]?(?:\n[ ]*)?(\[.*?\])?/); +if(_151.endTag.length>1){ +_151.startTag=_151.startTag.replace(/!?\[/,""); +_151.endTag=""; +_8.addLinkDef(_151,null); +}else{ +if(/\n\n/.test(_151.selection)){ +_8.addLinkDef(_151,null); +return; +} +var _154; +var _155=function(_156){ +if(_156!=null){ +_151.startTag=_151.endTag=""; +var _157=" [999]: "+_156; +var num=_8.addLinkDef(_151,_157); +_151.startTag=_152?"![":"["; +_151.endTag="]["+num+"]"; +if(!_151.selection){ +if(_152){ +_151.selection="alt text"; +}else{ +_151.selection="link text"; +} +} +} +_153(); +}; +if(_152){ +_154=_6.prompt("

    Enter the image URL.

    You can also add a title, which will be displayed as a tool tip.

    Example:
    http://wmd-editor.com/images/cloud1.jpg \"Optional title\"

    ","http://",_155); +}else{ +_154=_6.prompt("

    Enter the web address.

    You can also add a title, which will be displayed as a tool tip.

    Example:
    http://wmd-editor.com/ \"Optional title\"

    ","http://",_155); +} +return true; +} +}; +_8.bold={}; +_8.bold.description="Strong "; +_8.bold.image="images/bold.png"; +_8.bold.key="b"; +_8.bold.textOp=_8.doBold; +_8.italic={}; +_8.italic.description="Emphasis "; +_8.italic.image="images/italic.png"; +_8.italic.key="i"; +_8.italic.textOp=_8.doItalic; +_8.link={}; +_8.link.description="Hyperlink "; +_8.link.image="images/link.png"; +_8.link.key="l"; +_8.link.textOp=function(_159,_15a){ +return _8.doLinkOrImage(_159,false,_15a); +}; +_8.undo={}; +_8.undo.description="Undo"; +_8.undo.image="images/undo.png"; +_8.undo.execute=function(_15b){ +_15b.undo(); +}; +_8.redo={}; +_8.redo.description="Redo"; +_8.redo.image="images/redo.png"; +_8.redo.execute=function(_15c){ +_15c.redo(); +}; +_6.findPanes=function(_15d){ +_15d.preview=_15d.preview||_6.getElementsByClass("wmd-preview",null,"div")[0]; +_15d.output=_15d.output||_6.getElementsByClass("wmd-output",null,"textarea")[0]; +_15d.output=_15d.output||_6.getElementsByClass("wmd-output",null,"div")[0]; +if(!_15d.input){ +var _15e=-1; +var _15f=_3.getElementsByTagName("textarea"); +for(var _160=0;_160<_15f.length;_160++){ +var _161=_15f[_160]; +if(_161!=_15d.output&&!/wmd-ignore/.test(_161.className.toLowerCase())){ +_15d.input=_161; +break; +} +} +} +return _15d; +}; +_6.makeAPI=function(){ +_2.wmd={}; +_2.wmd.editor=_2.editor; +_2.wmd.previewManager=_2.previewManager; +}; +_6.startEditor=function(){ +if(_2.wmd_env.autostart==false){ +_2.editorInit(); +_6.makeAPI(); +return; +} +var _162={}; +var _163,_164; +var _165=function(){ +try{ +var _166=_6.cloneObject(_162); +_6.findPanes(_162); +if(!_6.objectsEqual(_166,_162)&&_162.input){ +if(!_163){ +_2.editorInit(); +var _167; +if(_2.previewManager!=undefined){ +_164=new _2.previewManager(_162); +_167=_164.refresh; +} +_163=new _2.editor(_162.input,_167); +}else{ +if(_164){ +_164.refresh(true); +} +} +} +} +catch(e){ +} +}; +_6.addEvent(_1,"load",_165); +var _168=_1.setInterval(_165,100); +}; +_2.previewManager=function(_169){ +var _16a=this; +var _16b,_16c; +var _16d,_16e; +var _16f,_170; +var _171=3000; +var _172="delayed"; +var _173=function(_174,_175){ +_6.addEvent(_174,"input",_175); +_174.onpaste=_175; +_174.ondrop=_175; +_6.addEvent(_1,"keypress",_175); +_6.addEvent(_174,"keypress",_175); +_6.addEvent(_174,"keydown",_175); +_16c=new _2.inputPoller(_174,_175); +}; +var _176=function(){ +var _177=0; +if(_1.innerHeight){ +_177=_1.pageYOffset; +}else{ +if(_3.documentElement&&_3.documentElement.scrollTop){ +_177=_3.documentElement.scrollTop; +}else{ +if(_3.body){ +_177=_3.body.scrollTop; +} +} +} +return _177; +}; +var _178=function(){ +if(!_169.preview&&!_169.output){ +return; +} +var text=_169.input.value; +if(text&&text==_16f){ +return; +}else{ +_16f=text; +} +var _17a=new Date().getTime(); +if(!_16b&&_2.showdown){ +_16b=new _2.showdown.converter(); +} +text=_6.escapeUnderscores(text); +if(_16b){ +text=_16b.makeHtml(text); +} +var _17b=new Date().getTime(); +_16e=_17b-_17a; +_17c(text); +_170=text; +}; +var _17d=function(){ +if(_16d){ +_1.clearTimeout(_16d); +_16d=undefined; +} +if(_172!="manual"){ +var _17e=0; +if(_172=="delayed"){ +_17e=_16e; +} +if(_17e>_171){ +_17e=_171; +} +_16d=_1.setTimeout(_178,_17e); +} +}; +var _17f; +var _180; +var _181=function(_182){ +if(_182.scrollHeight<=_182.clientHeight){ +return 1; +} +return _182.scrollTop/(_182.scrollHeight-_182.clientHeight); +}; +var _183=function(_184,_185){ +_184.scrollTop=(_184.scrollHeight-_184.clientHeight)*_185; +}; +var _186=function(){ +if(_169.preview){ +_17f=_181(_169.preview); +} +if(_169.output){ +_180=_181(_169.output); +} +}; +var _187=function(){ +if(_169.preview){ +_169.preview.scrollTop=_169.preview.scrollTop; +_183(_169.preview,_17f); +} +if(_169.output){ +_183(_169.output,_180); +} +}; +this.refresh=function(_188){ +if(_188){ +_16f=""; +_178(); +}else{ +_17d(); +} +}; +this.processingTime=function(){ +return _16e; +}; +this.output=function(){ +return _170; +}; +this.setUpdateMode=function(_189){ +_172=_189; +_16a.refresh(); +}; +var _18a=true; +var _17c=function(text){ +_186(); +var _18c=_7.getTop(_169.input)-_176(); +if(_169.output){ +if(_169.output.value!=undefined){ +_169.output.value=text; +_169.output.readOnly=true; +}else{ +var _18d=text.replace(/&/g,"&"); +_18d=_18d.replace(/
    "; +} +} +if(_169.preview){ +_169.preview.innerHTML=text; +} +_187(); +if(_18a){ +_18a=false; +return; +} +var _18e=_7.getTop(_169.input)-_176(); +if(_5.userAgent.indexOf("MSIE")!=-1){ +_1.setTimeout(function(){ +_1.scrollBy(0,_18e-_18c); +},0); +}else{ +_1.scrollBy(0,_18e-_18c); +} +}; +var init=function(){ +_173(_169.input,_17d); +_178(); +if(_169.preview){ +_169.preview.scrollTop=0; +} +if(_169.output){ +_169.output.scrollTop=0; +} +}; +this.destroy=function(){ +if(_16c){ +_16c.destroy(); +} +}; +init(); +}; +}; +if(Attacklab.fileLoaded){ +Attacklab.fileLoaded("wmd-base.js"); +} + diff -r 000000000000 -r 5d5a567385bb site-media/scripts/wmd/wmd-plus.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site-media/scripts/wmd/wmd-plus.js Tue Jan 13 19:37:21 2009 -0500 @@ -0,0 +1,311 @@ +var Attacklab=Attacklab||{}; +Attacklab.wmdPlus=function(){ +this.symboltable; +var _1=top; +var _2=_1["Attacklab"]; +var _3=_1["document"]; +var _4=_1["RegExp"]; +var _5=_1["navigator"]; +var _6=_2.Util; +var _7=_2.Position; +var _8=_2.Command; +_8.doAutoindent=function(_9){ +_9.before=_9.before.replace(/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]*\n$/,"\n\n"); +_9.before=_9.before.replace(/(\n|^)[ ]{0,3}>[ \t]*\n$/,"\n\n"); +_9.before=_9.before.replace(/(\n|^)[ \t]+\n$/,"\n\n"); +if(/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]+.*\n$/.test(_9.before)){ +if(_8.doList){ +_8.doList(_9); +} +} +if(/(\n|^)[ ]{0,3}>[ \t]+.*\n$/.test(_9.before)){ +if(_8.doBlockquote){ +_8.doBlockquote(_9); +} +} +if(/(\n|^)(\t|[ ]{4,}).*\n$/.test(_9.before)){ +if(_8.doCode){ +_8.doCode(_9); +} +} +}; +_8.doBlockquote=function(_a){ +_a.selection=_a.selection.replace(/^(\n*)([^\r]+?)(\n*)$/,function(_b,_c,_d,_e){ +_a.before+=_c; +_a.after=_e+_a.after; +return _d; +}); +_a.before=_a.before.replace(/(>[ \t]*)$/,function(_f,_10){ +_a.selection=_10+_a.selection; +return ""; +}); +_a.selection=_a.selection.replace(/^(\s|>)+$/,""); +_a.selection=_a.selection||"Blockquote"; +if(_a.before){ +_a.before=_a.before.replace(/\n?$/,"\n"); +} +if(_a.after){ +_a.after=_a.after.replace(/^\n?/,"\n"); +} +_a.before=_a.before.replace(/(((\n|^)(\n[ \t]*)*>(.+\n)*.*)+(\n[ \t]*)*$)/,function(_11){ +_a.startTag=_11; +return ""; +}); +_a.after=_a.after.replace(/^(((\n|^)(\n[ \t]*)*>(.+\n)*.*)+(\n[ \t]*)*)/,function(_12){ +_a.endTag=_12; +return ""; +}); +var _13=function(_14){ +var _15=_14?"> ":""; +if(_a.startTag){ +_a.startTag=_a.startTag.replace(/\n((>|\s)*)\n$/,function(_16,_17){ +return "\n"+_17.replace(/^[ ]{0,3}>?[ \t]*$/gm,_15)+"\n"; +}); +} +if(_a.endTag){ +_a.endTag=_a.endTag.replace(/^\n((>|\s)*)\n/,function(_18,_19){ +return "\n"+_19.replace(/^[ ]{0,3}>?[ \t]*$/gm,_15)+"\n"; +}); +} +}; +if(/^(?![ ]{0,3}>)/m.test(_a.selection)){ +_8.wrap(_a,_2.wmd_env.lineLength-2); +_a.selection=_a.selection.replace(/^/gm,"> "); +_13(true); +_a.skipLines(); +}else{ +_a.selection=_a.selection.replace(/^[ ]{0,3}> ?/gm,""); +_8.unwrap(_a); +_13(false); +if(!/^(\n|^)[ ]{0,3}>/.test(_a.selection)){ +if(_a.startTag){ +_a.startTag=_a.startTag.replace(/\n{0,2}$/,"\n\n"); +} +} +if(!/(\n|^)[ ]{0,3}>.*$/.test(_a.selection)){ +if(_a.endTag){ +_a.endTag=_a.endTag.replace(/^\n{0,2}/,"\n\n"); +} +} +} +if(!/\n/.test(_a.selection)){ +_a.selection=_a.selection.replace(/^(> *)/,function(_1a,_1b){ +_a.startTag+=_1b; +return ""; +}); +} +}; +_8.doCode=function(_1c){ +var _1d=/\S[ ]*$/.test(_1c.before); +var _1e=/^[ ]*\S/.test(_1c.after); +if((!_1e&&!_1d)||/\n/.test(_1c.selection)){ +_1c.before=_1c.before.replace(/[ ]{4}$/,function(_1f){ +_1c.selection=_1f+_1c.selection; +return ""; +}); +var _20=1; +var _21=1; +if(/\n(\t|[ ]{4,}).*\n$/.test(_1c.before)){ +_20=0; +} +if(/^\n(\t|[ ]{4,})/.test(_1c.after)){ +_21=0; +} +_1c.skipLines(_20,_21); +if(!_1c.selection){ +_1c.startTag=" "; +_1c.selection="print(\"code sample\");"; +return; +} +if(/^[ ]{0,3}\S/m.test(_1c.selection)){ +_1c.selection=_1c.selection.replace(/^/gm," "); +}else{ +_1c.selection=_1c.selection.replace(/^[ ]{4}/gm,""); +} +}else{ +_1c.trimWhitespace(); +_1c.findTags(/`/,/`/); +if(!_1c.startTag&&!_1c.endTag){ +_1c.startTag=_1c.endTag="`"; +if(!_1c.selection){ +_1c.selection="print(\"code sample\");"; +} +}else{ +if(_1c.endTag&&!_1c.startTag){ +_1c.before+=_1c.endTag; +_1c.endTag=""; +}else{ +_1c.startTag=_1c.endTag=""; +} +} +} +}; +_8.autoindent={}; +_8.autoindent.textOp=_8.doAutoindent; +_8.blockquote={}; +_8.blockquote.description="Blockquote
    "; +_8.blockquote.image="images/blockquote.png"; +_8.blockquote.key="."; +_8.blockquote.keyCode=190; +_8.blockquote.textOp=function(_22){ +return _8.doBlockquote(_22); +}; +_8.code={}; +_8.code.description="Code Sample
    ";
    +_8.code.image="images/code.png";
    +_8.code.key="k";
    +_8.code.textOp=_8.doCode;
    +_8.img={};
    +_8.img.description="Image ";
    +_8.img.image="images/img.png";
    +_8.img.key="g";
    +_8.img.textOp=function(_23,_24){
    +return _8.doLinkOrImage(_23,true,_24);
    +};
    +_8.doList=function(_25,_26){
    +var _27=/(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*/;
    +var _28="";
    +var _29=1;
    +var _2a=function(){
    +if(_26){
    +var _2b=" "+_29+". ";
    +_29++;
    +return _2b;
    +}
    +var _2c=_28||"-";
    +return "  "+_2c+" ";
    +};
    +var _2d=function(_2e){
    +if(_26==undefined){
    +_26=/^\s*\d/.test(_2e);
    +}
    +_2e=_2e.replace(/^[ ]{0,3}([*+-]|\d+[.])\s/gm,function(_2f){
    +return _2a();
    +});
    +return _2e;
    +};
    +var _30=function(){
    +_31=_6.regexToString(_27);
    +_31.expression="^\n*"+_31.expression;
    +var _32=_6.stringToRegex(_31);
    +_25.after=_25.after.replace(_32,_2d);
    +};
    +_25.findTags(/(\n|^)*[ ]{0,3}([*+-]|\d+[.])\s+/,null);
    +var _33=/^\n/;
    +if(_25.before&&!/\n$/.test(_25.before)&&!_33.test(_25.startTag)){
    +_25.before+=_25.startTag;
    +_25.startTag="";
    +}
    +if(_25.startTag){
    +var _34=/\d+[.]/.test(_25.startTag);
    +_25.startTag="";
    +_25.selection=_25.selection.replace(/\n[ ]{4}/g,"\n");
    +_8.unwrap(_25);
    +_25.skipLines();
    +if(_34){
    +_30();
    +}
    +if(_26==_34){
    +return;
    +}
    +}
    +var _35=1;
    +var _31=_6.regexToString(_27);
    +_31.expression="(\\n|^)"+_31.expression+"$";
    +var _36=_6.stringToRegex(_31);
    +_25.before=_25.before.replace(_36,function(_37){
    +if(/^\s*([*+-])/.test(_37)){
    +_28=_4.$1;
    +}
    +_35=/[^\n]\n\n[^\n]/.test(_37)?1:0;
    +return _2d(_37);
    +});
    +if(!_25.selection){
    +_25.selection="List item";
    +}
    +var _38=_2a();
    +var _39=1;
    +_31=_6.regexToString(_27);
    +_31.expression="^\n*"+_31.expression;
    +_36=_6.stringToRegex(_31);
    +_25.after=_25.after.replace(_36,function(_3a){
    +_39=/[^\n]\n\n[^\n]/.test(_3a)?1:0;
    +return _2d(_3a);
    +});
    +_25.trimWhitespace(true);
    +_25.skipLines(_35,_39,true);
    +_25.startTag=_38;
    +var _3b=_38.replace(/./g," ");
    +_8.wrap(_25,_2.wmd_env.lineLength-_3b.length);
    +_25.selection=_25.selection.replace(/\n/g,"\n"+_3b);
    +};
    +_8.doHeading=function(_3c){
    +_3c.selection=_3c.selection.replace(/\s+/g," ");
    +_3c.selection=_3c.selection.replace(/(^\s+|\s+$)/g,"");
    +var _3d=0;
    +_3c.findTags(/#+[ ]*/,/[ ]*#+/);
    +if(/#+/.test(_3c.startTag)){
    +_3d=_4.lastMatch.length;
    +}
    +_3c.startTag=_3c.endTag="";
    +_3c.findTags(null,/\s?(-+|=+)/);
    +if(/=+/.test(_3c.endTag)){
    +_3d=1;
    +}
    +if(/-+/.test(_3c.endTag)){
    +_3d=2;
    +}
    +_3c.startTag=_3c.endTag="";
    +_3c.skipLines(1,1);
    +if(!_3c.selection){
    +_3c.startTag="## ";
    +_3c.selection="Heading";
    +_3c.endTag=" ##";
    +return;
    +}
    +var _3e=_3d==0?2:_3d-1;
    +if(_3e){
    +var _3f=_3e>=2?"-":"=";
    +var _40=_3c.selection.length;
    +if(_40>_2.wmd_env.lineLength){
    +_40=_2.wmd_env.lineLength;
    +}
    +_3c.endTag="\n";
    +while(_40--){
    +_3c.endTag+=_3f;
    +}
    +}
    +};
    +_8.ol={};
    +_8.ol.description="Numbered List 
      "; +_8.ol.image="images/ol.png"; +_8.ol.key="o"; +_8.ol.textOp=function(_41){ +_8.doList(_41,true); +}; +_8.ul={}; +_8.ul.description="Bulleted List