/**
* File: parrotScript-001.js
* Purpose: Support for AJAX calls to Parrot server for interactive functionality.
*
* Copyright 2015 Nigel Deans
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
var url;
// get XML from servlet .................
function storylist_jsp(type) {
console.log("...storylist_jsp(" + type + ")");
if (type=="short") url = "testapp?job=list-short";
if (type=="long") url = "testapp?job=list-long";
if (type=="special") url = "testapp?job=list-special";
$('div[id="list-view"]').load(url);
}
function storyview_jsp(story_id) {
console.log("...storyview_jsp(" + story_id + ")");
url = "testapp?job=detail-short&storyid='" + story_id + "'";
$('div[id="detail-view"]').load(url);
}
// get XML from rest API ................. problem: only returning the IDs.
function storylist_rst(type) {
console.log("...storylist_rst(" + type + ")");
if (type=="short") url="rest/stories/short";
if (type=="long") url="rest/stories/long";
if (type=="special") url="rest/stories/special";
$('div[id="list-view"]').load(url);
}
function storyview_rst(story_name) {
console.log("...storyview_rst('" + story_name + "')");
url = "testapp?job=detail-short&storyid='" + story_name + "'";
$('div[id="detail-view"]').load(url);
}
// get JSON from rest API ....................
function storylist_rest(type) {
console.log("...storyview_japi('" + type + "')");
url = "rest/stories/json/short";
$('div[id="list-view"]').load(url);
}
// load SWF ..................................
function storylist_swf(type) {
var swfObj = "";
console.log("...storylist_swf(" + type + ")");
if (type=="short") url="ParrotClient2.swf";
if (type=="long") url="ParrotClient2.swf";
if (type=="special") url="ParrotClient2.swf";
//$('div[name="flash-view"]').html("");
var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
swfObj = swfObj + "