Comments (9)
It can be done. Although, there are different ways how it can be implemented. I will think about it.
from djvujs.
I haven't seen it in action, but as I remember (from translation strings) there is a message "what you would like to do with this multipart document: save this part or pack all parts and save a whole document.
Maybe like this?
from djvujs.
Yes. But I meant a different thing. I could just accept a callback, returning true
/false
, in which you could just use a standard confirm()
function. Or to accept a text, which is shown in a dialog inside the viewer. Probably, the latter variant.
from djvujs.
I was thinking more about a data-driven stuff like this:
undefined = default (as it is now);
string = the message to display with OK button;
2 strings array: the message to display + text in the button ("Yes, I agree").
Your idea about callback function returning true/false is maybe OK, but I don't fully understand how it will fit here.
Maybe you can give an example of callback function that will work fine for my initial feature request?
from djvujs.
The example of such a function:
function confirmation() {
return confirm("Doing this you agree with that");
}
Of course, in a more general case it should return a Promise
resolving to true
or false
in order to allow you to use something else besides the confirm()
blocking function.
The idea to use a callback came to me with a desire not to create additional visual component and do as little as possible.
However, I know that without confirm()
creation of custom window will be a hassle for you, much greater than to add such a feature using existing viewer components for me.
from djvujs.
Maybe:
function confirmation(confirm) {
return confirm("Doing this you agree with that");
}
from djvujs.
Or more sophisticated:
function confirmation(confirm) {
return confirm(
/*message*/"Doing this you agree with that",
{
"ok" : "Yes, I agree",
"cancel": "No, I disagree",
"default" : "ok"
});
}
from djvujs.
Do you know that confirm()
is a browser built-in function? You can run confirm('Hello!')
in the console right now.
In the latest release (viewer 0.5.6), I added a new UI option for you:
uiOptions: {
onSaveNotification: {
text: "Here is your notification/agreement for the user",
yesButton: "Text on the yes button", // optional
noButton: "Text on the no button", // optional
},
}
It's also described in the documentation on the website.
from djvujs.
If you see browser's confirm you'll feel like today is year 1999.
from djvujs.
Related Issues (20)
- Dynamic zoom HOT 1
- Standard error message for common HTTP response error codes HOT 11
- Wrong size of the "hidden text" words HOT 8
- Wrong tooltip for previous/next buttons in DjVu.s Viewer HOT 4
- Feature request: hide Contents via configure/constructor HOT 1
- Mousepad scroll fires page change HOT 3
- Disable "Print" button via config switch HOT 2
- Print function doesn't work with Safari HOT 2
- About Djvu picture size is 2-3M can't preview in Firefox browser HOT 10
- В firefox не работает djvu.js версии выше 0.3.5 HOT 7
- Odd/Even page spreads HOT 11
- Browsing local files HOT 1
- Check if filetype/link is openable HOT 2
- Установка из npm HOT 13
- Tailwind preflight HOT 5
- Открытие документа сразу в полностраничном режиме
- Error with loadDocumentByUrl HOT 6
- I can't install the DjVu Extension for Chrome from the Chrome Web Store HOT 4
- [Extension] Embed file path into URL for reloading HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from djvujs.