Skip to content
Browse files

Merge pull request #18 from SkyPHP/josh

Made some changes for Jo ellen
  • Loading branch information...
2 parents a55d2a9 + 18828e1 commit 838aec80422774386a192dd309a431ec30e2d167 @stanistan stanistan committed Apr 13, 2012
View
2 config.php
@@ -2,7 +2,7 @@
$seo_field_array=array(
'target'=>array(
'title'=>75,
- 'meta_description'=>175,
+ 'meta_description'=>55,
'h1'=>100,
'h1_blurb'=>300
),
View
274 lib/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
15 pages/admin/seo/webpage/seo-webpage-form.php
@@ -1,10 +1,8 @@
<table class="ids">
<tr>
- <td>website.id = <?=$website_id?$website_id:$_POST['website_id']?></td>
- <td>website_page.id = <?=$page['website_page_id']?$page['website_page_id']:$_POST['website_page_id']?></td>
- <td>website_page.page_type = <?=$page['page_type']?></td>
- <!--<td>website_page.data_id = </td>
- <td>website_page.uri_data_id = </td>-->
+ <td>website_id = <?=$website_id?$website_id:$_POST['website_id']?></td>
+ <td>website_page_id = <?=$page['website_page_id']?$page['website_page_id']:$_POST['website_page_id']?></td>
+ <td>website_page.page_type = <?=$page['page_type']?> </td>
</tr>
</table>
@@ -42,7 +40,7 @@
<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,11 +110,8 @@
<?
if ($field == 'h1_blurb' || $field == 'meta_description' || $field =='meta_keywords' ) {
$width = 410;
- if ($field == 'meta_description') $height = 32;
- elseif ($field = 'h1_blurb') $height = 190;
- else $height = 150
?>
- <textarea uri_enabled="<?=$uri_enabled?1:0?>" id="field_<?=$field?>" style="width:850px; height:<?=$height?>px;" 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
1 pages/admin/seo/webpage/seo-webpage-skybox.css
@@ -1,6 +1,7 @@
#skybox_template_title {
font-size:18px;
}
+
.saved {
font-size:9px;
color:#0C3;
View
118 pages/admin/seo/webpage/seo-webpage-skybox.js
@@ -0,0 +1,118 @@
+$('#skybox:visible').livequery(function(){
+ $('textarea').autoResize({
+ // Documentation: https://github.com/padolsey/jQuery.fn.autoResize
+ extraSpace:0,
+ onBeforeResize: function(){
+ //$(this).css('background', '');
+ },
+ onAfterResize: function(){
+ //$(this).css('background', '');
+ }
+ });
+
+
+ $('#close').die().live('click',function() {
+ History.back();
+ });
+ $('.seo-input').each(function(index, element) {
+ var 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) {
+ var 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') {
+ var uri = $('#url_specific').attr('uri');
+ var uri_enabled = $(this).attr('uri_enabled');
+ var v = $(this).val();
+ var w = $(this).attr('wp_id');
+ var s = $(this).attr('saved_id');
+ var 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();
+ var 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();
+ var 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') {
+ var f = $(this).attr('field');
+ $('#'+f).fadeOut();
+ var val = $(this).val();
+ var 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;
+ var uri = $(this).attr('uri');
+ var website_page_id = $(this).attr('website_page_id');
+ var 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
132 pages/admin/seo/webpage/seo-webpage-skybox.php
@@ -1,21 +1,23 @@
-<?
+<?
if ($_POST['page_path']) {
-
- $p->title=$_SERVER['SERVER_NAME'];
+ $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']}' }");
$website_id = $rs[0]['website_id'];
}
//echo $website_id;
- ?>
- <h2></h2>
- <?
- // Still don't have a website_id after checking config and website table so display a question to add it
+
+ // Still don't have a website_id after checking config and website table so display a question to add it
if (!$website_id) {
?>
+ <h2><?=$_SERVER['SERVER_NAME']?></h2>
<br>
This Website Cannot Be Optimized Until it is Set Up in the System
<br><br>
@@ -27,6 +29,7 @@
$rs = aql::select($aql);
$page = $rs[0];
if ($page['website_page_id']) {
+
if ($page['url_specific']) {
$rs_uri = aql::select("website_uri_data { where website_id = ".$website_id." and uri = '".$uri."' and on_website = 1 }");
if ($rs_uri) $url_specific_flag = true;
@@ -42,7 +45,7 @@
if ($url_specific_flag) {
$uri_enabled = true;
?>
- The URL is <?=$_SERVER['HTTP_HOST'].$uri?>
+ This page is set as URL SPECIFIC. The URL is <?=$_SERVER['HTTP_HOST'].$uri?>
<input type="hidden" id="uri_enabled" value="<?=$uri?>" />
<?
}
@@ -86,115 +89,4 @@
}
}
$p->template('skybox','bottom');
-
-?>
-
-<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>
-
-<? } ?>
+}

0 comments on commit 838aec8

Please sign in to comment.
Something went wrong with that request. Please try again.