Remove jQuery
This commit is contained in:
parent
8c97a625e1
commit
e4b1c44aa3
|
@ -27,9 +27,7 @@ namespace Ooui.Forms.Renderers
|
|||
if (e.NewElement != null) {
|
||||
if (Control == null) {
|
||||
var input = new Input (InputType.Checkbox);
|
||||
input.SetAttribute ("data-toggle", "toggle");
|
||||
SetNativeControl (input);
|
||||
input.Call ("$.bootstrapToggle");
|
||||
Control.Change += OnControlValueChanged;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,19 +84,11 @@ function ooui (rootElementPath) {
|
|||
const messages = JSON.parse (event.data);
|
||||
if (debug) console.log("Messages", messages);
|
||||
if (Array.isArray (messages)) {
|
||||
const jqs = []
|
||||
messages.forEach (function (m) {
|
||||
// console.log('Raw value from server', m.v);
|
||||
m.v = fixupValue (m.v);
|
||||
if (m.k.startsWith ("$.")) {
|
||||
jqs.push (m);
|
||||
}
|
||||
else {
|
||||
processMessage (m);
|
||||
}
|
||||
});
|
||||
// Run jQuery functions last since they usually require a fully built DOM
|
||||
jqs.forEach (processMessage);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -212,15 +204,14 @@ function msgCall (m) {
|
|||
console.error ("Unknown node id", m);
|
||||
return;
|
||||
}
|
||||
const isJQuery = m.k.startsWith ("$.");
|
||||
const target = isJQuery ? $(node) : node;
|
||||
const target = node;
|
||||
if (m.k === "insertBefore" && m.v[0].nodeType == Node.TEXT_NODE && m.v[1] == null && hasText[id]) {
|
||||
// Text is already set so it clear it first
|
||||
if (target.firstChild)
|
||||
target.removeChild (target.firstChild);
|
||||
delete hasText[id];
|
||||
}
|
||||
const f = isJQuery ? target[m.k.slice(2)] : target[m.k];
|
||||
const f = target[m.k];
|
||||
if (debug) console.log ("Call", node, f, m.v);
|
||||
const r = f.apply (target, m.v);
|
||||
if (typeof m.rid === 'string' || m.rid instanceof String) {
|
||||
|
|
|
@ -230,20 +230,6 @@ namespace Ooui
|
|||
SendSet ("style." + Style.GetJsName (e.PropertyName), Style[e.PropertyName]);
|
||||
}
|
||||
|
||||
protected override bool SaveStateMessageIfNeeded (Message message)
|
||||
{
|
||||
if (message.TargetId != Id)
|
||||
return false;
|
||||
|
||||
switch (message.MessageType) {
|
||||
case MessageType.Call when message.Key.StartsWith ("$.", StringComparison.Ordinal):
|
||||
AddStateMessage (message);
|
||||
return true;
|
||||
default:
|
||||
return base.SaveStateMessageIfNeeded (message);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual bool HtmlNeedsFullEndElement => false;
|
||||
|
||||
public override void WriteOuterHtml (System.Xml.XmlWriter w)
|
||||
|
|
|
@ -40,7 +40,6 @@ namespace Ooui
|
|||
<title>@Title</title>
|
||||
<meta name=""viewport"" content=""width=device-width, initial-scale=1"" />
|
||||
<link rel=""stylesheet"" href=""https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"" />
|
||||
<link rel=""stylesheet"" href=""https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css"" />
|
||||
<style>@Styles</style>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -49,8 +48,6 @@ namespace Ooui
|
|||
@InitialHtml
|
||||
</div>
|
||||
|
||||
<script type=""text/javascript"" src=""https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js""></script>
|
||||
<script type=""text/javascript"" src=""https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js""></script>
|
||||
<script src=""/ooui.js""></script>
|
||||
<script>ooui(""@WebSocketPath"");</script>
|
||||
</body>
|
||||
|
|
Loading…
Reference in New Issue