Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ccbysa license option #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions _imgur.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ document.body.insertAdjacentHTML
( 'afterbegin',
`<a href="http://proinfrastructura.ro"><img id="api" src="http://proinfrastructura.ro/images/logos/api/logo_api_portrait_big.png" width="50" style="float:right"/></a>
Alege imaginile de incarcat la imgur: <input type="file" multiple id="filez">
<br>
<label><input type="checkbox" id="ccbysa" value="ccbysa">Sunt de acord cu folosirea fotografiilor mele pe Wikipedia (imaginile vor fi publicate sub licența <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Atribuire-Distribuire în Condiții identice 4.0</a>)</label>
<hr>
Optional, o descriere pt fiecare poza:
<hr>
Expand Down
27 changes: 20 additions & 7 deletions exif.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,35 @@ function loaded(){
var filez=document.getElementById("filez");
var photoz= document.getElementById("photoz");
var forumtext= document.getElementById("forumtext");
var license = document.getElementById("ccbysa");
var nfiles=0;
document.getElementById("cpy").disabled=true;
var ccbysa_license_text = "\nImagine publicată sub licența [URL=https://creativecommons.org/licenses/by-sa/4.0/]Creative Commons Atribuire-Distribuire în Condiții identice 4.0[/URL]"

license.onchange=function(e){
var license_text = "";
if (license.checked)
license_text += ccbysa_license_text;
var cpy_state = document.getElementById("cpy").disabled;
document.getElementById("cpy").disabled = true;
for(var x = 0; x < idx; x++) {
document.getElementById('orig1_'+x).innerHTML= license_text;
}
document.getElementById("cpy").disabled=cpy_state;
};

filez.onchange=function(e){
var license_text = "";
if (license.checked)
license_text += ccbysa_license_text;
nfiles+= filez.files.length;
document.getElementById("cpy").disabled=true;
for (var x = 0; x < filez.files.length; x++) {
//add to list
photoz.innerHTML+= '<table border=0 cellpadding=0><tr valign=top><td>'+filez.files[x].name+' </td><td><textarea lang="ro" spellcheck="true" rows=2 cols=80 oninput="description(event)" id="inp_'+idx+'"></textarea><td height="50"><span id="f_'+idx+'"></span></td></tr></table><hr>';
document.getElementById('f_'+idx).innerHTML= "<img id='searchimg' class='loadingimg' src='http://standup.csc.kth.se/maps/images/loading.gif'/>";

forumtext.innerHTML+='<span id="d_'+idx+'"></span><span id="geo_'+idx+'"></span>\n<span id="orig_'+idx+'"></span>[IMG]<span id="i_'+idx+'"></span>[/IMG]<span id="orig1_'+idx+'"></span>\n\n';
forumtext.innerHTML+='<span id="d_'+idx+'"></span><span id="geo_'+idx+'"></span>\n<span id="orig_'+idx+'"></span>[IMG]<span id="i_'+idx+'"></span>[/IMG]<span id="orig1_'+idx+'">'+license_text+'</span>\n\n';

(function(n, fidx){
var fr= new FileReader();
Expand Down Expand Up @@ -65,7 +82,6 @@ function loaded(){

//Send the proper header information along with the request
http.setRequestHeader("authorization", "Client-ID 59c68e102e4b4fc");

http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
var img=JSON.parse(http.responseText);
Expand All @@ -86,13 +102,11 @@ function loaded(){

var fd1 = new FormData();

fd1.append("description", JSON.stringify(exif));
fd1.append("description", license_text + "\n" + JSON.stringify(exif));
http1.open("POST", url1, true);

//Send the proper header information along with the request
http1.setRequestHeader("authorization", "Client-ID 59c68e102e4b4fc");
// http1.setRequestHeader("Cache-Control", "null");
// http1.setRequestHeader("X-Requested-With", "null");
http1.onreadystatechange = function() {//Call a function when the state changes.
if(http1.readyState==4){
nfiles--;
Expand All @@ -119,7 +133,7 @@ function loaded(){
{
document.getElementById('i_'+n).innerHTML= imgRoot+'h'+imgExt;
document.getElementById('orig_'+n).innerHTML= '[URL='+img.data.link+']';
document.getElementById('orig1_'+n).innerHTML= '[/URL]';
document.getElementById('orig1_'+n).innerHTML= '[/URL]' + license_text;
}

}
Expand All @@ -144,7 +158,6 @@ function loaded(){
// --header 'authorization: Client-ID 59c68e102e4b4fc'
}


const exifExample={
"Orientation":3,
"XResolution":72,
Expand Down