Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made some changes for Jo ellen

moved js to another file.
auto resize text areas
some other minor changes
  • Loading branch information...
commit a8eb5ecb6f59ea1f176f557f1d2e9183514f662f 1 parent b59d74b
Josh Hassara authored
View
6 config.php
@@ -1,12 +1,12 @@
<?
$seo_field_array=array(
- 'html'=>array(
+ 'target'=>array(
'title'=>75,
- 'meta_description'=>175,
+ 'meta_description'=>55,
'h1'=>100,
'h1_blurb'=>300
),
- 'meta'=>array(
+ 'extras'=>array(
'subject'=>200,
'meta_title'=>75,
'meta_keywords'=>250,
View
274 pages/admin/seo/webpage/js/jquery.autoresize.js
@@ -0,0 +1,274 @@
+/*
+ * jQuery.fn.autoResize 1.14
+ * --
+ * https://github.com/padolsey/jQuery.fn.autoResize
+ * --
+ * This program is free software. It comes without any warranty, to
+ * the extent permitted by applicable law. You can redistribute it
+ * and/or modify it under the terms of the Do What The Fuck You Want
+ * To Public License, Version 2, as published by Sam Hocevar. See
+ * http://sam.zoy.org/wtfpl/COPYING for more details. */
+
+(function($){
+
+ var uid = 'ar' + +new Date,
+
+ defaults = autoResize.defaults = {
+ onResize: function(){},
+ onBeforeResize: function(){return 123},
+ onAfterResize: function(){return 555},
+ animate: {
+ duration: 200,
+ complete: function(){}
+ },
+ extraSpace: 50,
+ minHeight: 'original',
+ maxHeight: 500,
+ minWidth: 'original',
+ maxWidth: 500
+ };
+
+ autoResize.cloneCSSProperties = [
+ 'lineHeight', 'textDecoration', 'letterSpacing',
+ 'fontSize', 'fontFamily', 'fontStyle', 'fontWeight',
+ 'textTransform', 'textAlign', 'direction', 'wordSpacing', 'fontSizeAdjust',
+ 'paddingTop', 'paddingLeft', 'paddingBottom', 'paddingRight', 'width'
+ ];
+
+ autoResize.cloneCSSValues = {
+ position: 'absolute',
+ top: -9999,
+ left: -9999,
+ opacity: 0,
+ overflow: 'hidden'
+ };
+
+ autoResize.resizableFilterSelector = [
+ 'textarea:not(textarea.' + uid + ')',
+ 'input:not(input[type])',
+ 'input[type=text]',
+ 'input[type=password]',
+ 'input[type=email]',
+ 'input[type=url]'
+ ].join(',');
+
+ autoResize.AutoResizer = AutoResizer;
+
+ $.fn.autoResize = autoResize;
+
+ function autoResize(config) {
+ this.filter(autoResize.resizableFilterSelector).each(function(){
+ new AutoResizer( $(this), config );
+ });
+ return this;
+ }
+
+ function AutoResizer(el, config) {
+
+ if (el.data('AutoResizer')) {
+ el.data('AutoResizer').destroy();
+ }
+
+ config = this.config = $.extend(true, {}, autoResize.defaults, config);
+ this.el = el;
+
+ this.nodeName = el[0].nodeName.toLowerCase();
+
+ this.originalHeight = el.height();
+ this.previousScrollTop = null;
+
+ this.value = el.val();
+
+ if (config.maxWidth === 'original') config.maxWidth = el.width();
+ if (config.minWidth === 'original') config.minWidth = el.width();
+ if (config.maxHeight === 'original') config.maxHeight = el.height();
+ if (config.minHeight === 'original') config.minHeight = el.height();
+
+ if (this.nodeName === 'textarea') {
+ el.css({
+ resize: 'none',
+ overflowY: 'hidden'
+ });
+ }
+
+ el.data('AutoResizer', this);
+
+ // Make sure onAfterResize is called upon animation completion
+ config.animate.complete = (function(f){
+ return function() {
+ config.onAfterResize.call(el);
+ return f.apply(this, arguments);
+ };
+ }(config.animate.complete));
+
+ this.bind();
+
+ }
+
+ AutoResizer.prototype = {
+
+ bind: function() {
+
+ var check = $.proxy(function(){
+ this.check();
+ return true;
+ }, this);
+
+ this.unbind();
+
+ this.el
+ .bind('keyup.autoResize', check)
+ //.bind('keydown.autoResize', check)
+ .bind('change.autoResize', check)
+ .bind('paste.autoResize', function() {
+ setTimeout(function() { check(); }, 0);
+ });
+
+ if (!this.el.is(':hidden')) {
+ this.check(null, true);
+ }
+
+ },
+
+ unbind: function() {
+ this.el.unbind('.autoResize');
+ },
+
+ createClone: function() {
+
+ var el = this.el,
+ clone = this.nodeName === 'textarea' ? el.clone() : $('<span/>');
+
+ this.clone = clone;
+
+ $.each(autoResize.cloneCSSProperties, function(i, p){
+ clone[0].style[p] = el.css(p);
+ });
+
+ clone
+ .removeAttr('name')
+ .removeAttr('id')
+ .addClass(uid)
+ .attr('tabIndex', -1)
+ .css(autoResize.cloneCSSValues);
+
+ if (this.nodeName === 'textarea') {
+ clone.height('auto');
+ } else {
+ clone.width('auto').css({
+ whiteSpace: 'nowrap'
+ });
+ }
+
+ },
+
+ check: function(e, immediate) {
+
+ if (!this.clone) {
+ this.createClone();
+ this.injectClone();
+ }
+
+ var config = this.config,
+ clone = this.clone,
+ el = this.el,
+ value = el.val();
+
+ // Do nothing if value hasn't changed
+ if (value === this.prevValue) { return true; }
+ this.prevValue = value;
+
+ if (this.nodeName === 'input') {
+
+ clone.text(value);
+
+ // Calculate new width + whether to change
+ var cloneWidth = clone.width(),
+ newWidth = (cloneWidth + config.extraSpace) >= config.minWidth ?
+ cloneWidth + config.extraSpace : config.minWidth,
+ currentWidth = el.width();
+
+ newWidth = Math.min(newWidth, config.maxWidth);
+
+ if (
+ (newWidth < currentWidth && newWidth >= config.minWidth) ||
+ (newWidth >= config.minWidth && newWidth <= config.maxWidth)
+ ) {
+
+ config.onBeforeResize.call(el);
+ config.onResize.call(el);
+
+ el.scrollLeft(0);
+
+ if (config.animate && !immediate) {
+ el.stop(1,1).animate({
+ width: newWidth
+ }, config.animate);
+ } else {
+ el.width(newWidth);
+ config.onAfterResize.call(el);
+ }
+
+ }
+
+ return;
+
+ }
+
+ // TEXTAREA
+
+ clone.width(el.width()).height(0).val(value).scrollTop(10000);
+
+ var scrollTop = clone[0].scrollTop;
+
+ // Don't do anything if scrollTop hasen't changed:
+ if (this.previousScrollTop === scrollTop) {
+ return;
+ }
+
+ this.previousScrollTop = scrollTop;
+
+ if (scrollTop + config.extraSpace >= config.maxHeight) {
+ el.css('overflowY', '');
+ scrollTop = config.maxHeight;
+ immediate = true;
+ } else if (scrollTop <= config.minHeight) {
+ scrollTop = config.minHeight;
+ } else {
+ el.css('overflowY', 'hidden');
+ scrollTop += config.extraSpace;
+ }
+
+ config.onBeforeResize.call(el);
+ config.onResize.call(el);
+
+ // Either animate or directly apply height:
+ if (config.animate && !immediate) {
+ el.stop(1,1).animate({
+ height: scrollTop
+ }, config.animate);
+ } else {
+ el.height(scrollTop);
+ config.onAfterResize.call(el);
+ }
+
+ },
+
+ destroy: function() {
+ this.unbind();
+ this.el.removeData('AutoResizer');
+ this.clone.remove();
+ delete this.el;
+ delete this.clone;
+ },
+
+ injectClone: function() {
+ (
+ autoResize.cloneContainer ||
+ (autoResize.cloneContainer = $('<arclones/>').appendTo('body'))
+ ).append(this.clone);
+ }
+
+ };
+
+})(jQuery);
View
9 pages/admin/seo/webpage/seo-webpage-form.php
@@ -1,9 +1,8 @@
<table class="ids">
<tr>
<td>website_id = <?=$website_id?$website_id:$_POST['website_id']?></td>
- <td>website name = </td>
<td>website_page_id = <?=$page['website_page_id']?$page['website_page_id']:$_POST['website_page_id']?></td>
- <td>website_page.type = </td>
+ <td>website_page.page_type = <?=$page['page_type']?> </td>
</tr>
</table>
@@ -37,11 +36,11 @@
if (is_array($seo_field_array)) {
?>
- <fieldset style="width:872px; background:#f3f3f3; margin-bottom:5px; border: 1px solid #ccc; padding:5px;">
+ <!--<fieldset style="width:872px; background:#f3f3f3; margin-bottom:5px; border: 1px solid #ccc; padding:5px;">
<div id="opt_phrase">
<a id="opt_phrase_change" title="Change Opt Phrase" page_ide="<?=$page['website_page_ide']?>" field="opt_phrase" style="cursor:pointer;" ><?=aql::value('website_page.opt_phrase',$page['website_page_id'])?aql::value('website_page.opt_phrase',$page['website_page_id']):'Set Opt Phrase'?></a>
</div>
- </fieldset>
+ </fieldset> -->
<fieldset style="width:872px; background:#f3f3f3; margin-bottom:5px; border: 1px solid #ccc; padding:5px;">
<? /*
$url = $_POST['url'];
@@ -112,7 +111,7 @@
if ($field == 'h1_blurb' || $field == 'meta_description' || $field =='meta_keywords' ) {
$width = 410;
?>
- <textarea uri_enabled="<?=$uri_enabled?1:0?>" id="field_<?=$field?>" style="width:850px; height:150px;" max="<?=$char_max?>" class="seo-input" wp_id="<?=$page['website_page_id']?>" saved_id="saved_<?=$y?>" field="<?=$field?>"><?=$uri_enabled?htmlspecialchars($fields2[$field]):htmlspecialchars($fields[$field])?></textarea>
+ <textarea uri_enabled="<?=$uri_enabled?1:0?>" id="field_<?=$field?>" style="width:850px; " max="<?=$char_max?>" class="seo-input" wp_id="<?=$page['website_page_id']?>" saved_id="saved_<?=$y?>" field="<?=$field?>"><?=$uri_enabled?htmlspecialchars($fields2[$field]):htmlspecialchars($fields[$field])?></textarea>
<?
} else {
$width = 850;
View
4 pages/admin/seo/webpage/seo-webpage-skybox.css
@@ -1,3 +1,7 @@
+#skybox_template_title {
+ font-size:18px;
+}
+
.saved {
font-size:9px;
color:#0C3;
View
119 pages/admin/seo/webpage/seo-webpage-skybox.js
@@ -0,0 +1,119 @@
+$('#skybox:visible').livequery(function(){
+ $('textarea').autoResize({
+ extraSpace:0,
+ onBeforeResize: function(){
+ console.log('Before');
+ $(this).css('background', '');
+ },
+ onAfterResize: function(){
+ console.log('After');
+ $(this).css('background', '');
+ }
+ });
+
+
+ $('#close').die().live('click',function() {
+ History.back();
+ });
+ $('.seo-input').each(function(index, element) {
+ f = $(this).attr('field');
+ var max_length = $(this).attr('max');
+ var length = $(this).val().length;
+ $('#'+f+'_char_count').html(length);
+ if (length > max_length) $('#'+f+'_counter').css('color','#F00');
+ else $('#'+f+'_counter').css('color','#000');
+ $('#'+f+'_char_count').html(length);
+ });
+
+
+ $('.seo-input').die().live('keyup focusout', function(e) {
+ f = $(this).attr('field');
+ var max_length = $(this).attr('max');
+ var length = $(this).val().length;
+ $('#'+f+'_char_count').html(length);
+ if (length > max_length) $('#'+f+'_counter').css('color','#F00');
+ else $('#'+f+'_counter').css('color','#000');
+
+ if (e.keyCode == 13 || e.type == 'focusout') {
+ uri = $('#url_specific').attr('uri');
+ uri_enabled = $(this).attr('uri_enabled');
+ v = $(this).val();
+ w = $(this).attr('wp_id');
+ s = $(this).attr('saved_id');
+ website_id = $('#url_specific').attr('website_id');
+ $('#'+s).html('saving');
+ $('#'+s).fadeOut('slow',function() {
+ $.post('/admin/seo/webpage/ajax/save-seo', { field: f, value: v, wp_id: w, uri: uri, uri_enabled: uri_enabled, website_id: website_id }, function (data){
+ $('#'+s).html(data);
+ $('#'+s).fadeIn('slow');
+ });
+ });
+ }
+ });
+
+ $('#set-up-website').die().live('click',function(){
+ $.post('/admin/seo/website/set-up', function (data) {
+ $('#skybox').html(data);
+ });
+ });
+
+ $('#nickname_change').die().live('click', function() {
+ $('#nickname').fadeOut();
+ page_ide = $(this).attr('page_ide');
+ $.post('/admin/seo/webpage/ajax/input', { field: 'nickname', website_page_ide: page_ide }, function(data) {
+ $('#nickname').html(data);
+ $('#nickname').fadeIn(800);
+ });
+ });
+
+ $('#opt_phrase_change').die().live('click', function() {
+ $('#opt_phrase').fadeOut();
+ page_ide = $(this).attr('page_ide');
+ $.post('/admin/seo/webpage/ajax/input', { field: 'opt_phrase', website_page_ide: page_ide }, function(data) {
+ $('#opt_phrase').html(data);
+ $('#opt_phrase').fadeIn(800);
+ });
+ });
+
+ $('#input_field').die().live('focusout keyup',function(e) {
+ if (e.keyCode == 13 || e.type == 'focusout') {
+ f = $(this).attr('field');
+ $('#'+f).fadeOut();
+ val = $(this).val();
+ page_ide = $(this).attr('page_ide');
+ $.post('/admin/seo/webpage/ajax/change_field', { value: val, field: f, website_page_ide: page_ide }, function(data) {
+ $('#'+f).html(data);
+ $('#'+f).fadeIn(800);
+ });
+ }
+ });
+
+ $('#url_specific').die().live('click',function() {
+ if ($(this).attr('checked')) val = 1;
+ else val = 0;
+ uri = $(this).attr('uri');
+ website_page_id = $(this).attr('website_page_id');
+ website_id = $(this).attr('website_id');
+ $.post('/admin/seo/webpage/ajax/set_url_specific',{ website_page_id: website_page_id, uri: uri, val: val }, function(data) {
+ $('#url_cb').html(data);
+ });
+ $.post('/admin/seo/webpage/seo-webpage-form', {website_id: website_id, website_page_id: website_page_id, uri: uri, uri_enabled: val}, function(data) {
+ $('#seo_page').html(data);
+ })
+ });
+
+ /*$('.url_cb_click').live('click',function() {
+ field = $(this).attr('field');
+ website_page_id = $('#url_specific').attr('website_page_id')
+ website_id = $('#url_specific').attr('website_id')
+ uri = $('#url_specific').attr('uri');
+ if ($(this).attr('checked')) url_specific = 1;
+ else url_specific = 0;
+ $('#field_'+field).attr('uri_enabled',url_specific)
+ $.post('/admin/seo/webpage/ajax/show-input-data',{field:field, url_specific: url_specific, uri: uri, website_id: website_id, website_page_id: website_page_id},function(data) {
+ $('#field_'+field).val(data)
+ });
+ });
+ */
+
+});
View
119 pages/admin/seo/webpage/seo-webpage-skybox.php
@@ -1,9 +1,15 @@
-<?
+<?
if ($_POST['page_path']) {
+
+
$title="SEO - ".$_POST['page_path'];
+ $p->title = $_SERVER['HTTP_HOST'];
$p->template('skybox','top');
$uri = $_POST['uri'];
+ $p->js[] = '/pages/admin/seo/webpage/js/jquery.autoresize.js';
+ $p->js[] = '/pages/admin/seo/webpage/seo-webpage-skybox.js';
+
if ($_POST['website_ide']) $website_id = decrypt($_POST['website_ide'],'website');
else {
$rs = aql::select("website { where domain = '{$_SERVER['SERVER_NAME']}' }");
@@ -22,7 +28,7 @@
<? // The website exists... move forward to the check if website_page record is entered
} else {
- $aql="website_page { url_specific, nickname where page_path = '{$_POST['page_path']}' and website_id = {$website_id} }";
+ $aql="website_page { url_specific, page_type, nickname where page_path = '{$_POST['page_path']}' and website_id = {$website_id} }";
$rs = aql::select($aql);
$page = $rs[0];
if ($page['website_page_id']) {
@@ -89,112 +95,9 @@
?>
-<script language="javascript">
- $(function() {
- $('#close').live('click',function() {
- History.back();
- });
- $('.seo-input').each(function(index, element) {
- f = $(this).attr('field');
- var max_length = $(this).attr('max');
- var length = $(this).val().length;
- $('#'+f+'_char_count').html(length);
- if (length > max_length) $('#'+f+'_counter').css('color','#F00');
- else $('#'+f+'_counter').css('color','#000');
- $('#'+f+'_char_count').html(length);
- });
-
-
- $('.seo-input').live('keyup focusout', function(e) {
- f = $(this).attr('field');
- var max_length = $(this).attr('max');
- var length = $(this).val().length;
- $('#'+f+'_char_count').html(length);
- if (length > max_length) $('#'+f+'_counter').css('color','#F00');
- else $('#'+f+'_counter').css('color','#000');
-
- if (e.keyCode == 13 || e.type == 'focusout') {
- uri = $('#url_specific').attr('uri');
- uri_enabled = $(this).attr('uri_enabled');
- v = $(this).val();
- w = $(this).attr('wp_id');
- s = $(this).attr('saved_id');
- website_id = $('#url_specific').attr('website_id');
- $('#'+s).html('saving');
- $('#'+s).fadeOut('slow',function() {
- $.post('/admin/seo/webpage/ajax/save-seo', { field: f, value: v, wp_id: w, uri: uri, uri_enabled: uri_enabled, website_id: website_id }, function (data){
- $('#'+s).html(data);
- $('#'+s).fadeIn('slow');
- });
- });
- }
- });
-
- $('#set-up-website').live('click',function(){
- $.post('/admin/seo/website/set-up', function (data) {
- $('#skybox').html(data);
- });
- });
-
- $('#nickname_change').live('click', function() {
- $('#nickname').fadeOut();
- page_ide = $(this).attr('page_ide');
- $.post('/admin/seo/webpage/ajax/input', { field: 'nickname', website_page_ide: page_ide }, function(data) {
- $('#nickname').html(data);
- $('#nickname').fadeIn(800);
- });
- });
-
- $('#opt_phrase_change').live('click', function() {
- $('#opt_phrase').fadeOut();
- page_ide = $(this).attr('page_ide');
- $.post('/admin/seo/webpage/ajax/input', { field: 'opt_phrase', website_page_ide: page_ide }, function(data) {
- $('#opt_phrase').html(data);
- $('#opt_phrase').fadeIn(800);
- });
- });
-
- $('#input_field').live('focusout keyup',function(e) {
- if (e.keyCode == 13 || e.type == 'focusout') {
- f = $(this).attr('field');
- $('#'+f).fadeOut();
- val = $(this).val();
- page_ide = $(this).attr('page_ide');
- $.post('/admin/seo/webpage/ajax/change_field', { value: val, field: f, website_page_ide: page_ide }, function(data) {
- $('#'+f).html(data);
- $('#'+f).fadeIn(800);
- });
- }
- });
-
- $('#url_specific').live('click',function() {
- if ($(this).attr('checked')) val = 1;
- else val = 0;
- uri = $(this).attr('uri');
- website_page_id = $(this).attr('website_page_id');
- website_id = $(this).attr('website_id');
- $.post('/admin/seo/webpage/ajax/set_url_specific',{ website_page_id: website_page_id, uri: uri, val: val }, function(data) {
- $('#url_cb').html(data);
- });
- $.post('/admin/seo/webpage/seo-webpage-form', {website_id: website_id, website_page_id: website_page_id, uri: uri, uri_enabled: val}, function(data) {
- $('#seo_page').html(data);
- })
- });
-
- /*$('.url_cb_click').live('click',function() {
- field = $(this).attr('field');
- website_page_id = $('#url_specific').attr('website_page_id')
- website_id = $('#url_specific').attr('website_id')
- uri = $('#url_specific').attr('uri');
- if ($(this).attr('checked')) url_specific = 1;
- else url_specific = 0;
- $('#field_'+field).attr('uri_enabled',url_specific)
- $.post('/admin/seo/webpage/ajax/show-input-data',{field:field, url_specific: url_specific, uri: uri, website_id: website_id, website_page_id: website_page_id},function(data) {
- $('#field_'+field).val(data)
- });
- });
- */
- });
+<script language="javascript">
+
+
</script>
<? } ?>
Please sign in to comment.
Something went wrong with that request. Please try again.