|
So what help is it that you need?
|
|
|
|
|
Hi My modal popup has stopped working I think it could be because I have loaded similar scripts but new to this so don't know. These are the scripts that my _layout.cshtml tries to load:
<script src="/Scripts/jquery-1.10.2.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tabulator/4.4.3/js/tabulator.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/tabulator/4.4.3/css/bootstrap/tabulator_bootstrap.min.css" rel="stylesheet" />
<link href="https://nightly.datatables.net/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.2/jquery-confirm.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script src="/Scripts/jquery.signalR-2.1.1.js"></script>
The error I get is:
Uncaught TypeError: jQuery(...).modal is not a function
at Object.success (Create:34323)
at fire (jquery-1.10.2.js:3048)
at Object.fireWith [as resolveWith] (jquery-1.10.2.js:3160)
at done (jquery-1.10.2.js:8235)
at XMLHttpRequest.callback (jquery-1.10.2.js:8778)
|
|
|
|
|
Are you sure that the jQuery UI script is being loaded before the script which tries to create or show the jQuery UI Modal?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I can not be sure but I have it working again now. I have changed the order of the scripts to the following:
<script src="~/Scripts/jquery-1.10.2.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tabulator/4.4.3/js/tabulator.min.js"></script>
<link href="https://nightly.datatables.net/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script src="~/Scripts/jquery.signalR-2.1.1.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/tabulator/4.4.3/css/bootstrap/tabulator_bootstrap.min.css" rel="stylesheet" />
Many thanks
|
|
|
|
|
Member 14695956 wrote: <script src="/Scripts/jquery-1.10.2.js"></script>
My guess, yuor jQuery version is quite old. Try latest and see. Current version: Download jQuery | jQuery
Quick check try:
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
Also, make sure reference to bootstrap JavaScript is after jquery file reference.
|
|
|
|
|
Hi Thanks for your reply I needed to keep this version of Jquery due to the fact that I am using signalr and I could only get it to work with this version. I have found a work around by not using jquery-confirm.min.js as this seems to also conflict. and use a Modal form as my alert box. May not be the neatest but it works.
|
|
|
|
|
Hi,
I am almost new with javascript.
I finally succeeded to write the foundation of a small javascript game but I am blocked at one point.
My question is simple: how can I call the function quitGame() from outside the Game() function?
[code]
var settings = "blablah";
new Game(settings);
...
quitGame(settings)
var Game = function(settings) {
...
function quitGame(settings) {
...
}
} [/code]
I would be thankful for any help or comment about my code.
I wish you a pleasant lockdown, stay safe
|
|
|
|
|
|
Working with objects - JavaScript | MDN[^]
The simplest option:
var Game = function(settings) {
...
this.quitGame = function(settings) {
...
}
};
var settings = "blablah";
var game = new Game(settings);
...
game.quitGame(settings);
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Is there a way to get the extension of an image if you know it's link? At first I thought of splitting the string with . and get the last part, but the problem with this is that there are some links that don't include the extension at the end so this is not an universal solution.
Because I know the link each time, is there something I can do with an image object (new Image), or how else can I get the extension? All the results I got were to check if it is an image but not it's extension, or the one I explained above, but that won't work in every scenarios.
This will be done in a extension for Firefox.
modified 9-Nov-20 16:23pm.
|
|
|
|
|
mebbe something like...
file = url.split('/').pop();
|
|
|
|
|
Unfortunately like I said, there are some website where the file name and the extensions is not included into the link, so there is nothing to split to get them.
But even then, if you use the built-in "Save Image As...", the browser still knows what those are, so there has to be a way to do it.
|
|
|
|
|
|
Richard Deeming wrote:
To read this from Javascript, either the image will need to be on the same domain as your page, or the remote domain will need to set the CORS headers to allow your site to request the image.
Because this will not work in Javascrip with all websites which we actually need, in what other language can it be done?
I do apologies, web applications is not what I normally do, but this time I have to do it and learn for the future, maybe I'll run into something similar.
|
|
|
|
|
You'd have to write something on the server - eg: ASP.NET, PHP, etc. Basically, any server-side language that can make a HEAD request and read the headers from the response.
For example, in C#:
public static async Task<string> GetContentType(HttpClient client, string url)
{
if (string.IsNullOrEmpty(url)) throw new ArgumentNullException(nameof(url));
if (!Uri.TryCreate(url, UriKind.Absolute, out var uri)) throw new ArgumentException("Invalid URL", nameof(url));
using (var request = new HttpRequestMessage(HttpMethod.Head, uri))
using (var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead))
{
response.EnsureSuccessStatusCode();
return response.Content.Headers.ContentType.MediaType;
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
We don't have any control over the server, this is goin to be done in a extension for Firefox. We added a new contextMenu for images only, and from that we can get the Url, but as I said in the first thread there are some websites that don't add the name and the extension directly into the link (example.com/image.jpg / example.com/someImage), so we need to find another way to get them when the user right click's on it.
|
|
|
|
|
Once again, there may not be an image extension. You will have to use the content type.
It looks like it is possible to request extra permissions to your extension to bypass CORS restrictions for certain domains:
permissions - Mozilla | MDN[^]
But it may be easier to intercept the network requests from your extension:
Intercept HTTP requests - Mozilla | MDN[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: But it may be easier to intercept the network requests from your extension:
Intercept HTTP requests - Mozilla | MDN[^]
I'll try this and see if I manage to make something using it. I first thought this whole thing will be something easy.
|
|
|
|
|
Hello all,
I would like to ask you for a help. I would like make a function for add a class. For interactive map. It means there will be a few segments and ONCLICK will be ADD CLASS.
I used this code:
function myFunction() {
document.getElementById("praha").className = "show";
} It works, but only for 1st segment.
I would like to use something like OR. I tried this:
function myFunction() {
document.getElementById("praha").className = "show"; ||
document.getElementById("stredniCechy").className = "show";
} or
function myFunction() {
document.getElementById("praha"||"stredniCechy").className = "show";
} But both of them doesnt works... Could someone give me an advice and help me with it ?
Many thanks
|
|
|
|
|
Those statements do not make sense, as there is no condition test. You first need to add a test to decid which one is required, somthing like:
eltname = (<condition test goes here>) ? "praha" : "stredniCechy";
document.getElementById(eltname).className = "show";
The condition test is whatever you use to decide which name to use.
|
|
|
|
|
Hi, I've created a small library for declaring Maps, WeakMaps or maps-like arrays. Maybe someone will find it useful.
https://www.npmjs.com/package/jsman
https://github.com/mothgears/jsman
|
|
|
|
|
This is a Javascript based Q&A forum. In case you want to share your work, would suggest you to submit it as Your GitHub Project on CodeProject with details about how it is useful and can be used. Follow the guidelines and submit, it will showcase as other articles for people to read.
With current message, most will not be able find what you want to share and will be lost. Thanks!
|
|
|
|
|
This alghoritm i want to use to create shape for cnc foam cutter ... so a one line need to pass all countour paths
for example:
i have 4 path with x,y points coordonates
path1=[[5,3][3,2][8,9][8,8][7,3]]
path2=[[1,9][8,4][3,6]]
path3=[[8,3][4,7][1,2][2,7][4,2][7,5]]
path4=[[4,3][1,7][9,7][8,0]]
Alghoritm need to find in primis a most low value apropriate to 0 in this case [1,2] that is in path3 point 3
After find this point...compare all points of path3 with points of all paths and find most appropiate value ... in this case [8,4] from path2 that is closest to [8,2] from path3
after find most apropiate value ...join the path3 with path 2 in pointers find
result_path=[[0,0]->[1,2][2,7][4,2][7,5]->[8,3]->[8,4][3,6]->[1,9]->[4,7]]
And after join path2 with path3 in this mode ... compare all points of result_path with points of remainder paths (path1,path4) ... and insert path find in result_path in same mode
I dont know how explain better!
|
|
|
|
|
Is this a Javascript question or are you just looking for a generic algorithm? If the latter then please use the correct forum at Algorithms Discussion Boards[^].
|
|
|
|
|
i put this post also in algoritms ... but ... message closed!!!
|
|
|
|