|
How do you think you could do that?
|
|
|
|
|
is there way to to access the Track Changes log in the microsoft word document using javascript or jquery
|
|
|
|
|
Hi
I need to display subject email on my local website. I found solution in ActiveX but it work only for IE.
But i need it display it on chrome or firefox.
Someone have idea how to do this? Can i do it in javascripts? Maybe other lang? jquery?
Thx for help
|
|
|
|
|
If you're trying to access or automate the email client installed on the user's PC from a website, give up now. You can't do that, because it would be a major security vulnerability.
If you want to access a mailbox for which you have the credentials, you'll need to use an IMAP library. For example, in .NET, use MailKit[^]. For Javascript, emailJS[^] seems to be the only option, but it doesn't seem to be actively maintained.
NB: Unless this is an intranet application, asking the user for their mailbox credentials will likely get your site blocked for phishing.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi All I am using Ember even though I am making changes but when I run the ./watch its not producing the JavaScript file with new code - its annoying - I am making the manual change but that's not correct solution right? I made the change to the file even by opening in folder and manually updated the code on ember file - still its writing the old code in app.js file. What could be the reason I don't know. I am using Web Pack to run ./watch and generate the app.js file
Here is my Ember js code:
export default () => {
IMS.registerController("case.details.assignedinspector.edit", {
caseDetails: Ember.inject.controller('caseDetails'),
caseId: Ember.computed.alias('caseDetails.model.imscase.id'),
clearForm: function () {
$('.modal').modal('hide');
},
actions: {
close: function (id) {
$('.modal').modal('hide');
this.transitionToRoute('case.details');
},
async save() {
var scope = this;
if ($("#edit-assignedinspector-form").validate()) {
var data = {
AssignedToInvestigators: Ember.get(scope, 'model.imscase.assignedToInvestigators'),
CaseId: this.get('caseId')
};
try {
let response = await this.api('Case/UpdateAssignedInvestigators').post(data);
$('.modal').modal('hide');
toastr.success("Assigned Inspector Edit Saved.");
scope.transitionToRoute("case.details");
scope.get('caseDetails').refreshData();
scope.clearForm();
} catch (ex) {
toastr.error("Error saving Assigned Inspector.");
}
}
else {
toastr.warning("Please fix the form", "Validation failed");
}
},
didInsert: function () {
$('#edit-assignedinspector-modal').modal();
}
}
});
}
Here is how its generating the old code in app.js file - any help please?
save: function () {
var _save = _asyncToGenerator(
regeneratorRuntime.mark(function _callee() {
var scope, data, response;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
scope = this;
if (!$("#edit-assignedinspector-form").validate()) {
_context.next = 19;
break;
}
data = {
AssignedToInspectorId: $("#assignedInspectorSelect").chosen().val(),
CaseId: this.get('caseId')
};
_context.prev = 3;
_context.next = 6;
return this.api('Case/UpdateAssignedInspector').post(data);
case 6:
response = _context.sent;
$('.modal').modal('hide');
toastr.success("Assigned Inspector Edit Saved.");
scope.transitionToRoute("case.details");
scope.get('caseDetails').refreshData();
scope.clearForm();
_context.next = 17;
break;
case 14:
_context.prev = 14;
_context.t0 = _context["catch"](3);
toastr.error("Error saving Assigned Inspector.");
case 17:
_context.next = 20;
break;
case 19:
toastr.warning("Please fix the form", "Validation failed");
case 20:
case "end":
return _context.stop();
}
}
}, _callee, this, [[3, 14]]);
}));
function save() {
return _save.apply(this, arguments);
}
return save;
}()
It is supposed to call Case/UpdateAssignedInvestigators instead its still calling the Case/UpdateAssignedInspector, which is incorrect.
Any help would be very very helpful - a link, a suggestion or even a code snippet anything helps thanks in advance.
modified 11-Mar-20 15:09pm.
|
|
|
|
|
Hello, I'm new here.
I am designing an intranet, of which I require that the user when making a request for a product will be able to select it directly from the database and send that request.
From the page where the requests originate, I added a search button for the user to search for the specific product and add it to their product request, this was done with ajax live search.
From the results of that search, a list is usually displayed with the possible results, the objective, and it is where I am blocked, is that from the list with the results, the user chooses the one he wants and this is inserted in the request for the parent page.
I have these live search files in ajax, php and mysql:
search-form.php (popup):
<?php
session_start();
$_SESSION['username'];
$link = mysqli_connect("localhost", "user", "", "database");
if ($link === false) {
die("ERROR: Could not connect. " . mysqli_connect_error());
}
?>
<html>
<head>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?libraries=places&language=en"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="../../bower_components/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="../../bower_components/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../../bower_components/Ionicons/css/ionicons.min.css">
<link rel="stylesheet" href="../../dist/css/AdminLTE.min.css">
<link rel="stylesheet" href="../../dist/css/skins/skin-blue.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
<script>
$(document).ready(function(){
load_data();
function load_data(query)
{
$.ajax({
url:"backend-search.php",
method:"POST",
data:{query:query},
success:function(data){
$('#result').html(data);
}
});
}
$('#search').keyup(function(){
var search = $(this).val();
if(search != ''){
load_data(search);
}else{
load_data();
}
});
});
</script>
</head>
<body>
<div class="container-fluid">
<div class="wall">
<section class="content">
<div class="box box-default">
<div class="box-header with-border"></div>
<div class="box-body">
<div class="row">
<h3>Ricerca Prodotto</h3>
<div class="col-xs-12">
<input type="text" name="search" id="search" placeholder="Cerca il codice" class="form-control" style="width: 300px;" />
<div id="result"></div>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
</body>
</html>
backend-search.php (same popup)
<?php
$link = mysqli_connect("localhost", "user", "", "database");
if ($link === false) {
die("ERROR: Could not connect. " . mysqli_connect_error());
}
$content = '';
if (isset($_POST["query"])) {
$search = mysqli_real_escape_string($link, $_POST["query"]);
$query = $sql = "SELECT * FROM spesa_articoli_disponibili WHERE Codice_Articolo_CAPP LIKE '%" . $search . "%' OR ARTICOLO_Descrizione LIKE '%" . $search . "%'";
}
$result = mysqli_query($link, $query);
if (mysqli_num_rows($result) > 0) {
$content .= '
<div class="table-responsive">
<table class="table table-bordered" id="item_table">
<div class="group">
</div>';
while ($row = mysqli_fetch_assoc($result)) {
$codice = $row["Codice_Articolo_CAPP"];
$articolo = $row["ARTICOLO_Descrizione"];
$content .= '
<div>
<div>
<table class="table table-bordered">
<form method="post" id="searchform">
<tr>
<th>Codice Articolo</th>
<th>Descrizione Articolo</th>
</tr>
</div>
<div>
<tr>
<td><input type="number" id="codice" name="codice" value="' . $codice . '" style="width: 70px;" readonly="readonly" /></td>
<td><input type="text" id="articolo" name="articolo" value="' . $articolo . '" style="width: 100%" readonly="readonly" /></td>
<td><input type="button" value="Aggiungi" onclick="getValue();" /></td>
<td><a href="JavaScript:window.close()">Chiudi</a></td>
</tr>
</div>
</form>
</table>
<div id="resultado"></div>
</div>';
}
echo $content;
} else {
echo "Non ci sono risultati. Riprova.";
}
mysqli_close($link);
?>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
function getValue() {
var codice = window.opener.document.getElementById("codice");
codice.value = document.getElementById("codice").value;
var articolo = window.opener.document.getElementById("articolo");
articolo.value = document.getElementById("articolo").value;
}
window.close();
}
</script>
So far I have not been able to select the search result and send the values to the parent page.
Ideas, help, suggestions, all will be well received.
Thanks in advance.
Valter.
|
|
|
|
|
Is the variable query getting passed to the backend php?
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Hey ZurdoDev, do you mean after choose a product from the list? Yes, the main purpose is select the product and pass it (codice, articolo) pass it to the main window form, from there it will be inserted to mysql database.
Main window(php) -> popup window/search product/select product(php/js) -> main window form(php) -> ok with your choice? yes -> pass it to the database (array to string).
That will be the main structure.
Thanks in advance.
|
|
|
|
|
I don't understand where you are stuck, that is what I was trying to get to.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Ok, the main point in this post is to catch/select anye result from the search of the live search ajax, as you can see in the code, for every result there is a button (aggiungi or add) that should cover the base, but, on any product that i click, always is pass it the first result.
Now I don't if this have to do with the fact that the document.getElementById is the problem and change it to byclassname or I don know.
I am stuck in this particular matter.
Thank you
|
|
|
|
|
vlafratta wrote: as you can see in the code, Actually, no, I can't run the code so just looking at a bunch of code it is not obvious what is happening or what should be happening.
vlafratta wrote: always is pass it the first result. You probably have controls with the same id over and over. You'll need to make sure they have unique ids.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Finally could apply a solution:
Replace the way how it's show the result from the ajax live search to this:
<div>
<div>
<div>
<div class="child" data-id="' . $codice . '" data-id2="' . $articolo . '"><span>COD: ' . $codice . ' - DESC: ' . $articolo . '</span></div>
</div>
</div>
<div>
<div id="resultado"></div>
</div>
For the Javascript, replace it with JQuery:
<script type="text/javascript">
$(document).ready(function(){
$(".child span").click(function(){
code = $(this).parent().attr('data-id');
articolo = $(this).parent().attr('data-id2');
window.opener.$('#codice').val(code);
window.opener.$('#articolo').val(articolo);
window.close();
});
})
</script>
Thank you all.
Valter.
|
|
|
|
|
vlafratta wrote: $query = $sql = "SELECT * FROM spesa_articoli_disponibili WHERE Codice_Articolo_CAPP LIKE '%" . $search . "%' OR ARTICOLO_Descrizione LIKE '%" . $search . "%'";
Don't do it like that!
Your code is vulnerable to SQL Injection[^]. NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.
PHP: SQL Injection - Manual[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I am just starting to learn JavaScript and am following an online course my company provides for IT Training. I have set up my environment as instructed, created my “Hello World!” and more.
We have not yet gotten to the Functions section, but the instructor created a utility.js file as follows:
Function showMessage(message) {
document.getElementById(‘message’).textContent = message;
}
However, as I begin entering in “showMessage” it is underlined in red squiggly line. So I slowly re-entered it to let pre-fill find the command “sho” it stops. ShowMessage is not available to use.
I am learning how to use both home.js and utility.js files to modify webpage, index.html, by placing an “id=“message” to change the index.html based on a home.js file that contains “showMessage(“Changes....”);
But the real issue is the Function missing from my “libraries or binary” files?
Thank you to anyone that may be able to answer why that Function may be missing or if it can be added. If left as is, the webpage when refreshed does not display Changes....
Sincerely, 60 year old learning JavaScript so I can quickly learn JSON to be able to make API calls via LAMBDA to leverage CloudFormation templates to build our stacks in AWS Cloud.
Thanks again, life-long learner,
VinManinho
|
|
|
|
|
|
Here is the code below I am hoping for help on. What I believe ought to happen is ten randomly colored/ shaped lines are successively drawn 1 every 500ms over 5 seconds in the <canvas> box. But all I am getting is a black canvas box.
All "//" and "NOTES" are IMPORTANT!
<html>
<head>
</head>
<body>
<canvas id="myCan" style="background: black;" width=720 height=420>
</canvas>
<script>
var canv = document.getElementById('myCan');
var ctx = canv.getContext('2d');
var t = 500; // time iteration
function draw() { // - - draw
ctx.beginPath();
c1x.canv.width*Math.random(); // bezier control 1 NOTES: original code has height ... so try please with your solutions
c1y.canv.height*Math.random(); // bezier control
c2x.canv.width*Math.random(); // bezier control 2 NOTES: original code has height ... so try please with your solutions
c2y.canv.height*Math.random(); // bezier control
x.canv.width*Math.random(); // random point
y.canv.height*Math.random();
x1.canv.width/2; // mid-point
y1.canv.height/2;
ctx.moveTo(x1, y1); // starting point
ctx.bezierCurveTo(c1x, c1y, c2x, c2y, x, y); // bezier curve
ctx.closePath();
ctx.lineWidth = Math.random()*20;
ctx.strokeStyle = hsl(' + Math.random()*360 + ', 50%, 50%); // color of bezier beam
ctx.shadowColor = 'white';
ctx.shadowBlur = Math.random()*50;
ctx.stroke();
ctx.strokeRect(c1x, c1y, 1, 1);
ctx.strokeRect(c2x, c2y, 2, 2);
}
draw();
setInterval(draw, t); // internal timer
setInterval(function() {ctx.clearRect(0, 0, canv.width, canv.height)}, 10*t);
// 10 shapes, '10*t
// 9 shapes, 9*t etc.
</script>
</body>
</html>
That is all.
Thank you.
|
|
|
|
|
There are a couple of problems with the code. The lines c1x.canv... down to y1.canv... should be assigning values to variables:
var c1x = canv.width*Math.random();
var c1y = canv.height*Math.random();
var c2x = canv.width*Math.random();
var c2y = canv.height*Math.random();
var x = canv.width*Math.random();
var y = canv.height*Math.random();
var x1 = canv.width/2;
var y1 = canv.height/2;
The other problem is the stroke style, where the hsl value must be quoted properly:
ctx.strokeStyle = 'hsl(' + Math.random()*360 + ', 50%, 50%)';
|
|
|
|
|
function generateLayout(seats, zIndex) {
var busLayoutHtmlTmpl = '';
var maxNoOfColumns = 0;
var missingPathWayRowNO = -1;
var missingPathWayRowNOTmp = 0;
var isfirtRow = 0;
var isDriverSeat = true;
var rowSeatValues = [];
var columnSeatValues = [];
_.each(seats, function (columnSeats, rowIndex) {
if (isfirtRow == 0) {
missingPathWayRowNOTmp = rowIndex;
isfirtRow = 1;
} else {
if (parseInt(missingPathWayRowNOTmp) + 1 != rowIndex) {
missingPathWayRowNO = parseInt(missingPathWayRowNOTmp) + 1;
} else {
missingPathWayRowNOTmp = parseInt(missingPathWayRowNOTmp) + 1;
maxNoOfColumns = columnSeats.length > maxNoOfColumns ? columnSeats.length : maxNoOfColumns;
}
}
});
var v = [];
_.each(zIndex, function (seats, t) {
$.inArray(seats, v) === -1 && v.push(seats)
}),
_.each(seats, function (columnSeats, rowIndex) {
_.each(columnSeats, function (seat, columnIndex) {
if ($.inArray(seat.x, rowSeatValues) === -1) {
rowSeatValues.push(seat.y);
}
if ($.inArray(seat.y, columnSeatValues) === -1) {
columnSeatValues.push(seat.y);
}
});
});
var seatLayOutMax= new Array();
var count = 0;
_.each(rowSeatValues, function (row, columnIndex) {
seatLayOutMax[row] = new Array();
_.each(columnSeatValues, function (seat, columnIndex) {
seatLayOutMax[row][seat] = "";
});
});
_.each(seats, function (columnSeats, rowIndex) {
_.each(columnSeats, function (seat, columnIndex) {
seatLayOutMax[seat.x][seat.y] = seat
});
});
var pathComparision = 0; var enterInRowsCount = 0;
_.each(seatLayOutMax, function (seats, index) {
busLayoutHtmlTmpl += '<tr>';
_.each(seats, function (col, ind) {
var seat = col;
if (seat == undefined) { return; }
pathComparision = seat.x;
if (seat != "") {
var l = seat.height;
var w = seat.width;
if (l == 1 && w == 1) {
busLayoutHtmlTmpl += '<td title="Seat : ' + seat.id + 'style="width:8%; padding:2px;"><div id="div' + seat.seat_no + "_" + '</div></td>';
} else if (l == 1 && w == 2) {
busLayoutHtmlTmpl += '<td title="Seat : ' + seat.id + 'style="width:8%; padding:2px;"><div id="div' + seat.seat_no + "_" + ' </div></td>';
} else if (l == 2 && w == 1) {
if (rowSeatValues.height == 1) {
busLayoutHtmlTmpl += '<td title="Seat : ' + seat.id + 'style="width:8%; padding:2px;" rowspan="2"><div id="div' + seat.seat_no + "_" + '</div></td>';
} else {
busLayoutHtmlTmpl += '<td title="Seat : ' + seat.id + 'style="width:8%; padding:2px;"><div id="div' + seat.seat_no + "_" + '</div></td>';
}
}
} else {
busLayoutHtmlTmpl += '<td></td>';
}
});
if (seats === undefined && busLayoutHtmlTmpl != "<tr>" && !busLayoutHtmlTmpl.includes('<tr><td><div style="width: 28px; height: 24px; margin-right: 5px;"></div></td><td></td></tr>')) {
busLayoutHtmlTmpl.replace('<tr></tr>', '');
busLayoutHtmlTmpl += '<tr><td><div style="width: 28px; height: 24px; margin-right: 5px;"></div></td><td></td></tr>';
} else {
busLayoutHtmlTmpl += '</tr>';
}
});
return busLayoutHtmlTmpl;
}
function SeatLayout() {
$.ajax({
url: "seats.json",
dataType: "text",
success: function(data) {
var json = $.parseJSON(data);
designCanvas(json);
}
});
}
function designCanvas(json) {
var seatSelected = [];
var divLower = document.getElementById('tblLowerSeat');
var divUpper = document.getElementById('tblUpperSeat');
var lowerSeats = [];
var upperSeats = [];
if(json.seats.z === 0){
lowerSeats.push(json.seats);
}
if(json.seats.z === 1){
upperSeats.push(json.seats);
}
lowerSeats = lowerSeats.sort(function (a, b) { return b.id - a.id; });
upperSeats = upperSeats.sort(function (a, b) { return b.id - a.id; });
var r = [];
lowerSeats.forEach(function (e) {
if (r.indexOf(e.x) == -1) { r.push(e.x); }
});
var g = new Array(r.length);
for (var i = 0; i < r.length; i++) {
g[i] = new Array();
for (var j = 0; j < lowerSeats.length; j++) {
if (lowerSeats[j].x == r[i]) {
g[i].push(lowerSeats[j]);
}
}
}
htmlLower = generateLayout(g, 0);
divLower.innerHTML = htmlLower;
}
<button class="btn btn-primary" id="btnViewSeat" onclick="SeatLayout();">
View Seats class="fa fa-arrow-circle-down">
</button>
<p id="demo"></p>
<link href="/TPT-2020/Assets/css/seatStyle.css" rel="stylesheet" />
<link href="https://www.jqueryscript.net/css/jquerysctipttop.css" rel="stylesheet" type="text/css">
<link href="/TPT-2020/Assets/css/bootstrap.min.css" rel="stylesheet" />
<div id="Viewseatcollapse" class="collapse busseatmng" style="display:inherit">
<div class="col-sm-12 card">
<div class="card-body">
<div class="row">
<div class="col-sm-8">
<div class="upperbusdivwrp" id="divSeatsUpper">
<div class="row busseatstructure">
<div class="col-sm-12 bg-dark pd-10 text-white text-center"><h5>Upper Deck</h5></div>
<div class="col-sm-12 busseatsinner">
<div class="row">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-1 col-1 driver"></div>
<div class="col-sm-11 col-11">
<table id="tblUpperSeat">
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="lowerbusdivwrp">
<div class="row busseatstructure">
<div class="col-sm-12 bg-dark pd-10 text-white text-center"><h5>Lower Deck</h5></div>
<div class="col-sm-12 busseatsinner">
<div class="row">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-1 col-1 driver"><img src="/TPT-2020/images/stairing.png"></div>
<div class="col-sm-11 col-11">
<table id="tblLowerSeat">
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="/TPT-2020/scripts/BindData1.js"></script>
<script type="text/javascript" src="/TPT-2020/scripts/GetDynamicSeats2.js"></script>
|
|
|
|
|
You seem to have forgotten to ask a question or describe a problem.
Just dumping all of your code and telling us "there is some problem", without providing any details of what that problem is, doesn't make a good question.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have a global Array.
And there are multiple asynchronous events getting fired from different ends in the code.
In one of the events - Event1(), I'm iterating all the items in the global Array and using the values.
In another event Event2(), I'm removing a particular item from the global Array.
We have no guarantee about the timing or sequence of the event triggers.
Will this ever land in a crash? & How do we safeguard this.
modified 11-Feb-20 5:43am.
|
|
|
|
|
Unless you're using web workers[^], Javascript is single-threaded. Callbacks from async operations will be queued and executed on a single thread, so you don't need to worry about synchronizing access to your global state.
Even with web workers, it's hard to cause problems:
However, since web workers have carefully controlled communication points with other threads, it's actually very hard to cause concurrency problems. There's no access to non-threadsafe components or the DOM. And you have to pass specific data in and out of a thread through serialized objects. So you have to work really hard to cause problems in your code.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Great answer. Happy to know about the Web Worker.
I was thinking if there happens a context-switch between the Async, altering the count of the Array by deleting an element, & thus making the iteration in another code block go out of scope with the index.
I see this is never possible. Thanks to the single-threaded design. :+1:
modified 11-Feb-20 7:32am.
|
|
|
|
|
ugent help please! here my criteria is to drag 3 images and drop them in 3 different locations. validate before dropping in the location if it already has an image, if yes them pop up a message.
Quick response will be highly appreciated. Thanks!
|
|
|
|
|
You need to provide much more detail of your problem.
|
|
|
|
|
here my criteria is to drag 3 images and drop them in 3 different locations. validate before dropping in the location if it already has an image, if yes them pop up an error message.
Basically how do I capture drop location ID where the image is dropped?
Can someone please help me out urgenlty on this?
|
|
|
|
|