Skip to content

Commit

Permalink
files added
Browse files Browse the repository at this point in the history
  • Loading branch information
arkokoley committed Apr 21, 2014
0 parents commit a3e5f10
Show file tree
Hide file tree
Showing 22 changed files with 2,973 additions and 0 deletions.
618 changes: 618 additions & 0 deletions includes/parsehtml/parsehtml.php

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions includes/wps-functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

if (! function_exists('render')) {
function render($p) {
// available sections
$pages = array(
'dashboard',
'edit'
);

if ( in_array($p, $pages) ) {
require_once ADMIN_PATH . "views/$p.php";
}else {
wp_redirect( $current_page . 'index.php?page=dashboard' );
}
}
}

?>
49 changes: 49 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

/*
* Including wp-functions
*
*/

require_once(dirname(dirname(__FILE__)) . '/wp-blog-header.php');

/*
* Checking logued user
*
*/
if (!is_user_logged_in()) {
auth_redirect();
}

if(!current_user_can('publish_posts') or !current_user_can('edit_posts')){
die('You do not have sufficient permissions to access this page.');
}


/*
* Definition of admin path
*
*/

if (! defined("ABSPATH")) {
define("ABSPATH", dirname(dirname(__FILE__)) . "/");
}

define("ADMIN_PATH", ABSPATH . "dash/");

/*
* Runing application
*
*/
require_once ADMIN_PATH . "includes/wps-functions.php";

$page = $_GET['page'] ? $_GET['page'] : '';

if($page === '') {
wp_redirect($current_page . 'index.php?page=dashboard');
}

render($page);


?>
163 changes: 163 additions & 0 deletions js/jquery.textarea-expander.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
// Autosize 1.11 - jQuery plugin for textareas
// (c) 2012 Jack Moore - jacklmoore.com
// license: www.opensource.org/licenses/mit-license.php

(function ($) {
var
hidden = 'hidden',
borderBox = 'border-box',
lineHeight = 'lineHeight',
copy = '<textarea tabindex="-1" style="position:absolute; top:-9999px; left:-9999px; right:auto; bottom:auto; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden;">',
// line-height is omitted because IE7/IE8 doesn't return the correct value.
copyStyle = [
'fontFamily',
'fontSize',
'fontWeight',
'fontStyle',
'letterSpacing',
'textTransform',
'wordSpacing',
'textIndent'
],
oninput = 'oninput',
onpropertychange = 'onpropertychange',
test = $(copy)[0];

// For testing support in old FireFox
test.setAttribute(oninput, "return");

if ($.isFunction(test[oninput]) || onpropertychange in test) {

// test that line-height can be accurately copied to avoid
// incorrect value reporting in old IE and old Opera
$(test).css(lineHeight, '99px');
if ($(test).css(lineHeight) === '99px') {
copyStyle.push(lineHeight);
}

$.fn.autosize = function (className) {
return this.each(function () {
var
ta = this,
$ta = $(ta),
mirror,
minHeight = $ta.height(),
maxHeight = parseInt($ta.css('maxHeight'), 10),
active,
i = copyStyle.length,
resize,
boxOffset = 0;

if ($ta.css('box-sizing') === borderBox || $ta.css('-moz-box-sizing') === borderBox || $ta.css('-webkit-box-sizing') === borderBox){
boxOffset = $ta.outerHeight() - $ta.height();
}

if ($ta.data('mirror') || $ta.data('ismirror')) {
// if autosize has already been applied, exit.
// if autosize is being applied to a mirror element, exit.
return;
} else {
mirror = $(copy).data('ismirror', true).addClass(className || 'autosizejs')[0];

resize = $ta.css('resize') === 'none' ? 'none' : 'horizontal';

$ta.data('mirror', $(mirror)).css({
overflow: hidden,
overflowY: hidden,
wordWrap: 'break-word',
resize: resize
});
}

// Opera returns '-1px' when max-height is set to 'none'.
maxHeight = maxHeight && maxHeight > 0 ? maxHeight : 9e4;

// Using mainly bare JS in this function because it is going
// to fire very often while typing, and needs to very efficient.
function adjust() {
var height, overflow;
// the active flag keeps IE from tripping all over itself. Otherwise
// actions in the adjust function will cause IE to call adjust again.
if (!active) {
active = true;

mirror.value = ta.value;

mirror.style.overflowY = ta.style.overflowY;

// Update the width in case the original textarea width has changed
mirror.style.width = $ta.css('width');

// Needed for IE to reliably return the correct scrollHeight
mirror.scrollTop = 0;

// Set a very high value for scrollTop to be sure the
// mirror is scrolled all the way to the bottom.
mirror.scrollTop = 9e4;

height = mirror.scrollTop;
overflow = hidden;
if (height > maxHeight) {
height = maxHeight;
overflow = 'scroll';
} else if (height < minHeight) {
height = minHeight;
}
ta.style.overflowY = overflow;

ta.style.height = height + boxOffset + 'px';

// This small timeout gives IE a chance to draw it's scrollbar
// before adjust can be run again (prevents an infinite loop).
setTimeout(function () {
active = false;
}, 1);
}
}

// mirror is a duplicate textarea located off-screen that
// is automatically updated to contain the same text as the
// original textarea. mirror always has a height of 0.
// This gives a cross-browser supported way getting the actual
// height of the text, through the scrollTop property.
while (i--) {
mirror.style[copyStyle[i]] = $ta.css(copyStyle[i]);
}

$('body').append(mirror);

if (onpropertychange in ta) {
if (oninput in ta) {
// Detects IE9. IE9 does not fire onpropertychange or oninput for deletions,
// so binding to onkeyup to catch most of those occassions. There is no way that I
// know of to detect something like 'cut' in IE9.
ta[oninput] = ta.onkeyup = adjust;
} else {
// IE7 / IE8
ta[onpropertychange] = adjust;
}
} else {
// Modern Browsers
ta[oninput] = adjust;
}

$(window).resize(adjust);

// Allow for manual triggering if needed.
$ta.bind('autosize', adjust);

// Hack to get Chrome to reflow it's text.
$ta.text($ta.text());

// Call adjust in case the textarea already contains text.
adjust();
});
};
} else {
// Makes no changes for older browsers (FireFox3- and Safari4-)
$.fn.autosize = function () {
return this;
};
}

}(jQuery));
72 changes: 72 additions & 0 deletions js/markdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*! Licensed under MIT, https://github.com/sofish/pen */
(function() {

// only works with Pen
if(!this.Pen) return;

// markdown covertor obj
var covertor = {
keymap: { '96': '`', '62': '>', '49': '1', '46': '.', '45': '-', '42': '*', '35': '#'},
stack : []
};

// return valid markdown syntax
covertor.valid = function(str) {
var len = str.length;

if(str.match(/[#]{1,6}/)) {
return ['h' + len, len];
} else if(str === '```') {
return ['pre', len];
} else if(str === '>') {
return ['blockquote', len];
} else if(str === '1.') {
return ['insertorderedlist', len];
} else if(str === '-' || str === '*') {
return ['insertunorderedlist', len];
} else if(str.match(/(?:\.|\*|\-){3,}/)) {
return ['inserthorizontalrule', len];
}
};

// parse command
covertor.parse = function(e) {
var code = e.keyCode || e.which;

// when `space` is pressed
if(code === 32) {
var cmd = this.stack.join('');
this.stack.length = 0;
return this.valid(cmd);
}

// make cmd
if(this.keymap[code]) this.stack.push(this.keymap[code]);

return false;
};

// exec command
covertor.action = function(pen, cmd) {

// only apply effect at line start
if(pen._sel.focusOffset > cmd[1]) return;

var node = pen._sel.focusNode;
node.textContent = node.textContent.slice(cmd[1]);
pen._actions(cmd[0]);
pen.nostyle();
};

// init covertor
covertor.init = function(pen) {
pen.config.editor.addEventListener('keypress', function(e) {
var cmd = covertor.parse(e);
if(cmd) return covertor.action(pen, cmd);
});
};

// append to Pen
window.Pen.prototype.markdown = covertor;

}());
1 change: 1 addition & 0 deletions js/pen.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added logout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
$(function() {
$(".double a.button").click(function(){
$(".double a.button").removeClass("checked");
$("input.RadioClass").attr("checked",null);

$(this).prev("input.RadioClass").attr("checked","checked");
$(this).addClass("checked");
});

$(".remove").click(function(){
var answer = confirm('Are you sure?');
return answer;
});

// preview in iframe on the edit page
$("a.button.preview").click(function(e){
// does the iframe exist already?
if ($("iframe.preview").length) {
// stop the event propogation
e.preventDefault();
// display the preview pane
$("div.preview").fadeIn(500);
}
});

// close preview
$("a.close").click(function(e){
e.preventDefault();
$("div.preview").fadeOut(500);
});
});
Loading

0 comments on commit a3e5f10

Please sign in to comment.