Skip to content

Commit

Permalink
simplify maxlength feature
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkingorg committed Apr 8, 2012
1 parent 91b1fad commit 683f85d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 27 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "assets/jquery-maxlength-display"]
path = assets/jquery-maxlength-display
url = [email protected]:crowdfavorite/jquery-maxlength-display.git
6 changes: 1 addition & 5 deletions assets/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -686,10 +686,6 @@
margin-right: 5px;
}

.maxlength-remaining-short {
.broadcast-interstitial li.account .broadcast-edit.edit .maxlength-remaining-short {
color: #900;
}
.maxlength-remaining-empty {
color: #900;
font-weight: bold;
}
28 changes: 11 additions & 17 deletions assets/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,30 +186,24 @@
else {
$parent.removeClass('checked');
}
});

$('.broadcast-interstitial .broadcast-edit textarea').on('keyup change click focus', function() {
$counter = $(this).closest('.broadcast-edit').find('.counter');
var diff = parseInt($(this).attr('maxlength')) - parseInt($(this).val().length),
diffClass = '';
if (diff < 10) {
diffClass = 'maxlength-remaining-short';
}
$counter.removeClass('maxlength-remaining-short').addClass(diffClass).html(diff);
}).change();

$('.broadcast-interstitial .broadcast-edit textarea').each(function() {
// $(this).maxLengthDisplay({
// 'displayTarget': $(this).closest('.broadcast-edit').find('.counter'),
// 'lengths': {
// 'short': 10,
// 'empty': 0
// }
// });
});

$('body.clean ul.accounts li.proto .broadcast-edit textarea').change(function() {
$('body.clean ul.accounts li.proto .broadcast-edit textarea').on('keyup change click focus', function() {
var val = $(this).val();
$(this).closest('ul.accounts').find('.broadcast-edit').not('.edit').each(function() {
$(this).find('.readonly').text(val).end()
.find('textarea').val(val);
});
}).keypress(function() {
$(this).change();
}).click(function() {
$(this).change();
}).focus(function() {
$(this).change();
});

});
Expand Down
1 change: 0 additions & 1 deletion assets/jquery-maxlength-display
Submodule jquery-maxlength-display deleted from 7f6ad8
1 change: 0 additions & 1 deletion views/wp-admin/post/broadcast/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
</p>
</form>
<script type="text/javascript" src="<?php echo esc_url(includes_url('/js/jquery/jquery.js')); ?>"></script>
<script type="text/javascript" src="<?php echo esc_url(Social::$plugins_url.'assets/jquery-maxlength-display/jquery.maxlength.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo esc_url(SOCIAL_ADMIN_JS); ?>"></script>
</body>
</html>

0 comments on commit 683f85d

Please sign in to comment.