Browse Source

Change CDN.

master
Tian Yunhao 6 years ago
parent
commit
e13d0c88cd
  1. 39
      static/libs/jsondiffpatch.min.js
  2. 3
      static/libs/socket.io.js
  3. 1
      static/libs/textFit.min.js
  4. 6
      static/libs/vue.min.js
  5. 6
      views/submission.ejs
  6. 4
      views/submissions.ejs
  7. 2
      views/submissions_item.ejs

39
static/libs/jsondiffpatch.min.js vendored

File diff suppressed because one or more lines are too long

3
static/libs/socket.io.js

File diff suppressed because one or more lines are too long

1
static/libs/textFit.min.js vendored

@ -0,0 +1 @@
(function(root,factory){"use strict";if(typeof define==="function"&&define.amd){define([],factory)}else if(typeof exports==="object"){module.exports=factory()}else{root.textFit=factory()}})(typeof global==="object"?global:this,function(){"use strict";var defaultSettings={alignVert:false,alignHoriz:false,multiLine:false,detectMultiLine:true,minFontSize:6,maxFontSize:80,reProcess:true,widthOnly:false,alignVertWithFlexbox:false};return function textFit(els,options){if(!options)options={};var settings={};for(var key in defaultSettings){if(options.hasOwnProperty(key)){settings[key]=options[key]}else{settings[key]=defaultSettings[key]}}if(typeof els.toArray==="function"){els=els.toArray()}var elType=Object.prototype.toString.call(els);if(elType!=="[object Array]"&&elType!=="[object NodeList]"&&elType!=="[object HTMLCollection]"){els=[els]}for(var i=0;i<els.length;i++){processItem(els[i],settings)}};function processItem(el,settings){if(!isElement(el)||!settings.reProcess&&el.getAttribute("textFitted")){return false}if(!settings.reProcess){el.setAttribute("textFitted",1)}var innerSpan,originalHeight,originalHTML,originalWidth;var low,mid,high;originalHTML=el.innerHTML;originalWidth=innerWidth(el);originalHeight=innerHeight(el);if(!originalWidth||!settings.widthOnly&&!originalHeight){if(!settings.widthOnly)throw new Error("Set a static height and width on the target element "+el.outerHTML+" before using textFit!");else throw new Error("Set a static width on the target element "+el.outerHTML+" before using textFit!")}if(originalHTML.indexOf("textFitted")===-1){innerSpan=document.createElement("span");innerSpan.className="textFitted";innerSpan.style["display"]="inline-block";innerSpan.innerHTML=originalHTML;el.innerHTML="";el.appendChild(innerSpan)}else{innerSpan=el.querySelector("span.textFitted");if(hasClass(innerSpan,"textFitAlignVert")){innerSpan.className=innerSpan.className.replace("textFitAlignVert","");innerSpan.style["height"]="";el.className.replace("textFitAlignVertFlex","")}}if(settings.alignHoriz){el.style["text-align"]="center";innerSpan.style["text-align"]="center"}var multiLine=settings.multiLine;if(settings.detectMultiLine&&!multiLine&&innerSpan.scrollHeight>=parseInt(window.getComputedStyle(innerSpan)["font-size"],10)*2){multiLine=true}if(!multiLine){el.style["white-space"]="nowrap"}low=settings.minFontSize+1;high=settings.maxFontSize+1;while(low<=high){mid=parseInt((low+high)/2,10);innerSpan.style.fontSize=mid+"px";if(innerSpan.scrollWidth<=originalWidth&&(settings.widthOnly||innerSpan.scrollHeight<=originalHeight)){low=mid+1}else{high=mid-1}}innerSpan.style.fontSize=mid-1+"px";if(settings.alignVert){addStyleSheet();var height=innerSpan.scrollHeight;if(window.getComputedStyle(el)["position"]==="static"){el.style["position"]="relative"}if(!hasClass(innerSpan,"textFitAlignVert")){innerSpan.className=innerSpan.className+" textFitAlignVert"}innerSpan.style["height"]=height+"px";if(settings.alignVertWithFlexbox&&!hasClass(el,"textFitAlignVertFlex")){el.className=el.className+" textFitAlignVertFlex"}}}function innerHeight(el){var style=window.getComputedStyle(el,null);return el.clientHeight-parseInt(style.getPropertyValue("padding-top"),10)-parseInt(style.getPropertyValue("padding-bottom"),10)}function innerWidth(el){var style=window.getComputedStyle(el,null);return el.clientWidth-parseInt(style.getPropertyValue("padding-left"),10)-parseInt(style.getPropertyValue("padding-right"),10)}function isElement(o){return typeof HTMLElement==="object"?o instanceof HTMLElement:o&&typeof o==="object"&&o!==null&&o.nodeType===1&&typeof o.nodeName==="string"}function hasClass(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1}function addStyleSheet(){if(document.getElementById("textFitStyleSheet"))return;var style=[".textFitAlignVert{","position: absolute;","top: 0; right: 0; bottom: 0; left: 0;","margin: auto;","display: flex;","justify-content: center;","flex-direction: column;","}",".textFitAlignVertFlex{","display: flex;","}",".textFitAlignVertFlex .textFitAlignVert{","position: static;","}"].join("");var css=document.createElement("style");css.type="text/css";css.id="textFitStyleSheet";css.innerHTML=style;document.body.appendChild(css)}});

6
static/libs/vue.min.js vendored

File diff suppressed because one or more lines are too long

6
views/submission.ejs

@ -86,9 +86,9 @@
</template> </template>
</div> </div>
</div> </div>
<script src="//cdn.bootcss.com/vue/2.4.2/vue.js"></script> <script src="/libs/vue.min.js"></script>
<script src="//cdn.bootcss.com/socket.io/2.0.3/socket.io.js"></script> <script src="/libs/socket.io.js"></script>
<script src="//cdn.bootcss.com/jsondiffpatch/0.2.4/jsondiffpatch.js"></script> <script src="/libs/jsondiffpatch.min.js"></script>
<% include submissions_item %> <% include submissions_item %>

4
views/submissions.ejs

@ -104,8 +104,8 @@
<% include page %> <% include page %>
</div> </div>
<script src="//cdn.bootcss.com/vue/2.4.2/vue.min.js"></script> <script src="/libs/vue.min.js"></script>
<script src="//cdn.bootcss.com/socket.io/2.0.3/socket.io.js"></script> <script src="/libs/socket.io.js"></script>
<% include submissions_item %> <% include submissions_item %>
<script> <script>

2
views/submissions_item.ejs

@ -1,7 +1,7 @@
<% include util %> <% include util %>
<% include status_label %> <% include status_label %>
<script src="//cdn.bootcss.com/textfit/2.3.1/textFit.min.js"></script> <script src="/libs/textFit.min.js"></script>
<script> <script>
const submissionUrl = <%- JSON.stringify(displayConfig.inContest ? const submissionUrl = <%- JSON.stringify(displayConfig.inContest ?

Loading…
Cancel
Save