PHP Classes

File: assets/js/app/root.js

Recommend this page to a friend!
  Classes of Ahmad Mustapha  >  Utility Web PHP API  >  assets/js/app/root.js  >  Download  
File: assets/js/app/root.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Utility Web PHP API
API to retrieve movie details and other resources
Author: By
Last change:
Date: 1 year ago
Size: 1,144 bytes
 

Contents

Class file image Download
Handlebars.registerHelper('errorMessage', function (message) {
    if (! message){
        return 'Link extraction failed';
    }

    return message;
});

let ajaxErrorHandler = function (error) {
    console.log('Error occured');
    console.log(error);
};

let fetchLinkData = function (link) {
    return  new Promise(function (resolve, reject) {
        $ajax.get(link).success(function (...arguments) {
            resolve(...arguments);
        }).error(function (error) {
            reject(error);
        }).fail(function (error) {
            reject(error);
        });
    });
};

let performBasicLinkAction = function (event, $inputUrl, $button, $linkExtractionStatus) {
    event.preventDefault();
    if(! $inputUrl.val()){
        $linkExtractionStatus.html(templateLinkExtractionError({
            message: 'You must provide video url first!'
        }))
        $inputUrl.focus();
        return false;
    }

    $button.attr('disabled', 'disabled').html('<i class="fa fa-spinner fa-pulse"></i> Fetching');
    $inputUrl.attr('disabled', 'disabled');
    $linkExtractionStatus.html('');
    return btoa($inputUrl.val());
};
For more information send a message to info at phpclasses dot org.