• jQuery ajax pieprasījums

    GET
    $.ajax({
    type:'GET',
    url: 'http://www.kautkas.lv/kautkas.php',
    data: "action=something&id="+id,
    success:function(data){
    $('#lauks').html(data);
    }
    });

    POST
    $.ajax({
    type: "POST",
    url: "ajax.php?",
    data: { idnumurs: "id" },
    success:function(data){
    $("#lauks").val(data);
    }
    });


  • twitter widget

    $("iframe#twitter-widget-0").contents().find('head').append('<style>img.u-photo.avatar{display:none !important;}.header.h-card.p-author{padding-left:0;}</style>');

    i use the “waituntilexists.js” plugin to detect when the content is added to DOM instead of the setTimout(): https://gist.github.com/buu700/4200601

    $("iframe#twitter-widget-0").waitUntilExists(function(){
    $("iframe#twitter-widget-0").contents().find('head').append('<style>img.u-photo.avatar{display:none !important;}.header.h-card.p-author{padding-left:0;}</style>');
    });


  • Chrome, Safari notifikācijas

    function notify(html) {
    var havePermission = window.webkitNotifications.checkPermission();
    if (havePermission == 0) {
    // 0 is PERMISSION_ALLOWED
    var notification = window.webkitNotifications.createNotification(
    'http://www.kautkas/abc.jpg',
    'title',
    ' description'
    );

    notification.onclick = function () {
    //window.open("http://www.linksuzurli.lv");
    notification.cancel();
    }
    notification.show();
    // Hide the notification after the timeout
    setTimeout(function(){
    notification.cancel()
    }, 30000);

    } else {
    window.webkitNotifications.requestPermission();
    }
    }