Dokumentų peržiūra online
Šaunu būtų kokias skaidres ar dokumentus (.doc, .pdf) peržiūrėti online. Beje, paveiksliukus (pvz skenuoti konspektai), jau galima?
7 comments
-
tahu
commented
Veikianti, hakeriškesnė geresnė versija:
<script>
var files, i, preview, attach;
files = document.querySelectorAll('.title a');
if(files.length === 0) {
files = document.querySelectorAll('a.filename');
}
preview = function(url, inNewWindow) {
var fakeForm;
if(inNewWindow) {
fakeForm = window.document.createElement('form');
fakeForm.action = url;
fakeForm.method = 'GET';
fakeForm.target = '_blank';
fakeForm.submit();
} else {
window.location.href = url;
}
};
attach = function(anchor) {
anchor.addEventListener('click', function(event) {
if(event.shiftKey) {
preview(anchor.href + '/TODO_indicator_to_open_in_preview', event.ctrlKey);
event.preventDefault();
return false;
}
}, false);
};
for(i = 0; files[i]; i += 1) {
attach(files[i]);
}
</script>Bookmarkletas:
javascript:(function(){var files,i,preview,attach;files=document.querySelectorAll('.title a');if(files.length===0){files=document.querySelectorAll('a.filename');}preview=function(url,inNewWindow){var fakeForm;if(inNewWindow){fakeForm=window.document.createElement('form');fakeForm.action=url;fakeForm.method='GET';fakeForm.target='_blank';fakeForm.submit();}else{window.location.href=url;}};attach=function(anchor){anchor.addEventListener('click',function(event){if(event.shiftKey){preview(anchor.href+'/TODO_indicator_to_open_in_preview',event.ctrlKey);event.preventDefault();return false;}},false);};for(i=0;files[i];i+=1){attach(files[i]);}})() -
tahu
commented
oh, bookmarklet'as neveikia, bet kodas, veikia (pastinti į javascript console chrome, arba firebug firefox)
-
tahu
commented
Jau aiškiau :) bet vistiek yra būdas! Tiktų ir JavaScriptu tikrint ar shift'as nuspaustas. Jei taip - tai atidaryt kaip preview :)
Čia kodas saitui:
<script>var files, i, preview, attach;
files = $('.file-description .title a');
preview = function(url, inNewWindow) {
var fakeForm;
if(inNewWindow) {
fakeForm = window.document.createElement('form');
fakeForm.action = url;
fakeForm.method = 'GET';
fakeForm.target = '_blank';
fakeForm.submit();
} else {
window.location.href = url;
}
};
attach = function(anchor) {
$(anchor).click(function(event) {
if(event.shiftKey) {
preview(anchor.href + '/TODO_indicator_to_open_in_preview', event.ctrlKey);
event.preventDefault();
return false;
}
});
};
for(i = 0; files[i]; i += 1) {
attach(files[i]);
}</script>
Čia tas pats, tik bookmarklet'as (copy paste url bar):
javascript:(function(){var files,i,preview,attach;files=$('.file-description.title a');preview=function(url,inNewWindow){var fakeForm;if(inNewWindow){fakeForm=window.document.createElement('form');fakeForm.action=url;fakeForm.method='GET';fakeForm.target='_blank';fakeForm.submit();}else{window.location.href=url;}};attach=function(anchor){$(anchor).click(function(event){if(event.shiftKey){preview(anchor.href+'/TODO_indicator_to_open_in_preview',event.ctrlKey);event.preventDefault();return false;}});};for(i=0;files[i];i+=1){attach(files[i]);}})() -
Adminjaro
(Admin, Ututi)
commented
Mes specialiai padarėm, kad visi failai būtų atsisiunčiami (t.y. naršyklės preview yra ignoruojamas). Deja nemažai žmonių nervina, kai naršyklė pati bando atidaryti ir parodyti failą. Kai kas net nežino kaip tada tą failą atsisiųsti :/
On-line peržiūros norėtumėm, deja tai brangi funkcija, tai laukiam kai Ututi išpopuliarės ir turėsime pakankamai pajėgumų tai realizuoti ;)
-
tahu
commented
Please, paveikslėlius ir PDF neverskit downloadint. Daug žmonių naudojasi Google Chrome, kuris turi labai gerą integruotą PDF skaityklę. Taip pat ir kiti browseriai naudoja Adobe Reader pluginą.
Manau, kad tai yra labai svarbu.
-
Mantvydas Kasperavičius
commented
Aš irgi nemanau, kad tai būtina, nes dažnai tokios sistemos peržiūrint dokumentus online iškraipo dokumento formatavimą ar netgi pačia informaciją.
-
tautvis88
commented
Nemanau, kad tai labai yra būtina.