kishanjasani /
SociaManager
| 1 | $(window).on('load',function(){
|
||
| 2 | $('.loader').css('display','none');
|
||
| 3 | }) |
||
| 4 | |||
| 5 | $(document).ready(function() {
|
||
| 6 | //Init side nav |
||
| 7 | $(".button-collapse").sideNav();
|
||
| 8 | $('#modal').modal();
|
||
| 9 | |||
| 10 | //Hide Download Selected Album button |
||
| 11 | $(".selectedAlbums").hide(function() {
|
||
| 12 | $("#profile")
|
||
| 13 | .removeClass("section-profile")
|
||
| 14 | .addClass("profile");
|
||
| 15 | }); |
||
| 16 | |||
| 17 | //================================================================================== |
||
| 18 | $('.card-image').click(function() {
|
||
| 19 | var albumId = $(this).attr('album-id');
|
||
| 20 | $('.loader').css('display','block');
|
||
| 21 | $.ajax({
|
||
| 22 | url: "slider.php?albumId=" + albumId, |
||
| 23 | success: function(result) {
|
||
| 24 | $('.loader').css('display','none');
|
||
| 25 | $('.overlay').css('width','100%');
|
||
| 26 | $('.slideshow-container').html(result);
|
||
| 27 | flag = 1; |
||
| 28 | y = 1; |
||
| 29 | timer = setInterval(function displaySlider(){
|
||
| 30 | var slides = document.getElementsByClassName("mySlides");
|
||
| 31 | showSlides(slideIndex = y); |
||
| 32 | y++; |
||
| 33 | if (y > slides.length) {
|
||
| 34 | slideIndex = 1 |
||
| 35 | y = 1; |
||
| 36 | } |
||
| 37 | }, 3000); |
||
| 38 | } |
||
| 39 | }); |
||
| 40 | }) |
||
| 41 | |||
| 42 | //=============== |
||
| 43 | function append_download_link(url) {
|
||
| 44 | $('.download-process').css('display','block');
|
||
| 45 | $('.loadermessage').text("Please wait... Albums are downloading");
|
||
| 46 | $.ajax({
|
||
| 47 | url: url, |
||
| 48 | success: function(result) {
|
||
| 49 | $('.download-process').css('display','none');
|
||
| 50 | $(".modal-content").html('<a href="'+ result +'.zip" id="download-link" target="_blank" class="btn" >Download Zip Folder</a> <p> & Mail has been send to your email which is linked with facebook</p>');
|
||
| 51 | $('#modal').modal('open');
|
||
| 52 | var email = $("#email").val();
|
||
| 53 | var name = $("#firstName").val() +" "+ $("#lastName").val();
|
||
| 54 | if(email && email !== 'Not_Found') {
|
||
| 55 | $.ajax({
|
||
| 56 | type: 'POST', |
||
| 57 | url: "email.php", |
||
| 58 | data: {
|
||
| 59 | 'emailId': email, |
||
| 60 | 'name': name, |
||
| 61 | 'albumLocation': result |
||
| 62 | }, |
||
| 63 | success: function(response) {
|
||
|
0 ignored issues
–
show
|
|||
| 64 | } |
||
| 65 | }); |
||
| 66 | } |
||
| 67 | } |
||
| 68 | }); |
||
| 69 | } |
||
| 70 | |||
| 71 | function append_json_link(url) {
|
||
| 72 | $('.download-process').css('display','block');
|
||
| 73 | $('.loadermessage').text("Please wait... Albums are downloading");
|
||
| 74 | $.ajax({
|
||
| 75 | url: url, |
||
| 76 | success: function(result) {
|
||
| 77 | //console.log("Success");
|
||
| 78 | $('.download-process').css('display','none');
|
||
| 79 | $(".modal-content").html(result);
|
||
| 80 | $('#modal').modal('open');
|
||
| 81 | } |
||
| 82 | }); |
||
| 83 | } |
||
| 84 | |||
| 85 | var count = 0; |
||
| 86 | $(".select-album").on("change", function() {
|
||
| 87 | if ($(this).is(":checked")) {
|
||
| 88 | count++; |
||
| 89 | } else {
|
||
| 90 | count--; |
||
| 91 | } |
||
| 92 | if (count > 0) {
|
||
| 93 | $(".selectedAlbums").show(function() {
|
||
| 94 | $("#profile")
|
||
| 95 | .removeClass("profile")
|
||
| 96 | .addClass("section-profile");
|
||
| 97 | }); |
||
| 98 | } else {
|
||
| 99 | $(".selectedAlbums").hide(function() {
|
||
| 100 | $("#profile")
|
||
| 101 | .removeClass("section-profile")
|
||
| 102 | .addClass("profile");
|
||
| 103 | }); |
||
| 104 | } |
||
| 105 | }); |
||
| 106 | |||
| 107 | function get_all_selected_albums() {
|
||
| 108 | var selected_albums; |
||
| 109 | var i = 0; |
||
|
0 ignored issues
–
show
|
|||
| 110 | $(".select-album").each(function() {
|
||
| 111 | if ($(this).is(":checked")) {
|
||
| 112 | if (!selected_albums) {
|
||
| 113 | selected_albums = $(this).val(); |
||
| 114 | } else {
|
||
| 115 | selected_albums = selected_albums + "-" + $(this).val(); |
||
| 116 | } |
||
| 117 | } |
||
| 118 | }); |
||
| 119 | |||
| 120 | return selected_albums; |
||
| 121 | } |
||
| 122 | |||
| 123 | $(".single-export").on("click", function() {
|
||
| 124 | var rel = $(this).attr("rel");
|
||
| 125 | var album = rel.split(",");
|
||
| 126 | append_json_link( |
||
| 127 | "download-album.php?single_export=" + album[0] + "," + album[1] |
||
| 128 | ); |
||
| 129 | }); |
||
| 130 | |||
| 131 | $(".single-download").on("click", function() {
|
||
| 132 | var rel = $(this).attr("rel");
|
||
| 133 | var album = rel.split(",");
|
||
| 134 | append_download_link( |
||
| 135 | "download-album.php?zip=1&single_album=" + album[0] + "," + album[1] |
||
| 136 | ); |
||
| 137 | }); |
||
| 138 | |||
| 139 | $("#download-selected-albums").on("click", function() {
|
||
| 140 | var selected_albums = get_all_selected_albums(); |
||
| 141 | append_download_link( |
||
| 142 | "download-album.php?zip=1&selected_albums=" + selected_albums |
||
| 143 | ); |
||
| 144 | }); |
||
| 145 | |||
| 146 | $(".download-all-albums").on("click", function() {
|
||
| 147 | append_download_link("download-album.php?zip=1&all_albums=all_albums");
|
||
| 148 | }); |
||
| 149 | |||
| 150 | |||
| 151 | function move_to_drive(albums, albumVal) {
|
||
| 152 | |||
| 153 | var google_access_token = $('.g-access-token').text();
|
||
| 154 | if(google_access_token === "Hello") {
|
||
| 155 | $('.download-process').css('display','block');
|
||
| 156 | $('.loadermessage').text("Please wait... File is moving in to google drive");
|
||
| 157 | $.ajax({
|
||
| 158 | url: "https://localhost:8443/SociaManager/google_drive/google_login.php?" + albums + "=" + albumVal, |
||
| 159 | success: function (result) {
|
||
| 160 | $('.download-process').css('display','none');
|
||
| 161 | $(".modal-content").html(result);
|
||
| 162 | $('#modal').modal('open');
|
||
| 163 | } |
||
| 164 | }); |
||
| 165 | } else {
|
||
| 166 | window.location = "https://localhost:8443/SociaManager/google_drive/google_login.php"; |
||
| 167 | } |
||
| 168 | } |
||
| 169 | |||
| 170 | $(".move-single-album").on("click", function() {
|
||
| 171 | var single_album = $(this).attr("rel");
|
||
| 172 | move_to_drive("single_album", single_album);
|
||
| 173 | }); |
||
| 174 | |||
| 175 | $("#move-selected-albums").on("click", function() {
|
||
| 176 | var selected_albums = get_all_selected_albums(); |
||
| 177 | move_to_drive("selected_albums", selected_albums);
|
||
| 178 | }); |
||
| 179 | |||
| 180 | $(".move_all").on("click", function() {
|
||
| 181 | move_to_drive("all_albums", "all_albums");
|
||
| 182 | }); |
||
| 183 | |||
| 184 | }); |
||
| 185 | |||
| 186 | // Slider Script in vanilla java script |
||
| 187 | |||
| 188 | var flag =0; |
||
| 189 | var timer; |
||
| 190 | var y; |
||
| 191 | function closeNav() {
|
||
| 192 | document.getElementById("myNav").style.width = "0%";
|
||
| 193 | clearInterval(timer); |
||
| 194 | slideIndex = 1; |
||
| 195 | } |
||
| 196 | |||
| 197 | var slideIndex = 1; |
||
| 198 | showSlides(slideIndex); |
||
| 199 | |||
| 200 | function plusSlides(n) {
|
||
| 201 | y = slideIndex + n; |
||
| 202 | showSlides(slideIndex += n); |
||
| 203 | } |
||
| 204 | |||
| 205 | function showSlides(n) {
|
||
| 206 | var i; |
||
| 207 | var slides = document.getElementsByClassName("mySlides");
|
||
| 208 | if (n > slides.length) {slideIndex = 1}
|
||
| 209 | if (n < 1) {slideIndex = slides.length}
|
||
| 210 | for (i = 0; i < slides.length; i++) {
|
||
| 211 | slides[i].style.display = "none"; |
||
| 212 | } |
||
| 213 | |||
| 214 | if(flag != 0){
|
||
|
0 ignored issues
–
show
|
|||
| 215 | flag =1; |
||
| 216 | slides[slideIndex-1].style.display = "block"; |
||
| 217 | } |
||
| 218 | } |
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.