Vue.js with widget js file containing document.write - vue.js

I know how to load external js files to Vue.js or Nuxt.js but I have a specific problem with eg. french Shom Widget files.
Shom (for tides predictions) give access to a widget via a js file containing a lot of dirty document.write (you can see a sample at https://services.data.shom.fr/hdm/vignette/grande/CAP_FERRET?locale=fr)
var rid="vignette_shom_"+Math.round(Math.random()*10000000);
document.write("<iframe width='675' id='"+rid+"' height='900' frameborder='0' scrolling='no'></iframe>");var ifrm = document.getElementById(rid);ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document:ifrm.contentDocument;ifrm.document.open();
ifrm.document.write('<!DOCTYPE html>');ifrm.document.write('<html>');ifrm.document.write('<head>');
.. ans so on...
Trying to load this script into the mounted method is ok, but i'm unable to display content into component.
Any idea ?
thanks

Related

Nuxt.js ignore (Is there any way to ignore original tags)

I am creating a web page using Nuxt.js. (Static file built with the
nuxt generate command)
As a requirement,I need to write the original tag in the static file
that I built. The original tag is for displaying the data obtained
on the server side. Writing an original tag in a vue file naturally
gives an error.
For example, in the image below,
Is there a way to ignore original tags in the vue file?
vue file(example)
// disabled-next-line
{{^ server-side-display-data}}
<button> button </ button>
// disabled-next-line
{{/ server-side-display-data}}
Build file(example)
{{^ server-side-display-data}}
<button> button </ button>
{{/ server-side-display-data}}
Tried
It seemed possible to ignore certain "files" like below, but I haven't found a way to ignore certain "tags"
https://ja.nuxtjs.org/api/configuration-ignore/
Please help
I had the same issue and was looking for a solution... you can try with this solution i've used.
in your nuxt.config.js
...
vue: {
config: {
ignoredElements: [string or regexp],
},
},
...
see this documentation for more details

How to upload an image on Pentaho dashboard ? ( variable, condition, local path)

I want to display an image depending on parameter called "ca_code" on dashboard.
All the images are in a repository of my current theme ( I know that you can also upload images to server, must be easiler but I need to keep this), here's an example of an image path:
D:\pentaho\pentaho-8-2\pentaho-server\pentaho-solutions\system\common-ui\resources\themes\sapphire\img_project\CA120.jpg
Here, 120 is a ca_code. I get this ca_code as variable by query component.
Here's what I tried on Post Fetch of query component:
function f(ca_code) {
var ca_code=ca_code.resultset;
var img = '<img src="../common-ui/resources/themes/sapphire/img_project/CA'+ca_code.resultset+'.jpg/content"/>';
var img_default='<img src="../common-ui/resources/themes/sapphire/img_project/CA000.jpg/content"/>';
document.getElementById('ca_logo').innerHTML=img;
}
And it doesn't work, think it is the path prob.
When I used HTML on Layout Panel, the path was fine, the image was displayed but I can't do on HTML because I need variable ca_code, I want to do it on Query Component - Post Fetch.
And also, how to check if the image exists ? If it doesn't exist, I want to display img_default.
Any help would be nice !

Rendering salesforce lightning component into pdf (Generate PDF)

I am working on a lightning component and within the components layout I have to provide a button which can generate pdf of that lightning component . I found some blogs but still not sure about the actual solution for this . Please let me know if you guys have some sample implementation example for doing this .
Thanks !
If you want to save the entire window, you can just open the print window then save as PDF (if the business requirement allows):
print : function (component, event, helper) {
window.print();
}
If you want to print a portion of your lightning component, you might need to reconstruct the page to the pdf. Follow this:
var myWindow = window.open('','_blank', 'width=' + screen.availWidth + ',height=' + screen.avaliHeight);
myWindow.document.write('<html>HTML CODE HERE</html>');
myWindow.document.close();
myWindow.focus();
myWindow.print();

Page number in jsreport

Is it possible to display page number in jsreport?
I couldn't find this either on the homepage of the tool nor by googling.
Many thanks in advance!
I assume you ask for page numbers in a pdf report created by phantom-pdf recipe...
You can use special tags {#pageNum} and {#numPages} in template.phantom.header for this:
<div style='text-align:center'>{#pageNum}/{#numPages}</div>
Note you can use also javascript in header/footer to customize visibility or value of the page numbers.
<span id='pageNumber'>{#pageNum}</span>
<script>
var elem = document.getElementById('pageNumber');
if (parseInt(elem.innerHTML) <= 3) {
//hide page numbers for first 3 pages
elem.style.display = 'none';
}
</script>
Documentation here
UPDATE 2022:
jsreport now uses primarily chrome for generating pdf. You can now add page numbers using native headers or in complex cases using pdf utils
pdf utils based header playground example can be found here.

chronoforms v5 multi file upload...cannot choose multiple files

I am trying to configure this in v5 and cannot find any documentation. This is what I have so far...
followed the V4 documentation as close as possible, but cannot get the form to allow me to choose multiple files!
Under HTML Render I have Form Tag Attachment = enctype="multipart/form-data"
Under the designer tab I have file field element on the form. Under this I have
Field Name = file1[]
Field ID = file1
Multiple=Yes
Under the settings tab I have the files upload action in the on submit event. In the files upload action I have
Enabled=Yes
Files config = file1:jpg-png-gif-txt
Array fields = file1
is there anything else I need to do?
Turns out this is a bug and will be fixed in the next update. Workaround by creating a custom file upload element with the word multiple as a parameter.