Sample Code of API’s Controls in Written Javascript

Print   

12 Mar 2018

Use this example to study how a writer organises ideas, uses evidence and develops an argument. Write your own response and cite sources according to your institution’s guidance.

"use strict"

//function to load Facebook JavaScript.

var loadFacebookJS = function () {

blockUI();

if (!$("#modalWindowDivControl #FacebookDivision").contents().find(".fb-share-button").attr("data-href")) {

unBlockUI();

(function () {

var e = document.createElement('script');

e.type = 'text/javascript';

e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js#xfbml=1&appId=297301533752770';

e.async = true;

document.getElementById('fb-root').appendChild(e);

} ());

}

else {

setTimeout(loadFacebookJS, 200);

}

}

// freez the screen until the whole page loads

function blockUI(controllerId, message) {

controllerId = controllerId || "ctl00_gridDiv";

message = message || "Processing Please Wait...";

message = "<h1><img class='image-rotate' src='Images/hireprobusy.gif'/><span style='font-size:medium;'><b> " + message + "</b></span> <h1>";

if ($('#blockMessage').length == 0) {

$("#" + controllerId).append($('<div/>').attr('id', 'blockMessage').css('display', 'none').html(message));

} else {

$('#blockMessage').html(message);

var controller = $("#" + controllerId).data();

if (controller != undefined && controller != null && controller["blockUI.isBlocked"] != undefined && controller["blockUI.isBlocked"] != null && controller["blockUI.isBlocked"] == 1)

return;

}

$("#" + controllerId).block({

message: $('#blockMessage'),

css: {

border: 'none',

padding: '15px',

backgroundColor: '#eee',

'-webkit-border-radius': '10px',

'border-radius': '10px',

opacity: .9,

color: '#444',

display: 'inline',

width: '35%'

}

});

}

function unBlockUI(controllerId) {

controllerId = controllerId || "ctl00_gridDiv";

$("#" + controllerId).unblock();

}

LinedIn Js file

"use strict"

// funtion to check and load linkedin JS.

var LoadLinkedinJS = function () {

blockUI();

if (!$("#modalWindowDivControl #LinkedinFrame").contents().find("#LinkedinButton").attr("data-url")) {

unBlockUI();

$.getScript('http://platform.linkedin.com/in.js');

}

else {

setTimeout(LoadLinkedinJS, 200);

}

}

// freez the screen until the whole page loads

function blockUI(controllerId, message) {

controllerId = controllerId || "ctl00_gridDiv";

message = message || "Processing Please Wait...";

message = "<h1><img class='image-rotate' src='Images/hireprobusy.gif'/><span style='font-size:medium;'><b> " + message + "</b></span> <h1>";

if ($('#blockMessage').length == 0) {

$("#" + controllerId).append($('<div/>').attr('id', 'blockMessage').css('display', 'none').html(message));

} else {

$('#blockMessage').html(message);

var controller = $("#" + controllerId).data();

if (controller != undefined && controller != null && controller["blockUI.isBlocked"] != undefined && controller["blockUI.isBlocked"] != null && controller["blockUI.isBlocked"] == 1)

return;

}

$("#" + controllerId).block({

message: $('#blockMessage'),

css: {

border: 'none',

padding: '15px',

backgroundColor: '#eee',

'-webkit-border-radius': '10px',

'border-radius': '10px',

opacity: .9,

color: '#444',

display: 'inline',

width: '35%'

}

});

}

function unBlockUI(controllerId) {

controllerId = controllerId || "ctl00_gridDiv";

$("#" + controllerId).unblock();

}

Job Share Modal window

"use strict"

//This JavaScript is Main script for all Social Networks Connections and Communication.

//Created on 03/04/2014

//Created by Devank Agarwal

var SocialNetworkingJavaScript = function () {

var jobApplicationUrl = "";

//function return the JobApplicationUrl

this.CreateJobApplicationURl = function (JobId) {

jobApplicationUrl = jobURL(JobId);

// Alert to check the shared url.

//alert(jobApplicationUrl);

return jobApplicationUrl;

}

//function that creates dynamic url including tenant,source,user and job id.

function jobURL(JobId) {

var host = location.host;

var URL = "";

// Just a dummy url to make the it run on localhost.

if (host.indexOf('ams.hirepro.in') != -1||host.indexOf("db1.hirepro.in")!=-1) {

URL = getLiveUrl();

}

else {

URL = "http://d.ams.hirepro.in/amserdemo/public/JobApplication/Default.aspx/?";

URL += getTenantUserAndJobIDEncryption();

}

//alert(URL);

return URL;

}

//function to get all the values for queryString.

var escapedURL = function () {

var alias = getTenantAdamInfo().TenantAlias;

var SourceId = getSourceId();

var UserId = readCookie("userId");

var EncrpytedJobId = $("#control_Use_It_For_Setting_Attributes").attr('RecentlyEncryptedJobId');

//alert to check the values

//return ("alias%3D" + alias + "%25userid%3D" + UserId + "%25sourceid%3D" + SourceId + "%25jobid%3D" + JobId);

return ("alias=" + alias + "&userid=" + UserId + "&sourceid=" + SourceId + "&jobid=" + EncrpytedJobId);

}

// function to fect virtual path of that hosting dynamically.

var fetchVirtualDirectoryName = function () {

var arrayOfPathName = location.pathname.split("/");

return arrayOfPathName[1];

}

// function to get encrypted source id from the hidden field.

var getSourceId = function () {

return $("#" + GetClientId("hfEncryptedSourceId")).val();

}

// function to escape the url but presently not used.

var getTenantUserAndJobIDEncryption = function () {

var URL = escapedURL();

//return escape(URL);

return URL;

}

// function to get the live url dynamically.

var getLiveUrl = function () {

var protocol = location.protocol;

var hostName = location.hostname;

var host = location.host;

var liveURL = "";

liveURL += protocol + "//" + host + "/";

liveURL += (host.indexOf(':') == -1) ? fetchVirtualDirectoryName() : "";

liveURL += "/public/JobApplication/?";

liveURL += getTenantUserAndJobIDEncryption();

return liveURL;

}

}

HTML code for Share job Modal window

<%--<style type="text/css">

.style1

{

width: 82px;

}

</style>

<div id="Share_Control">

<div id="ShareJobOnSocialMedia" style="display: block; float: left; width: 100%">

<table>

<tr>

<td class="style1">

<fieldset style="float:left;">

<legend>Email</legend><span id="GmailDivision"><a href="#" target="_blank">

<img style="width: 45px; height: 45px" />

</a></span>

</fieldset>

</td>

<td>

<fieldset style="float:left;height: 20%;width:120%; margin-left: 0px;">

<legend><b>Job opening Url</b></legend>

<span>This is the job opening link:</span> <span id="jobOpeningURL"></span>

</fieldset>

</td>

</tr>

<tr>

<td colspan=2 style="height:500px;width:120%">

<fieldset style="height:80%;width:500px">

<legend>Social Media</legend><%--<span id="LinkedinDivision">

<iframe id="LinkedinFrame" src="EmployeeReferral/IframeHtml/LinkedinFrame.html" frameborder="0"

style="border-style: none; border-color: inherit; border-width: medium; overflow: hidden;

height: 50px; width: 90px;" scrolling="no"></iframe>

</span>--%><%--

<span id="FacebookDivision">

<iframe id="FacebookFrame" src="EmployeeReferral/IframeHtml/FacebookFrame.html" frameborder="0"

style="border-style: none;height:15%;width: 15%; border-color: inherit; border-width: medium; overflow: hidden;

scrolling="no"></iframe>

</span><span id="FacebookSendDivision" ">

<iframe id="SendButtonFrame" src="EmployeeReferral/IframeHtml/FacebookSend.html"

frameborder="0" style="border-style: none;height: 120%;width: 80%; border-color: inherit; border-width: medium;

overflow: hidden;"></iframe>

</span>

</fieldset>

</td>

</tr>

</table>

</div>

</div>

--%>

<div id="Share_Control">

<div id="ShareJobOnSocialMedia" style="display: block; width: 100%">

<table style="width: 100%; margin: 0 2px; height: 100%; table-layout: fixed;">

<tr>

<td style="width: 50px;">

<fieldset style="float: left;">

<legend>Email</legend><span id="GmailDivision"><a href="#" target="_blank">

<img style="width: 45px; height: 45px" />

</a></span>

</fieldset>

</td>

<td style="width: 425px;">

<fieldset style="float: left; margin-left: 0px;">

<legend><b>Direct</b></legend>Hi,<br />

I would like to announce a new job opening in our organization. A complete job description

is available on the link provided below. Eligible individuals interested in applying

for this position may submit an application on the link below<br />

<span id="jobOpeningURL" style="font-weight: bold;"></span>

</fieldset>

</td>

</tr>

<tr style="height: 425px;">

<td colspan="2">

<fieldset style="height: 400px;">

<legend>Social Media</legend>

<table style="width: 100%; height:100%; table-layout: fixed;">

<tr>

<td style="width:120px">

<span id="FacebookDivision">

<iframe id="FacebookFrame" src="EmployeeReferral/IframeHtml/FacebookFrame.html" frameborder="0"

style="border-style: none; border-color: inherit; border-width: medium;

overflow: hidden;" scrolling="no"></iframe>

</span>

</td>

<td>

<span id="FacebookSendDivision">

<iframe id="SendButtonFrame" src="EmployeeReferral/IframeHtml/FacebookSend.html"

frameborder="0" style="border-style: none; height: 350px; width: 100%; border-color: inherit;

border-width: medium; overflow: hidden;"></iframe>

</span>

</td>

</tr>

</table>

</fieldset> </td> </tr> </table>

</div>

</div>