ExtJS Items still appearing despite code being removed - javascript

I'm having an issue where I have deleted code that called an ajax request & displayed a message box in a grid but it is still showing in the browser.
Someone else tried it and it's showing the change for them.
I am using Eclipse & cleaned, rebuilt, removed/readded & restarted my project. I have also cleared all cache/browser hsitory from my browser & tried removing & readding the file to project. None of which have resolved the issue.
The function is being called from an image hyperlink which is being displayed in the grid. That code has not changed, only the underlying function.
This is the actual code in the file:
function getReport(type, date){
alert(type);
alert(date);
}
This is the code shown in Firebug:
function getReport(type, date){
alert(type);
alert(date);
Ext.Ajax.request({
url: 'cxf/rest/ws/getX',
method: 'POST',
timeout:180000,
params: {Type: type, Date: date},
success: function(){
var grid = Ext.getCmp('oGrid');
grid.getStore().reload();
},
failure: function(){
alert('Unable to retrieve the report. Please contact the System Administrator');
}
});
}
Any ideas why this is happening? I have the same setup as the other person who tried it & this is the first time any JS changes have not appeared.

Did you clear your cache? Is there a proxy cache in play?
Open up firebug and see where the code is on the js files. Add break points and see what is called. Track down the problem.
Use fiddler to see the http requests if needed.

In Firebug, open the Firebug menu (top left, picture of a fiery bug) and select "Deactivate Firebug for this site". This is different in some special way from just closing Firebug, which I see you've already done.

Related

Issue with adobe_dc_view_sdk pdf file preview

I am testing the adobe document cloud view sdk on https://www.thacherandrye.com/dinner , https://www.thacherandrye.com/the-shed , https://www.thacherandrye.com/brunch
Sometimes, the file preview is not working and all I can get on the screen is a large white space(No errors in the console). Whenever I load the page for the first time, in a browser or incognito window, the file appears on the preview but after reloading or moving to another page with a preview, the file seems to disappear.
I checked for the key being wrong/expired but then it should not have loaded the file even for the first time.
Below is the Javascript code I am using for the api:
$(document).ready(function() {
document.addEventListener("adobe_dc_view_sdk.ready", function(){
var adobeDCView = new AdobeDC.View({ clientId: SOME_KEY, divId: $('#adobeDcViewId{Id}').val() });
adobeDCView.previewFile({
content: { location: { url: $('#hdnUrl{Id}').val() } },
metaData: { fileName: $('#hdnFileName{Id}').val() }
},
{
showDownloadPDF: $('#hdnRestrictDownload{Id}').val() !== 'true',
showPrintPDF: $('#hdnRestrictDownload{Id}').val() !== 'true'
});
});
});
Tech stack: .net framework 4.7.2, jQuery 3.6.0
I tried to help you on our forums, but I don't know if you saw my response. This line worries me:
$('#adobeDcViewId{Id}').val()
The value that needs to be passed to divId needs to be a string, and needs to match the ID of the div element. Also, #adobeDcViewId{Id} doesn't look like a valid CSS selector to me.
Can you try changing this to a hard-coded value of the div on your site?

How can an image be saved with JavaScript for Automator (JXA) in macOS Preview application?

There is an image open in the Preview application, and it is unsaved.
I have tried this code, by building and running a standalone script in Script Editor:
var preview = Application('Preview')
var preview.documents[0].close({ saving: true, savingIn: '/Volumes/USB Drive/Untitled-Image.png' })
I see this in the logs
app = Application("Preview")
app.documents.at(0).Symbol.toPrimitive()
--> Error -1700: Can't convert types.
app.documents.at(0).Symbol.toPrimitive()
--> Error -1700: Can't convert types.
However, I'm not sure I'm reading the docs correctly, and I'm not sure how to further debug this code. A satisfactory alternative here would be to send a keystroke to save and click the Save button.
What can I do to persist the image in Preview to a file?
One can declare paths speculatively in JavaScript using Path('...'), and then use the save command to save the image to the file that will be created at that path:
Preview = Application('com.apple.Preview');
ImageFilepath = Path('/Users/CK/Pictures/Preview_SavedImage.jpg');
Preview.documents[0].save({ in: ImageFilepath });
This code worked for me.
var preview = Application('Preview')
var photo = preview.documents[0]
photo.close({ saving: 'yes', savingIn: Path("/Path/To Some/file_name.png") })
Upon execution, in the Replies log of Script Editor window, something slightly different from the question sample is logged.
app = Application("Preview")
app.close(app.documents.at(0), {savingIn:Path("/Path/To Some/file_name.png"), saving:"yes"})
I was able to figure this out by studying the scripting dictionary for macOS Mojave 10.14 as well as the Release Notes for JXA; there is a similar example under Passing Event Modifiers section of that.
From the Script Editor scripting dictionaries, this is the entry for the close method in the Standard Suite:
close method : Close a document.
close specifier : the document(s) or window(s) to close.
[saving: "yes"/‌"no"/‌"ask"] : Should changes be saved before closing?
[savingIn: File] : The file in which to save the document, if so.
Note the key differences between the working code here and the code in the question:
Specify a Path object when passing the savingIn option to close.
Specify a the saving option as one of "yes", "no", or "ask" (not true).
If you're new to JXA, Automator, and/or Script Editor for Mac, checkout the JXA Cookbook.
If this answer helps you, you're probably having a bad time, so best of luck!

Forced to use define('CONCATENATE_SCRIPTS', false); all of a sudden

I came into work on Monday with an email stating the visual editor on one of the Wordpress sites we manage/maintain wasn't working.
Sure enough, I was able to replicate the issue and found there were a ton of Javascript errors in the console.
I searched the first error and found several posts on Wordpress's forum that people needed to add the following to their wp-config.php file to fix the issue.
define('CONCATENATE_SCRIPTS', false );
However, nowhere on the entire internet is there an explanation as to why this all of a sudden needs to be added.
Because of that, I started to dig into the problem to see if I could find out what the heck is going on.
I clicked around the Wordpress admin area and noticed the issue was always coming back with this line of code.
Uncaught SyntaxError: missing ) after argument list
load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,underscore,thickbox,shortcode,media-up…:227
Line 227 of
https://DOMAIN_NAME/wp-admin/load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,underscore,thickbox,shortcode,media-upload&ver=4.3.1
is as follows
if(!params['modal']){jQuery(document).bind('keydown.thickbox',function(e){if(e.which==27){tb_remove();return false;}});}}catch(e){}}
This happens when I am on the following pages within the Wordpress admin area.
// Dashboard
/wp-admin/index.php
// Plugins page
/wp-admin/plugins.php
// Edit user page
/wp-admin/user-edit.php?user_id=###
// Edit post page
/wp-admin/post.php?post=###&action=edit
On each of those pages, the load-script.php source is different, so I am providing that info below.
// Dashboard
/wp-admin/index.php
https://DOMAIN_NAME/wp-admin/load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,underscore,thickbox,shortcode,media-upload&ver=4.3.1
// Plugins page
/wp-admin/plugins.php
https://DOMAIN_NAME/wp-admin/load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,underscore,wp-util,wp-a11y,updates,thickbox,shortcode,media-upload&ver=4.3.1
// Edit user page
/wp-admin/user-edit.php?user_id=###
https://DOMAIN_NAME/wp-admin/load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,zxcvbn-async,underscore,thickbox,shortcode,media-upload&ver=4.3.1
// Edit post page
/wp-admin/post.php?post=###&action=edit
https://DOMAIN_NAME/wp-admin/load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,underscore,thickbox,shortcod&load%5B%5D=e,plupload,jquery-ui-position,jquery-ui-datepicker,jquery-ui-menu,jquery-ui-autocomplete,jquery-ui-resizable,jquery-ui-draggable&load%5B%5D=,jquery-ui-button,jquery-ui-dialog,media-upload&ver=4.3.1
I then got to a page in the admin area where the Javascript error DID NOT present itself!
// The page that lists all of the pages on the site
/wp-admin/edit.php?post_type=page
On this page, the load-script.php source is as follows
// The page that lists all of the pages on the site
/wp-admin/edit.php?post_type=page
https://DOMAIN_NAME/wp-admin/load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,thickbox,underscore,shortcode,media-upload&ver=4.3.1
I then went to that file directly is a browser and searched specifically for the following string since that is the string that all of the other pages were throwing an error on.
if(!params['modal']){jQuery(document).bind('keydown.thickbox',function(e){if(e.which==27){tb_remove();return false;}});}}catch(e){}}
To my surprise, that line of code IS NOT minified, whereas, the code IS minified in all of the other instances when the Javascript error occurs.
if(!params['modal']){
jQuery(document).bind('keydown.thickbox', function(e){
if ( e.which == 27 ){ // close
tb_remove();
return false;
}
});
}
} catch(e) {
//nothing here
}
}
Nothing on the server was changed/updated nor was Wordpress, the theme, or plugins updated.
I also went as far as disabling ALL plugins along with activated the default Twenty Fifteen theme, but the issue still exists.
There are even Wordpress sites on THE SAME server as this site that is having problems, and those other sites DO NOT have this problem.
At the end of that day, I don't really know if the detailed information I provided above helps anyone help me figure out what the heck is going on and why define('CONCATENATE_SCRIPTS', false ); all of a sudden needs to be added to the wp-config.php file to make the Javascript errors go away so the visual editor works again.
If anything, this is the most details I have seen anyone provide in regards to those that have needed to add define('CONCATENATE_SCRIPTS', false ); to their wp-config.php file to get the errors to go away.
You have a syntax error in the JS code:
It is not clear what this code is trying to achieve but there is clear syntax error:
Try changing:
if(!params['modal']){
jQuery(document).bind('keydown.thickbox', function(e){
if ( e.which == 27 ){ // close
tb_remove();
return false;
}
});
}
} catch(e) {
//nothing here
}
}
To:
if(!params['modal']){
jQuery(document).bind('keydown.thickbox', function(e){
if ( e.which == 27 ){ // close
tb_remove();
return false;
}
});
}
Looks like this code loaded from the file registered as "shortcode"
Also you can try using wp_dequeue_script function to remove conflicting scripts or move them up and down the queue
wp_dequeue_script("shortcode");
wp_enqueue_script("shortcode","script_url",array('jquery','lastScript'));

jQuery File Uploader IE9 Not posting any params on Upload

I'm using the jQuery file uploader plugin along with rails 3. Plugin here:
https://github.com/blueimp/jQuery-File-Upload
I'm using the plugin to allow a user to upload a profile photo. The solution so far works with Chrome, Safari and Firefox. However on IE it fails. When you select a file in IE, the plugin posts to the server but there are no params, it's an empty post.
Example post in chrome:
Started PUT "/api/1/settings/ajax_photo_upload" for 10.0.1.3 at 2012-10-02 15:39:20 -0700
Processing by ApiV1::SettingsController#ajax_photo_upload as JS
Parameters: {"photo"=>#<ActionDispatch::Http::UploadedFile:0x007f9e4bac2e48 #original_filename="xxxxx.jpeg", #content_type="image/jpeg", #headers="Content-Disposition: form-data; name=\"user[photo]\"; filename=\"xxxxx.jpeg\"\r\nContent-Type: image/jpeg\r\n", #tempfile=#<File:/var/folders/3x/k1yb0r4s07q1jm82kq93ch180000gn/T/RackMultipart20121002-3633-sxsbtu>>}, "update_type"=>"general"}
However in IE9, it doesn't send over anything:
Started PUT "/api/1/settings/ajax_photo_upload" for 10.0.1.10 at 2012-10-02 15:39:31 -0700
Processing by ApiV1::SettingsController#ajax_photo_upload as JS
Here is my implementation:
$('input[type="file"]').fileupload({
url : '/api/1/settings/ajax_photo_upload',
formData : [{
name : 'authenticity_token',
value : $('meta[name="csrf-token"]').attr('content')
}],
type : 'PUT',
dataType: 'json',
add : function (e, data) {
data.submit();
}
});
html
<input name="user[photo]" type="file" accept="image/*" >
Any ideas why IE would be doing this? Thanks
Are you using the basic plugin? I was and I had the same issue and battled with it for a day only to realize I hadn't included the jquery.iframe-transport.js plugin:
<script src="js/jquery.iframe-transport.js"></script>
See documentation here.
Oh! and thanks for your snippet about including the 'authenticity_token' key-value pair as 'formData' - that helped me get rid of the rails 3 warning "WARNING: Can't verify CSRF token authenticity"
It is basically about the support of html 5's data tags. IE9 has serious problems with it. For example, when you upload an image, in chrome it sents data:blob and gives you the preview before you upload the image actually. In IE, you can't. Check Gmail's mail attachment screen in IE9 you will see the difference. If it is a large scale project, I advise you to use flash as image uploader.
$("#txt1").fileupload({
replaceFileInput: false,
dataType: "json",
datatype:"json",
url: "<%=Page.ResolveUrl("~/WebService/AddAttachment.ashx")%>",
done: function (e, data) {
$.each(data.result, function (index, value) {
//You get the response data in here from your web service
})
$("#txt1").val("");
}`enter code here`
});
This is tested and working fine in both IE8 and IE9 + above. Please make sure to use the correct dataType:"json" (or datatype:"json") and also make sure your response of web service method is correctly updated to data.result when you debug and check.
Thanks

Qooxdoo AJAX help - events not working?

I'm trying to make an AJAX call to CouchDB with Qooxdoo, but as far as I can tell no events seem to be firing on my request object (ie. Nothing is appearing on the console and no alerts are coming up). Can anyone tell me what should be happening/what I'm doing wrong?
(This is all in the 'main' method of my class)
var req = new qx.io.remote.Request('http://localhost:5984/japanese/words', 'GET', 'application/json').set({crossDomain:true,timeout:0});
this.debug("Testing");
req.addListener("created", function(e) {
this.debug("Created");
alert(e.getContent());
}, this);
req.addListener("sending", function(e) {
this.debug("Configured");
alert(e.getContent());
}, this);
...
(This is just a sample - I've added a similar listener for all the events I can think of but nothing is coming up on the console)
My server is running Ubuntu 10.10 with Qooxdoo 1.3.
Edit:
Now trying to request "http://localhost/languages/test.php" (my app is at "http://localhost/languages/index.html") and still no alerts are appearing except for the test one I put outside of any event. My request is now: new qx.io.remote.Request('http://localhost/languages/test.php', 'GET', 'application/json'); The PHP file is returning valid JSON when I access it in my browser. Surely this should work?
Cross-domain requests in qooxdoo use a script transport which doesn't fire events. Instead, your server needs to wrap the response data in a call to a static method. See the package documentation of qx.io.remote for details:
http://demo.qooxdoo.org/current/apiviewer/#qx.io.remote

Categories