[go: up one dir, main page]

0% found this document useful (0 votes)
22 views2 pages

ParseGoogle Main Interface

Uploaded by

Nam Nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

ParseGoogle Main Interface

Uploaded by

Nam Nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

{"javascript":"\n$(document).

ready(function() {\n \n\n var app = new Vue({\n


el: '#Main',\n data: {\n Log: [],\n Proxy: \"\",\n
ProxyResult: \"\",\n ProxyResultIsSuccess: true,\n
ProxyResultIsLoading: false,\n IsRunning: false,\n Thread:
null,\n Error: \"\",\n Query: \"\"\n },\n
computed:\n {\n LogPrepared: function(){\n var Res
= []\n for(var i = 0;i<this.Log.length/2;i++)\n {\n
var ListItem = {name: this.Log[i*2+1], link:this.Log[i*2]}\n
Res.push(ListItem)\n }\n return Res;\n }\n
},\n methods:\n {\n SaveResults: async function()\n
{\n var Data = this.Log.join(\"\\r\\n\")\n
Api.SaveFileDialog({caption: \"Where to save query result?\",filter: \"Text files
(*.txt)\"}).then(function(SelectedFile){\n if(SelectedFile)\n
{\n WriteFile(SelectedFile, Data)\n }\n
})\n },\n CheckProxy: async function()\n {\n
this.ProxyResult = \"\"\n this.ProxyResultIsSuccess = true\n
this.ProxyResultIsLoading = true\n \n\n var Thread =
new BASThread()\n\n try\n {\n
await Thread.RunFunction(\"SetProxy\", {\"ProxyLine\": this.Proxy})\n
var Result = await Thread.RunFunction(\"CheckIp\", {})\n
this.ProxyResult = Result\n this.ProxyResultIsSuccess = true\n
}catch(e)\n {\n this.ProxyResult = `Failed to
load page with proxy ${this.Proxy}`\n this.ProxyResultIsSuccess
= false\n }\n\n this.ProxyResultIsLoading = false\n\n
var self = this\n\n setTimeout(function(){\n
self.ProxyResult = \"\"\n self.ProxyResultIsSuccess = true\n
},5000)\n\n Thread.StopThread()\n },\n Search:
async function()\n {\n if(this.IsRunning)\n
{\n return;\n }\n \n\n
var self = this\n \n this.Log = []\n
this.Error = \"\"\n this.IsRunning = true;\n\n
if(this.Query.length == 0)\n {\n this.Log = []\n
this.Error = \"Query is empty\"\n this.IsRunning = false;\n
setTimeout(function(){\n self.Error = \"\"\n
},5000)\n return;\n }\n\n
this.Thread = new BASThread()\n try\n {\n
await this.Thread.RunFunction(\"SetProxy\", {\"ProxyLine\": this.Proxy})\n
var Log = await this.Thread.RunFunction(\"Query\", {\"Text\": this.Query})\n
if(Log)\n this.Log = Log;\n else\n
{\n throw \"Empty data\"\n }\n
}catch(e)\n {\n this.Error = e\n
setTimeout(function(){\n self.Error = \"\"\n
},5000)\n }\n this.Thread.StopThread()\n
this.IsRunning = false;\n\n },\n Stop: async function()\n
{\n if(!this.IsRunning)\n {\n
return;\n }\n\n this.Log = []\n
this.Error = \"\"\n \n this.Thread.StopThread()\n
this.IsRunning = false;\n }\n }\n })\n\n /////Api event
handler\n Api.SetEventHandler(function(EventType, EventData){\n \
n /////Script started\n if(EventType == \"start\")\n {\n }\n\n
/////Script stopped\n if(EventType == \"stop\")\n {\n }\n\
n /////More events:
https://wiki.bablosoft.com/web-interface/#/managingscriptlifetime\n \n })\
n\n /////Automatically start script
https://wiki.bablosoft.com/web-interface/#/managingscriptlifetime?id=method-
acceptresources\n Api.AcceptResources(true)\n\n\n /////After everything is
initialized may show body\n $(\"body\").fadeIn()\n\n /////Events\n\n});\n\
n/////Resource values are obtained through this function when hitting run button,
you can change it.\n/////For example, you can edit value entered by user, make
custom validation, or replace resource system compleatelly\n/////More info:
https://wiki.bablosoft.com/web-interface/#/managingscriptlifetime?id=method-
acceptresources\nfunction GetResourceValue(ResourceName)\n{\n return \"\"\n}\n\
n\n//Interface editor has no connection to BAS and therefore can't execute BAS
functions. \n//If you try to call function from interface editor, \n//you will get
a random string as result in a several seconds. \n//This behavior is not acceptable
in several cases: if your function return a list, \n//not a string, or string in
specific format, if you want to test error handling, etc. \n//In order to
circumvent this limitation. you need to define \"EmulateFunctionRun\" \n//function
inside web interface.\n//More info:
https://wiki.bablosoft.com/web-interface/#/callbasfunction?id=debugging-bas-
function-call\n\nfunction EmulateFunctionRun(FunctionName, FunctionParameters,
Resolve, Reject)\n{\n \n //Generate random data\n var RandomTime =
Math.floor(Math.random() * (1000 - 500) ) + 500\n var RandomResult =
Math.floor(Math.random() * (1000))\n\n //Return result in RandomTime
milliseconds\n setTimeout(function(){\n //Generate result string\n
if(FunctionName == \"Query\")\n {\n Resolve([\
n \"Test result link1\",\"Test result name1\",\
n \"Test result link2\",\"Test result name2\",\
n \"Test result link3\",\"Test result name3\",\n ])\n
\n }else\n {\n Resolve(\"Test result \" + RandomResult)\n
}\n },RandomTime)\n\n}","cssFiles":["https://cdn.jsdelivr.net/npm/semantic-
ui@2.4.2/dist/semantic.min.css"],"jsFiles":["https://bablosoft.com/buildinterface/
jquery/jquery.min.js?v=3","https://bablosoft.com/buildinterface/bas-api/bas-api.js?
v=3","https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/
semantic.min.js","https://cdn.jsdelivr.net/npm/vue"],"css":"#Main\r\n{\r\n
padding:10px;\r\n}\r\n\r\n.text-red\r\n{\r\n color:#D95C5C\r\n}\r\n\r\n.text-
green\r\n{\r\n color:#5BBD72 !important;\r\n}\r\n\r\n.notice\r\n{\r\n font-
size:small;\r\n color:gray;\r\n \r\n}","html":"\n\n\n<div class=\"ui fluid
container\" id=\"Main\">\n <h3 class=\"ui header\"><i>ParseGoogle</i></h3> \n
\n <div style=\"margin-bottom:30px;\">\n <i class=\"info circle icon\"
style=\"color:E07B53\"></i> <span class=\"notice\">ParseGoogle - helps to make
google query and saves results to file. Project is written entirely on <a
href=\"#\"
@click=\"OpenUrl('https://bablosoft.com/shop/BrowserAutomationStudio')\">BrowserAut
omationStudio</a>.</span>\n </div>\n <form class=\"ui form\">\n <div
class=\"field\">\n <label>Proxy: </label>\n <input
type=\"text\" placeholder=\"Proxy\" v-model=\"Proxy\" >\n \n
</div>\n <div class=\"field\">\n <input type=\"button\"
class=\"ui button\" value=\"Check proxy\" @click=\"CheckProxy\"/>\n <div
v-if=\"ProxyResultIsLoading\" class=\"ui active inline loader\"></div>\n
<span v-bind:class=\"{ 'text-green': ProxyResultIsSuccess, 'text-red': !
ProxyResultIsSuccess }\">{{ProxyResult}}</span>\n </div>\n <div
class=\"field\">\n <label>Google search query: </label>\n
<input type=\"text\" placeholder=\"Query\" v-model=\"Query\" >\n </div>\n
\n </form>\n \n \n \n <button class=\"ui primary button\" v-
if=\"!IsRunning\" @click=\"Search\">Search</button>\n <button class=\"ui
button\" v-if=\"IsRunning\" @click=\"Stop\">Stop</button>\n <button class=\"ui
button\" v-if=\"Log.length > 0\" @click=\"SaveResults\">\n <i
class=\"download icon\"></i>\n Save results\n </button>\n \n\n <div
class=\"text-red\" style=\"margin-bottom:10px;margin-top:10px\">{{Error}}</div>\n\n
<div class=\"ui relaxed divided list\">\n <template v-for=\"item in
LogPrepared\">\n <div class=\"item\">\n <i class=\"large
google middle aligned icon\"></i>\n <div class=\"content\">\n
<a class=\"header\" @click=\"OpenUrl(item.link)\">{{item.link}}</a>\n
<div class=\"description\">{{item.name}}</div>\n </div>\n
</div>\n </template>\n </div>\n \n \n</div>\n "}

You might also like