Worked on ScriptManager
This commit is contained in:
parent
84d0481371
commit
bfdb9405fc
5 changed files with 45 additions and 3 deletions
16
BankingBot/ScriptManagement/ScriptBundles.cs
Normal file
16
BankingBot/ScriptManagement/ScriptBundles.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankingBot.ScriptManagement
|
||||
{
|
||||
public static class ScriptBundles
|
||||
{
|
||||
public static string[] Global => new[]
|
||||
{
|
||||
"jquery-3.1.1.min"
|
||||
};
|
||||
}
|
||||
}
|
|
@ -19,9 +19,20 @@ namespace BankingBot.ScriptManagement
|
|||
_browserBot = browserBot;
|
||||
}
|
||||
|
||||
public T Execute<T>(string scriptPath, Dictionary<string, string> data = null)
|
||||
public T Execute<T>(string scriptPath, Dictionary<string, string> data = null, string[] includedScripts = null)
|
||||
{
|
||||
var scriptContent = File.ReadAllText(scriptPath);
|
||||
var scriptContent = "";
|
||||
|
||||
if (includedScripts != null)
|
||||
{
|
||||
foreach (var script in includedScripts)
|
||||
{
|
||||
var includedScriptContent = File.ReadAllText(script).Trim();
|
||||
scriptContent += includedScriptContent;
|
||||
}
|
||||
}
|
||||
|
||||
scriptContent += File.ReadAllText(scriptPath).Trim();
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
|
|
11
BankingBot/ScriptManagement/Scripts/global.js
Normal file
11
BankingBot/ScriptManagement/Scripts/global.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
var global = (function (module) {
|
||||
|
||||
function testFunction() {
|
||||
console.log("test!");
|
||||
}
|
||||
|
||||
return {
|
||||
testFunction: testFunction
|
||||
};
|
||||
|
||||
})(global || {});
|
4
BankingBot/ScriptManagement/Scripts/jquery-3.1.1.min.js
vendored
Normal file
4
BankingBot/ScriptManagement/Scripts/jquery-3.1.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,3 @@
|
|||
(function () {
|
||||
var test = (/*{test}*/);
|
||||
var netVersion = __$netVersion;
|
||||
})();
|
Loading…
Add table
Reference in a new issue