Skip to content

Commit

Permalink
js: Migrate code to not use deprecated 2.x features
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw committed Jan 28, 2024
1 parent 43b0624 commit f91bb60
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 19 deletions.
2 changes: 1 addition & 1 deletion dpl-docs/views/layout.dt
Original file line number Diff line number Diff line change
Expand Up @@ -244,5 +244,5 @@ html(lang='en-US')
script(type='text/javascript', src='#{root_dir}js/listanchors.js')
script(type="text/javascript", src="#{root_dir}js/ddox.js")
script(type='text/javascript').
jQuery(document).ready(listanchors);
jQuery(listanchors);
setupDdox();
17 changes: 3 additions & 14 deletions js/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ All examples are replaced with custom form by default. You need to do additional
your example to have default standard input or default standard arguments.
*/

var nl2br = function()
{
return this.replace(/\n/g, "<br>");
}

function safeVar(data, path)
{
var p = path.split(".");
Expand Down Expand Up @@ -150,10 +145,7 @@ function parseOutput(res, o, oTitle)
if (res.cstatus != 0)
{
oTitle.text("Compilation output ("+res.cstatus+": "+res.cerr+")");
if ($.browser.msie)
o.html(nl2br(res.cout));
else
o.text(res.cout);
o.text(res.cout);

return;
}
Expand All @@ -172,10 +164,7 @@ function parseOutput(res, o, oTitle)
oTitle.text("Application output ("+res.rstatus+": "+res.rerr+")");
}

if ($.browser.msie)
o.html(nl2br(res.cout));
else
o.text(output);
o.text(output);
}

// wraps a unittest into a runnable script
Expand All @@ -197,7 +186,7 @@ function wrapIntoMain(code, compile) {
}
}

$(document).ready(function()
$(function()
{
setUpExamples();

Expand Down
2 changes: 1 addition & 1 deletion js/run_examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function wrapIntoMain(code) {
return codeOut;
}

$(document).ready(function()
$(function()
{
if ($('body')[0].id == "Home")
return;
Expand Down
2 changes: 1 addition & 1 deletion js/show_contributors.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function isPackage()
return $('.tip.smallprint a[href*="package.d"]').length > 0;
}

$(document).ready(function()
$(function()
{
// only for library documentation
if (!$('body').hasClass("std"))
Expand Down
2 changes: 1 addition & 1 deletion spec/spec.ddoc
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,5 @@ RAWHTML=$0
_=
LAYOUT_SUFFIX =
$(SCRIPTLOAD ../js/listanchors.js)
$(SCRIPT jQuery(document).ready(addVersionSelector);)
$(SCRIPT jQuery(addVersionSelector);)
_=
2 changes: 1 addition & 1 deletion std.ddoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ BODY_PREFIX = $(DIVCID quickindex, quickindex, )
LAYOUT_SUFFIX =
$(SCRIPTLOAD ../js/listanchors.js)
$(SCRIPTLOAD ../js/show_contributors.js)
$(SCRIPT jQuery(document).ready(listanchors);)
$(SCRIPT jQuery(listanchors);)
LAYOUT_TITLE=$(H1 $(D_TITLE $(TITLE)))
_=

Expand Down

0 comments on commit f91bb60

Please sign in to comment.