scratch – Blame information for rev 125

Subversion Repositories:
Rev:
Rev Author Line No. Line
115 office 1 <!DOCTYPE html>
125 office 2 <html lang="en" ng-app="scratch">
115 office 3 <head>
4 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
7 <meta http-equiv="Pragma" content="no-cache" />
8 <meta http-equiv="Expires" content="0" />
9 <meta name="viewport" content="width=device-width, initial-scale=1">
10 <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
11 <meta name="description" content="quick asset upload">
12 <meta name="author" content="Wizardry and Steamworks">
13 <link rel="icon" href="favicon.ico">
14  
15 <title>scratch</title>
16  
17 <!-- Bootstrap core CSS -->
18 <link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
19 <!-- Font Awesome -->
20 <link href="bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet">
21 <!-- blueimp gallery -->
22 <link rel="stylesheet" href="bower_components/blueimp-gallery/css/blueimp-gallery.min.css">
117 office 23 <!-- Swiper -->
24 <link rel="stylesheet" href="bower_components/swiper/dist/css/swiper.min.css">
115 office 25  
26 <!-- Site-wide style CCS -->
27 <link href="css/style.css" rel="stylesheet">
28  
29 <!-- Local style -->
30 <link href="css/gallery/style.css" rel="stylesheet">
125 office 31  
32 <!-- Scratch Angular Includes -->
33 <ng-include src="'html/scratch-head-last.html'"></ng-include>
115 office 34 </head>
35  
36 <body>
125 office 37  
38 <!-- Scratch Angular Includes -->
39 <ng-include src="'html/scratch-body-first.html'"></ng-include>
115 office 40  
41 <!-- Main component for a primary marketing message or call to action -->
42 <div class="paralax-background"></div>
43 <div class="jumbotron">
44 <h1>scratch copy</h1>
45 <p class="quote">the asset sharer</p>
46 </div>
47  
48 <div class="container">
49  
50 <ul class="nav nav-tabs">
51 <li><a href="index.html">Home</a></li>
52 <li><a href="file.html">File</a></li>
53 <li><a href="text.html">Text</a></li>
54 <li><a href="draw.html">Draw</a></li>
55 <li><a href="link.html">Link</a></li>
121 office 56 <li class="active"><a href="#">View</a></li>
115 office 57 </ul>
58  
59 <div id="main-panel" class="panel panel-default">
60 <div class="panel-body">
61 <div class="input-group">
62 <input id="URL" type="text" class="form-control" readonly>
63 <span class="input-group-btn">
64 <button id="copy-url" class="btn btn-default" type="button" data-clipboard-target="#URL" data-toggle="tooltip" data-placement="auto" title="Copy to clipboard."><i class="glyphicon glyphicon-paperclip"></i></button>
65 </span>
66 <span class="input-group-btn">
67 <button id="btn-facebook" class="btn btn-default" type="button" disabled><i class="fa fa-facebook"></i></button>
68 </span>
69 </div>
70  
71 <!-- The Gallery as inline carousel, can be positioned anywhere on the page -->
72 <div id="blueimp-gallery-carousel" class="blueimp-gallery blueimp-gallery-carousel">
73 <div class="slides"></div>
74 <h3 class="title"></h3>
75 <a class="prev"></a>
76 <a class="next"></a>
77 <a class="play-pause"></a>
119 office 78 <!-- <ol class="indicator"></ol> -->
115 office 79 </div>
117 office 80  
81 <div class="swiper-container">
82 <div id="links" class="swiper-wrapper">
83 </div>
84 <!-- If we need navigation buttons -->
85 <div class="swiper-button-prev"></div>
86 <div class="swiper-button-next"></div>
115 office 87 </div>
88 </div>
89 </div>
90  
91 </div> <!-- /container -->
92  
93 <div id="footer">
94 <div class="container">
95 <p class="text-muted credit text-center">Copyright <i class="glyphicon glyphicon-copyright-mark"></i> 2017 <a href="http://grimore.org">Wizardry and Steamworks</a>.</p>
96 </div>
97 </div>
98  
99 <!-- jQuery -->
100 <script src="bower_components/jquery/dist/jquery.min.js"></script>
125 office 101 <!-- Angular JS -->
102 <script src="bower_components/angular/angular.min.js"></script>
115 office 103 <!-- BootStrap -->
104 <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
105 <!-- Bootstrap Validator -->
106 <script src="bower_components/bootstrap-validator/dist/validator.min.js"></script>
107 <!-- blueimp-gallery -->
108 <script src="bower_components/blueimp-gallery/js/blueimp-gallery.min.js"></script>
109 <!-- Clipboard -->
110 <script src="bower_components/clipboard/dist/clipboard.min.js"></script>
111 <!-- YAML -->
112 <script src="bower_components/yaml.js/dist/yaml.min.js"></script>
117 office 113 <!-- Swiper -->
114 <script src="bower_components/swiper/dist/js/swiper.min.js"></script>
115 <!-- Wizardry and Steamworks -->
116 <script src="bower_components/was/dist/was.min.js"></script>
125 office 117 <!-- Angular Initialization. -->
115 office 118 <script>
125 office 119 var app = angular.module('scratch', []);
120 </script>
121 <script>
115 office 122 $(document).ready(() => {
123  
124 // Extend gallery for HTML.
125 blueimp.Gallery.prototype.textFactory = function (obj, callback) {
126 var $element = $('<div>')
127 .addClass('text-content')
128 .attr('title', obj.title);
117 office 129 $.get(obj.href, {
130 timestamp: window.performance.now()
131 }).done(function (result) {
115 office 132 $element.html(result);
133 callback({
134 type: 'load',
135 target: $element[0]
136 });
137 })
138 .fail(function () {
139 callback({
140 type: 'error',
141 target: $element[0]
142 });
143 });
144 return $element[0];
145 };
146  
122 office 147 $.getJSON('view.php', {
117 office 148 timestamp: window.performance.now()
149 }).then((data) => {
150 // Create slides.
119 office 151 var indexPage = 0;
117 office 152 data.chunk(50).forEach((page) => {
115 office 153 document.getElementById('links')
154 .insertAdjacentHTML(
117 office 155 'beforeend',
119 office 156 '<div id="swiper-slide-' + indexPage + '" class="swiper-slide"></div>'
117 office 157 );
158 page.forEach((link) => {
159 // Generic icon for text / html items.
160 switch(link.type) {
161 case 'text/plain':
162 link.preview ='img/text.png';
163 break;
164 }
119 office 165 document.getElementById('swiper-slide-' + indexPage)
117 office 166 .insertAdjacentHTML(
167 'beforeend',
168 '<a href="' +
169 link.url +
170 '" type="' +
171 link.type +
172 '"><img src="' +
173 link.preview +
174 '" width="60" height="40"></a>'
175 );
176 });
119 office 177  
178  
179 ++indexPage;
115 office 180 });
119 office 181  
182 // Initialize gallery.
115 office 183 document.getElementById('links').onclick = function (event) {
184 event = event || window.event;
185 var target = event.target || event.srcElement,
186 link = target.src ? target.parentNode : target,
187 options = {
188 index: link,
189 event: event,
119 office 190 carousel: true,
115 office 191 container: '#blueimp-gallery-carousel',
192 stretchImages: true,
193 startSlideshow: false,
194 onslideend: function(index, slide) {
195 // Set the URL.
196 $('#URL').val(
197 location.protocol
198 .concat("//")
199 .concat(window.location.hostname)
200 .concat("/").concat(data[index].url)
201 );
119 office 202  
115 office 203 // Check if OpenGraph should be enabled.
204 switch(data[index].opengraph) {
205 case true:
206 // Enable the facebook button.
207 $('#btn-facebook')
208 .prop("disabled", false);
209 break;
210 default:
211 // Disable the facebook button.
212 $('#btn-facebook')
213 .prop("disabled", true);
214 break;
215 }
119 office 216  
115 office 217 // Change the URL to OpenGraph when the user clicks the button.
218 $('#btn-facebook').on('click', () => {
219 $('#URL')
220 .val(
221 location.protocol.concat("//")
222 .concat(window.location.hostname)
223 .concat("/")
224 .concat("og")
225 .concat("/")
226 .concat(data[index].url)
227 );
228 });
229 }
230 },
231 links = this.getElementsByTagName('a');
232 blueimp.Gallery(links, options);
233 };
234  
117 office 235 new Swiper ('.swiper-container', {
236 // Optional parameters
237 direction: 'horizontal',
119 office 238 // Creates duplicate element IDs if set to true.
239 loop: false,
117 office 240  
241 // If we need pagination
119 office 242 //pagination: '.swiper-pagination',
117 office 243  
244 // Navigation arrows
245 nextButton: '.swiper-button-next',
246 prevButton: '.swiper-button-prev',
247  
248 // And if we need scrollbar
119 office 249 //scrollbar: '.swiper-scrollbar',
117 office 250 });
251  
115 office 252 // Enable the Clipboard button.
253 new Clipboard('#copy-url');
254 });
255 });
256 </script>
257 <!-- Jumbotron parallax effect -->
258 <script>
259 var jumboHeight = $('.jumbotron').outerHeight();
260 function parallax(){
261 var scrolled = $(window).scrollTop();
262 $('.paralax-background').css('height', (jumboHeight-scrolled) + 'px');
263 }
264  
265 $(window).scroll(function(e){
266 parallax();
267 });
268 </script>
269 </body>
270 </html>