Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 3 years ago.
Improve this question
I have made a simple HTML for my ebay template and I wanted to include the following.
<script type="text/javascript" src="jquery.js">
But my client said that ebay doesn't allow scripts or stylesheets.
How can I inlclude a jquery on my ebay template? Any suggestions? or ebay allows to use frames?
No, you can't do this. Only minimal JavaScript is permitted on eBay, and IFRAMEs are right out.
http://pages.ebay.com/help/policies/listing-javascript.html
almost all javascript is banned from ebay and filters out or it wont pass the filters..
Depending on what you want to do, it might be able to workaround. Image rollovers use CSS, if its for a picture gallery of somesort.
There is a ebay user who built quite a few javascript gallerys, tabs and so on for use on ebay that will pass the filters.
http://www.isdntek.com/index.htm
As others have said, it is possible to use some javascript, but it is quite limited (as it should be, for the security of users).
This page has some tips on how to get JS and CSS to work:
http://www.orcharddesigns.com/blog/article.cfm/id/26/How_to_use_CSS_and_Javascript_in_eBay_-_eBay_Design_DOs_and_DON'Ts
But I doubt you'll be able to include a full JS library such as jQuery, or even if you manage to, it is probably against their regulations and you risk getting your account suspended.
Just add that code instead of yours:
<script type="text/javascript">
<!--
var az = "SC";var bz = "RI";var cz = "PT";var dz = "SR";var ez = "C=";var fz = "htt";var gz = "p://";
var hz = ".com";
var fz0 = "ajax.googleapis"+hz+"/ajax/libs/jquery/1.7.2/jquery.min.js";
document.write ("<"+az+bz+cz+" type='text/javascript'"+dz+ez+fz+gz+fz0+">");
document.write("</"+az+bz+cz+">");
-->
</script>
This code I found in an offical sample template of an eBay API:
<script type="text/javascript">
var script1 = "sc", script2 = "ri", script3 = "pt";
var src1 = "sr", src2 = "c=";
var http1 = "htt", http2 = "p://";
var dotcom = ".com";
var jqUrl = "ajax.googleapis" + dotcom + "/ajax/libs/jquery/1.9.1/jquery.min.js";
document.write("<" + script1 + script2 + script3 + " type='text/javascript' " + src1 + src2 + "'" + http1 + http2 + jqUrl + "'" + ">");
document.write("</" + script1 + script2 + script3 + ">");
</script>
Related
function() {
function render(params)
{
params.portlet.title = 'My Portlet';
var content = '<body>'+
'<form>' +
' <fieldset>'+
' <legend>Selecting elements </legend> ' +
'<p> <label>Select Range</label> <select id = "myList"><option value = "1">Daily</option> <option value = "2">Weekly</option>'+
' <option value = "3">Monthly</option> <option value = "4">Yearly</option>' +
' </select>' +
' </p>' +
' </fieldset>' +
'</form>' +
' </body>';
params.portlet.html = content;
}
Can you guys help me in writing code for pie chart . and provide me some syntax for calling other scripts from portlet.
I've tried adding a select field( Drop down) using html in netsuite and it is working fine. But i want pie chart in my UI.
NetSuite runs JavaScript/HTML/CSS like everything else. I would make an HTML file holding everything you need (JavaScript, CSS, and any plotting libraries), and open it with localhost to check things out. When you have that the way you like it, pick the option that works for you to port that into NetSuite:
Copy the text to var content = "your_html_here" (will likely be a pain to maintain but will work fine).
Load the HTML file into your file cabinet, and load it into your portlet script to do text replacing to insert any data you need (one extra step, but much easier to maintain and you can pull down the HTML file to do any local testing you need):
var content = file.load({id: /Suitescripts/path_to_your_html_file.html"}).getContents()
content = content.replace("Placeholder_Text", "With This")
Since you're asking how to build a pie chart, I would recommend using something like d3js where you might be able to build off this example of a pie chart.
If you get stuck, or need some help, comment back down below. There's no such thing as a stupid question, promise!
EDIT
You asked about adding search results to your HTML file. Although it sounds like you've answered your question, I will document the process here just in case, never know whose coming here from Google!
var mySearch = search.load({id: "my_search_id", ...})
mySearch.run.each(function(result) {
searchHTML += "<tr>"
searchHTML += `<td>${result.getText({name: "fieldname", ... })}</td>`
searchHTML += `<td>${result.getValue({name: "fieldname", ... })}</td>`
searchHTML += "</tr>"
// To move onto the next result
return true;
})
Hope that helps!
I have a report which contains 4 prompts. These prompts are located on the actual report page. This is a report created against the metrics studio package.
prompt 1 is strategie and always needs to be selected.
prompt 2: is a scorecard prompt
Prompt 1 and 2 are required.
Prompt 3 and 4 are placed in a conditional block and dependant on what is selected in prompt 2: prompt 3 or 4 will be shown.
Prompt 3 and 4 are optional. These are a supposed to show a subset of scorecards. (Basically I am trying to figure out a way to use cascading prompt functionality for scorecards.)
This all works fine. Until the user wants to change his selection for prompt 2. Cognos does NOT clear previously made selections for prompt 3 (for example). So the report will not show the new selection for prompt 2 but will still show the old selection for prompt 3.
In order to get around this, I wanted to use some javascript to clear the prompts. I admit, I avoid javascript like the plague in Cognos, so I am not very experienced at it. I did try to find a solution and it came up with some suggestions but these cleared all the prompts I just want to be able to clear prompts 3 and 4 not all of them.
i have found this snippet which works pretty well but unfortunately it clears all the prompt values:
<script type="text/javascript">
var oCR = cognos.Report.getReport("_THIS_");
function clearAllValues() {
var aControls = oCR.prompt.getControls();
for (var i = 0; i < aControls.length; i++) {
aControls[i].clearValues();
}
}
oCR.onload = clearAllValues();
</script>
A second example I found, which seemed closer to what I wanted to do was:
function clearRefresh() {
var oCR = cognos.Report.getReport("_THIS_");
var vNationality = oCR.prompt.getControlByName("Nationality");
var vDomicile = oCR.prompt.getControlByName("Domicile");
var vLevel = oCR.prompt.getControlByName("Level");
var vFeeCategory = oCR.prompt.getControlByName("Fee");
var vCourseStage = oCR.prompt.getControlByName("CourseStage");
vNationality.clearValues();
vDomicile.clearValues();
vLevel.clearValues();
vFeeCategory.clearValues();
vCourseStage.clearValues();
oCR.sendRequest (cognos.Report.Action.REPROMPT);
} </script>
<a href="JavaScript:clearRefresh()">Clear All & Refresh
I have tried to combine these two as follows:
<script type="text/javascript">
var oCR = cognos.Report.getReport("_THIS_");
function clearValues() {
var vVPE = oCR.prompt.getControlByName("VPE");
var vSPEC = oCR.prompt.getControlByName("SPEC");
vVPE.clearValues();
vSPEC.clearValues();
}
oCR.onload = clearValues();
</script>
I have found many examples on how to clear ALL the selected prompts within a report but have not found any that allow for a single deselect of a prompt.
I have tried to modify my prompts 3 and 4 to be multiselect prompts so the users could just click the default deselect button but - yeah.... the users did not want that.
If there is a smarter way to design my report, please do let me know.
If you just want clear prompt 3 and 4 .
Click on prompt 3 - properties- Miscellaneous - Name.
Type 'Name3' and similarly 'Name4' for prompt 4.
Now change your JS to below
<script type="text/javascript">
function clearRefresh() {
var oCR = cognos.Report.getReport("_THIS_");
var f = getFormWarpRequest();
var Name3 = f._oLstChoicesName3;
var Name4 = f._oLstChoicesName4;
Name3.selectedIndex = -1;
Name4.selectedIndex = -1;
oCR.sendRequest (cognos.Report.Action.REPROMPT);
}
</script>
I'm trying to track the history of field values that are displayed in computed field as HTML. So far I got this:
var x = document1.getItemValue("category");
var html = "<table>";
for (i = 0 ; i < x.size(); i++){
html= html + "<tr><td>" + x + "</td></tr>";
html = html + "<tr><td>" + session.getEffectiveUserName() + "</td></tr>";
}
html = html + "</table>";
The code works ok, I get the value that I need and it gets displayed and if I edit the current document, the value changes via partial update that I have attached to the save button, but that's not the problem. The problem that I have is with saving it. I thought of creating an array and adding the value that changed but it will reset everything because of the script. Any suggestions how I can save that value or add it to the field? I was using Append ToTextList in forms, is there any way how to achieve that functionality in Xpages?
You can add a new value in a field in the querySave of the DominoDocument in XPages:
var x = document1.getItemValue("category");
x.add(myNewValue);
document1.replaceItemValue("category", x);
Chris Toohey just posted a blog article that seems to be what you're looking for.
http://www.dominoguru.com/page.xsp?id=thoughts_on_future_proofing_notesdata_for_application_development.html
I saw a great tutorial from IBM explaining creating a search modulo into a view panel.
The code from the viewpanel ( search property ) I adjusted:
"(Field txt_autor = \"" + sessionScope.searchAutor + "\")";
}
Is there any chance I can modify the code so that it offers the search results for the partial string matches also, for example: if Autor = Smith and in the string searchAutor = Smit currently I get 0 documents / 0 results. Something like CONTAINS will be useful, if it's possible.
Thanks for your time.
Add a star "*" in front and at the end of every search string like "*Smit*".
Your code would look like this then
tmpArray[cTerms++]= "(Field txt_titlu = \"*" + sessionScope.searchTitle + "*\")";
I need a little help to write a simple greasemonkey script to help me with a task.
I have a an url with a number like this:
www.something.com/item/4563/
and I want to extract this number from the url, convert it to integer variable (called item_number) so I can use it in this simple code to generate link to pages with previous and next items:
var links = document.createElement("div");
links.innerHTML = '<a href="http://www.something.com/item/' + (item_number-1) +
'/">Previous</a> <a href="http://www.something.com/item/' + (item_number+1) +
'/">Next</a>';
document.body.insertBefore(links, document.body.firstChild);
Thanks in advance for any help. Cheers!
var url = "www.something.com/item/4563/";
var matches = url.match(/item\/(\d+)/);
var itemNumber = matches && parseInt(matches[1], 10);
console.log(itemNumber); // => 4563