script.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. var timestamp = function() {
  2. var timeIndex = 0;
  3. var shifts = [35, 60, 60 * 3, 60 * 60 * 2, 60 * 60 * 25, 60 * 60 * 24 * 4, 60 * 60 * 24 * 10];
  4. var now = new Date();
  5. var shift = shifts[timeIndex++] || 0;
  6. var date = new Date(now - shift * 1000);
  7. return date.getTime() / 1000;
  8. };
  9. var changeSkin = function(skin) {
  10. location.href = location.href.split('#')[0].split('?')[0] + '?skin=' + skin;
  11. };
  12. var getCurrentSkin = function() {
  13. var header = document.getElementById('header');
  14. var skin = location.href.split('skin=')[1];
  15. if (!skin) {
  16. skin = 'Snapgram';
  17. }
  18. if (skin.indexOf('#') !== -1) {
  19. skin = skin.split('#')[0];
  20. }
  21. var skins = {
  22. Snapgram: {
  23. avatars: true,
  24. list: false,
  25. autoFullScreen: false,
  26. cubeEffect: true,
  27. paginationArrows: false
  28. },
  29. VemDeZAP: {
  30. avatars: false,
  31. list: true,
  32. autoFullScreen: false,
  33. cubeEffect: false,
  34. paginationArrows: true
  35. },
  36. FaceSnap: {
  37. avatars: true,
  38. list: false,
  39. autoFullScreen: true,
  40. cubeEffect: false,
  41. paginationArrows: true
  42. },
  43. Snapssenger: {
  44. avatars: false,
  45. list: false,
  46. autoFullScreen: false,
  47. cubeEffect: false,
  48. paginationArrows: false
  49. }
  50. };
  51. var el = document.querySelectorAll('#skin option');
  52. var total = el.length;
  53. for (var i = 0; i < total; i++) {
  54. var what = skin == el[i].value ? true : false;
  55. if (what) {
  56. el[i].setAttribute('selected', 'selected');
  57. header.innerHTML = skin;
  58. header.className = skin;
  59. } else {
  60. el[i].removeAttribute('selected');
  61. }
  62. }
  63. return {
  64. name: skin,
  65. params: skins[skin]
  66. };
  67. };