function aspire_helpCommand(commandname, subject, body, ci
, completesubjectline
, completeBody)
{
var qhelp = "
";
qhelp = qhelp + "\ncode\ncode1\nimages\nimage\nlink\nquestion\ngquestion\naquestion\nwhoareyou\ndict\nplist\nolist\nhelp";
qhelp = qhelp + "
";
var baseurl="/akc/display?url=DisplayNoteIMPURL&reportId=3905&downerUserId=satya";
//body exists
var newbody = 'Click her to see full help
';
newbody = newbody + qhelp;
ci.newSubject=subject;
ci.newAppendText = newbody;
}
function aspire_whoareyouCommand(commandname, subject, body, ci
, completesubjectline
, completeBody)
{
var baseurl="http://www.satyakomatineni.com/akc/display?url=DisplayNoteBodyURL&reportId=2177&ownerUserId=satya";
//body exists
var newbody = 'Click her to see me
';
ci.newSubject=subject;
ci.newAppendText = newbody;
}
function aspire_code1Command(commandname, subject, body, ci
, completesubjectline
, completeBody)
{
if (body == "")
{
ci.newSubject=subject;
return;
}
//body exists
var newbody = body.replace(//g,">");
newbody = newbody.replace(/\t/g," ");
newbody = "\n" + newbody + "\n
";
ci.newSubject=subject;
ci.newAppendText = newbody;
}
function aspire_replaceTabs(ins)
{
return ins.replace(/\t/g," ");
}
function aspire_googleCommand(commandname, subject, body, ci
, completesubjectline
, completeBody)
{
var baseurl="http://www.google.com/search?hl=en&q=" + escape(subject);
//body exists
var newbody = 'Search for: ' + subject + '
'
ci.newSubject=subject;
ci.newAppendText = newbody;
}
function aspire_imagesCommand(commandname, subject, body, ci
, completesubjectline
, completeBody)
{
var baseurl="http://www.google.com/images?hl=en&q=" + escape(subject);
//body exists
var newbody = 'Show images for: ' + subject + '
'
ci.newSubject=subject;
ci.newAppendText = newbody;
}
function aspire_imageCommand(commandname, linkText, linkUrl, ci
, completesubjectline
, completeBody)
{
dalert(linkText);
dalert(linkUrl);
if (linkText == "")
{
this.errorMessage = "Subject is empty";
return;
}
if (linkUrl == "")
{
this.errorMessage = "A image url is required for a image command";
return;
}
var finalBody = '';
dalert(finalBody);
ci.newAppendText = finalBody;
ci.newSubject = linkText;
}
function aspire_gquestionCommand(commandname, subject, body, ci
, completesubjectline
, completeBody)
{
var appendText = '' + subject + '
';
var baseurl="http://www.google.com/search?hl=en&q=" + escape(subject);
//body exists
var googleSearchUrl = 'Search for: ' + subject + '
'
ci.newSubject=subject;
ci.newAppendText = appendText + "\n" + googleSearchUrl;
}
function aspire_aquestionCommand(commandname, subject, body, ci
, completesubjectline
, completeBody)
{
var appendText = '' + subject + '
';
ci.newSubject=subject;
ci.newAppendText = appendText
+ "\n" + getGoogleText(subject)
+ "\n" + getAndroidDevelopersText(subject)
+ "\n" + getAndroidBeginersText(subject)
+ "\n" + getGoogleCodeText(subject)
+ "\n" + getAndroidIssuesText(subject)
;
}
function getGoogleText(subject)
{
var baseurl="http://www.google.com/search?hl=en&q=" + escape(subject);
var googleSearchUrl = 'Search Google for: ' + subject + '
';
return googleSearchUrl;
}
function getAndroidDevelopersText(subject)
{
var baseurl="http://groups.google.com/group/android-developers/search?group=android-developers&q=" + escape(subject);
var searchUrl = 'Search Android Developers Group for: ' + subject + '
';
return searchUrl;
}
function getAndroidBeginersText(subject)
{
var baseurl="http://groups.google.com/group/android-beginners/search?group=android-beginners&q=" + escape(subject);
var searchUrl = 'Search Android Beginers Group for: ' + subject + '
';
return searchUrl;
}
function getGoogleCodeText(subject)
{
var baseurl="http://code.google.com/search/#p=android&q=" + escape(subject);
var searchUrl = 'Search Google Code for: ' + subject + '
';
return searchUrl;
}
function getAndroidIssuesText(subject)
{
var baseurl="http://code.google.com/p/android/issues/list?can=2&colspec=ID+Type+Version+Security+Status+Owner+Summary&cells=tiles&q=" + escape(subject);
var searchUrl = 'Search Android Issues Database for: ' + subject + '
'
return searchUrl;
}
/*
***************************************************
* Dictionary support
***************************************************
*/
function aspire_dictCommand(commandname, subject, body, ci
, completesubjectline
, completeBody)
{
if (body == "")
{
ci.newSubject=subject;
return;
}
//body exists
var newbody = aspire_getWordUrls(body);
newbody = '\n' + newbody + '
\n';
ci.newSubject=subject;
ci.newAppendText = newbody;
}
function aspire_getWordUrls(body)
{
var lineArray=aspire_splitLines(body);
var newbody = "";
for(i=0;i' + word + '';
return template;
}
function aspire_splitLines(body)
{
var lineArray = body.split('\n');
return lineArray;
}
/*
***************************************************
* OList
***************************************************
*/
function aspire_olistCommand(commandname, subject, body, ci
, completesubjectline
, completeBody)
{
if (body == "")
{
ci.newSubject=subject;
return;
}
//body exists
var newbody = aspire_getOListBody(body);
newbody = '\n' + newbody + '
\n';
ci.newSubject=subject;
ci.newAppendText = newbody;
}
function aspire_getOListBody(body)
{
var lineArray=aspire_splitLines(body);
var newbody = "\n";
for(i=0;i\n";
}
function aspire_getListLine(line)
{
var template = '- ' + escapeSpecial(line) + '
';
return template;
}
/*
***************************************************
* PList
***************************************************
*/
function aspire_plistCommand(commandname, subject, body, ci
, completesubjectline
, completeBody)
{
if (body == "")
{
ci.newSubject=subject;
return;
}
//body exists
var newbody = aspire_getPListBody(body);
newbody = '\n' + newbody + '
\n';
ci.newSubject=subject;
ci.newAppendText = newbody;
}
function aspire_getPListBody(body)
{
var lineArray=aspire_splitLines(body);
var newbody = "";
for(i=0;i';
return template;
}
function escapeSpecial(line)
{
var newline = line.replace(//g,">");
return newline;
}
/**
* Google Drive link: gdlink
* 5/9/2018
*
* Converts from google drive image link
* https://drive.google.com/open?id=1dmTDZrfnlbubxaRFSH21o2A3_TIsVvo_
*
* to blong publishable link
* https://drive.google.com/uc?id=1dmTDZrfnlbubxaRFSH21o2A3_TIsVvo_
*
*/
function aspire_gdlinkCommand(commandname, subject, body, ci
, completesubjectline
, completeBody)
{
var gdriveSourceURL = body;
if (subject == "")
{
ci.errorMessage = "Subject is empty";
return;
}
if (gdriveSourceURL == "")
{
ci.errorMessage = "A google drive image url is required for this command";
return;
}
//subject is there
//image url is there
var targetGoogleDriveBaseURL = "http://drive.google.com/uc?id=";
var sourceGoogleDriveBaseURL = "https://drive.google.com/open?id=";
var fileIdIndex = gdriveSourceURL.indexOf("id=");
if (fileIdIndex == -1)
{
//Cannot find the pattern
ci.errorMessage = "Does not match the google drive file open URL pattern";
return;
}
//pattern found
var fileId = gdriveSourceURL.substring(fileIdIndex + 3);
dalert(fileId);
if (fileId == "")
{
ci.errorMessage = "File id not found";
return;
}
//file id found
var targetGoogleDriveImageURL = targetGoogleDriveBaseURL + fileId;
//body exists
var finalBody = '';
ci.newSubject=subject;
ci.newAppendText = finalBody;
return;
}
/*
***************************************************
* glistCommand
* aspire_glistCommand
*
* Given the following
*
* Subject|gslit
* topic1
* topic2
* topic3
*
* will then produce
*
*
***************************************************
*/
function aspire_gslistCommand(commandname, subject, body, ci
, completesubjectline
, completeBody)
{
if (body == "")
{
ci.newSubject=subject;
return;
}
//body exists
var newbody = aspire_getPListBody(body);
newbody = '\n' + newbody + '
\n';
ci.newSubject=subject;
ci.newAppendText = newbody;
//*******************************************
//inner function
//*******************************************
function aspire_getPListBody(body)
{
var lineArray=aspire_splitLines(body);
var newbody = "";
for(i=0;i';
return template;
}
function getWebSearchSegment(line)
{
var googleSearchUrl = aspire_getGoogleSearchURL(subject + ":" + line);
//Take the line and formulate a web search
//Search On Web
var newline = ''
+ 'Search On Web';
return newline;
}
}//eof-parent function
//*******************************************************
//Add this function globally
//*******************************************************
function aspire_getGoogleSearchURL(line)
{
var baseurl="http://www.google.com/search?hl=en&q=" + escape(line);
return baseurl;
}
/*
***************************************************
* 8/27/2020
* gdlink2Command
* aspire_gdlink2Command
*
* Given the following
*
* Subject|gdlink2
* (new google drive image url)
*
* will then produce
*
*
* Converts from google drive image link
* https://drive.google.com/file/d/1Lkx9qP6DcS9Pb7vadyfxkaSdsobziRkW/view?usp=sharing
*
* to blog publishable link
* https://drive.google.com/uc?id=1Lkx9qP6DcS9Pb7vadyfxkaSdsobziRkW
*
***************************************************
*/
function aspire_gdlink2Command(commandname, subject, body, ci
, completesubjectline
, completeBody)
{
if (body == "")
{
ci.newSubject=subject;
return;
}
//body exists
var newbody = aspire_getGdlink2Body(body);
newbody = '\n' + newbody + '\n
\n';
ci.newSubject=subject;
ci.newAppendText = newbody;
//*******************************************
//inner function
//should return the html for inside div
//*******************************************
function aspire_getGdlink2Body(body)
{
var gdriveSourceURL = body;
if (gdriveSourceURL == "")
{
ci.errorMessage = "A google drive image url is required for this command";
return;
}
//https://drive.google.com/file/d/1Lkx9qP6DcS9Pb7vadyfxkaSdsobziRkW/view?usp=sharing
var targetGoogleDriveBaseURL = "http://drive.google.com/uc?id=";
var sourceGoogleDriveBaseURL = "https://drive.google.com/file/d/";
var fileIdIndex = gdriveSourceURL.indexOf(sourceGoogleDriveBaseURL);
if (fileIdIndex == -1)
{
//Cannot find the pattern
ci.errorMessage = "Does not match the google drive file open URL pattern";
return;
}
var fileIdStartIndex = fileIdIndex + sourceGoogleDriveBaseURL.length;
var fileIdEndIndex = gdriveSourceURL.indexOf("/view",fileIdStartIndex);
if (fileIdEndIndex == -1)
{
//Cannot find the pattern
ci.errorMessage = "Does not match the google drive file open URL pattern";
return;
}
var fileid = gdriveSourceURL.substring(fileIdStartIndex,fileIdEndIndex);
var finalBody = '';
return finalBody;
}//eof-function
}//eof-parent function aspire_gdlink2Command
/*
***************************************************
* gitimageCommand
* aspire_gitimageCommand
*
* Given the following
*
* Subject|gitimage
* git image url (body)
*
* will then produce the following (by adding ?raw=true)
*
*
* Converts from git image link
* https://github.com/SatyaKomatineni/aspire/blob/master/docs/architecture/aspire-app-objects-in-configfile.png
*
* to
* https://github.com/SatyaKomatineni/aspire/blob/master/docs/architecture/aspire-app-objects-in-configfile.png?raw=true
*
***************************************************
*/
function aspire_gitimageCommand(commandname, subject, body, ci
, completesubjectline
, completeBody)
{
if (body == "")
{
ci.newSubject=subject;
return;
}
//body exists
var newbody = aspire_getgitimageBody(body);
newbody = '\n' + newbody + '\n
\n';
ci.newSubject=subject;
ci.newAppendText = newbody;
//*******************************************
//inner function
//should return the html for inside div
//*******************************************
function aspire_getgitimageBody(body)
{
var sourceGitImageURL = body;
if (sourceGitImageURL == "")
{
ci.errorMessage = "A git image url is required for this command";
return;
}
sourceGitImageURL = sourceGitImageURL.trim();
var finalBody = '';
return finalBody;
}//eof-function
}//eof-parent function aspire_gitimageCommand