0.0.1 • Published 9 years ago

happ-jquery v0.0.1

Weekly downloads
3
License
-
Repository
-
Last release
9 years ago

HAPP-jQuery

Execution

var func = $(function (arg1, arg2) {
    // This code will be executed in the browser
    // ...
    return value;
});

func(arg1, arg2).then(function (value) {
    
});

Utils

$.alert('Message').then(function () {
    // ...
});

$.configm('Message').then(function () {
    // Confirmed
}, function () {
    // Declined
});

$.prompt('Message').then(function (inputText) {
    // ...
});

// console.log in browser
$.log('Message');

HTML content

$('selector').append(html);
$('selector').prepend(html);
$('selector').after(html);
$('selector').before(html);
$('selector').html();

$('selector').html().then(function (html) {
    // ...
});

$('.content').text('Hello, world!');
$('.content').text().then(function (text) {
    // ...
});

$('selector').remove();
$('selector').empty();

Classes & attributes

$('.item').attr('name');
$('.item').attr('name', 'username');
$('.item').removeAttr('name');

$('.item').addClass('active');
$('.item').removeClass('active');
$('.item').toggleClass('active');
$('.item').hasClass().then(function (result) {
    // ...
});

Forms

$('input').val('Hello');
$('input').val().then(function (value) {
    // ...
});

Size and position

$('.item').height();
$('.item').height(200);

$('.item').width();
$('.item').width(200);

$('.item').offset();
$('.item').position();

$('.item').scrollLeft();
$('.item').scrollTop();

Events

$('selector').on('click', function () {});

Styles

$.styleFile(filename);
$.styleCode(code);
$.styleLink(url);

$('selector').css('prop', 'value');
$('selector').css(object);
$('selector').css('display').then(function (value) {
    // ...
});

$('.item').hide();
$('.item').show();

$('.item').fadeIn();
$('.item').fadeOut();
$('.item').fadeToggle();

$('.item').animate(props, options).then(function () {
    // Completed
});