Initial commit: GamePortrait 竖屏版 - 深色豪华主题

This commit is contained in:
li
2026-01-16 17:47:53 +08:00
commit 40976e4b45
26611 changed files with 2843638 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2013 Alice Lieutier
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+78
View File
@@ -0,0 +1,78 @@
smoothScroll
============
A teeny tiny, standard compliant, smooth scroll script with ease-in-out effect and no dependancy.
smoothScroll will tie all your internal links to a handler that will produce a smooth scroll to their target instead of an instant jump. It also returns an API that you can use to call a smooth scroll yourself.
This works in Firefox, Chrome, IE10, Opera and Safari.
Unsupported browsers would just use the normal internal link behaviour.
How to use
-
Just include smoothscroll inside your page, like this:
<script type="text/javascript" src="path/to/smoothscroll.min.js"></script>
All your internal links will be tied to a smooth scroll.
If you want to call a smooth scroll from your code, you can now use the API by calling:
`window.smoothScroll(target, duration, callback, context)`
where:
* `target` is a `HTMLElement Object` from your document that you want to scroll to, or a numeric position on the page
* `duration` is the total duration of the scroll (optional, defaults to 500ms)
* `callback` is a function to be executed when the scrolling is over (optional)
* `context` is the scrolling context (optional, defaults to window, can be any `HTMLElement Object`)
Alternatively, you can install smoothscroll as a dependency using npm:
```
npm install --save smoothscroll
```
Example usage as a module, binding to a custom element:
```javascript
var smoothScroll = require('smoothscroll');
var exampleBtn = document.querySelector('.example-button');
var exampleDestination = document.querySelector('.example-destination');
// This function can easily be an onClick handler in React components
var handleClick = function(event) {
event.preventDefault();
smoothScroll(exampleDestination);
};
exampleBtn.addEventListener('click', handleClick);
```
smoothscroll.js
-
Here are some indications if you want to tweak the code to fit your needs:
There is an ease-in-out type timing function. You can change it quite easily in the code. Here is where I found the one I use:
- http://blog.greweb.fr/2012/02/bezier-curve-based-easing-functions-from-concept-to-implementation/
You can also change the default duration of a scroll, which is 500ms by default.
My code is **heavily** commented so you shoudn't lose yourself too much.
Example
-
The example.html file is basically the script applied to a w3c page. I just changed the style so the table of content is fixed to the left.
Check out the result. Wouldn't it be great if all w3c specs where that easy to navigate in?
Similar scripts
-
While I was looking for a name for this script, I found these sites. If this script is not what you need, you might have more luck there:
- http://www.itnewb.com/tutorial/Creating-the-Smooth-Scroll-Effect-with-JavaScript
- http://www.kryogenix.org/code/browser/smoothscroll (best cross browser compatibility)
License
-
This library is released under the MIT license.
+3474
View File
File diff suppressed because it is too large Load Diff
+19
View File
@@ -0,0 +1,19 @@
{
"name": "smoothscroll",
"version": "0.4.0",
"description": "A teeny tiny smooth scroll script with ease-in-out effect and no jQuery.",
"main": "smoothscroll.js",
"author": "Alice Lieutier <alice@lieutier.me> (http://alice.lieutier.me)",
"license": "MIT",
"homepage": "https://github.com/alicelieutier/smoothScroll#readme",
"repository": "https://github.com/alicelieutier/smoothScroll.git",
"keywords": [
"smooth scroll",
"scroll",
"no jQuery",
"anchor"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
}
}
+120
View File
@@ -0,0 +1,120 @@
(function (root, smoothScroll) {
'use strict';
// Support RequireJS and CommonJS/NodeJS module formats.
// Attach smoothScroll to the `window` when executed as a <script>.
// RequireJS
if (typeof define === 'function' && define.amd) {
define(smoothScroll);
// CommonJS
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = smoothScroll();
} else {
root.smoothScroll = smoothScroll();
}
})(this, function(){
'use strict';
// Do not initialize smoothScroll when running server side, handle it in client:
if (typeof window !== 'object') return;
// We do not want this script to be applied in browsers that do not support those
// That means no smoothscroll on IE9 and below.
if(document.querySelectorAll === void 0 || window.pageYOffset === void 0 || history.pushState === void 0) { return; }
// Get the top position of an element in the document
var getTop = function(element, start) {
// return value of html.getBoundingClientRect().top ... IE : 0, other browsers : -pageYOffset
if(element.nodeName === 'HTML') return -start
return element.getBoundingClientRect().top + start
}
// ease in out function thanks to:
// http://blog.greweb.fr/2012/02/bezier-curve-based-easing-functions-from-concept-to-implementation/
var easeInOutCubic = function (t) { return t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1 }
// calculate the scroll position we should be in
// given the start and end point of the scroll
// the time elapsed from the beginning of the scroll
// and the total duration of the scroll (default 500ms)
var position = function(start, end, elapsed, duration) {
if (elapsed > duration) return end;
return start + (end - start) * easeInOutCubic(elapsed / duration); // <-- you can change the easing funtion there
// return start + (end - start) * (elapsed / duration); // <-- this would give a linear scroll
}
// we use requestAnimationFrame to be called by the browser before every repaint
// if the first argument is an element then scroll to the top of this element
// if the first argument is numeric then scroll to this location
// if the callback exist, it is called when the scrolling is finished
// if context is set then scroll that element, else scroll window
var smoothScroll = function(el, duration, callback, context){
duration = duration || 500;
context = context || window;
var start = context.scrollTop || window.pageYOffset;
if (typeof el === 'number') {
var end = parseInt(el);
} else {
var end = getTop(el, start);
}
var clock = Date.now();
var requestAnimationFrame = window.requestAnimationFrame ||
window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame ||
function(fn){window.setTimeout(fn, 15);};
var step = function(){
var elapsed = Date.now() - clock;
if (context !== window) {
context.scrollTop = position(start, end, elapsed, duration);
}
else {
window.scroll(0, position(start, end, elapsed, duration));
}
if (elapsed > duration) {
if (typeof callback === 'function') {
callback(el);
}
} else {
requestAnimationFrame(step);
}
}
step();
}
var linkHandler = function(ev) {
if (!ev.defaultPrevented) {
ev.preventDefault();
if (location.hash !== this.hash) window.history.pushState(null, null, this.hash)
// using the history api to solve issue #1 - back doesn't work
// most browser don't update :target when the history api is used:
// THIS IS A BUG FROM THE BROWSERS.
// change the scrolling duration in this call
var node = document.getElementById(this.hash.substring(1))
if (!node) return; // Do not scroll to non-existing node
smoothScroll(node, 500, function (el) {
location.replace('#' + el.id)
// this will cause the :target to be activated.
});
}
}
// We look for all the internal links in the documents and attach the smoothscroll function
document.addEventListener("DOMContentLoaded", function () {
var internal = document.querySelectorAll('a[href^="#"]:not([href="#"])'), a;
for(var i=internal.length; a=internal[--i];){
a.addEventListener("click", linkHandler, false);
}
});
// return smoothscroll API
return smoothScroll;
});
+1
View File
@@ -0,0 +1 @@
(function(root,smoothScroll){"use strict";if(typeof define==="function"&&define.amd){define(smoothScroll)}else if(typeof exports==="object"&&typeof module==="object"){module.exports=smoothScroll()}else{root.smoothScroll=smoothScroll()}})(this,function(){"use strict";if(typeof window!=="object")return;if(document.querySelectorAll===void 0||window.pageYOffset===void 0||history.pushState===void 0){return}var getTop=function(element,start){if(element.nodeName==="HTML")return-start;return element.getBoundingClientRect().top+start};var easeInOutCubic=function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1};var position=function(start,end,elapsed,duration){if(elapsed>duration)return end;return start+(end-start)*easeInOutCubic(elapsed/duration)};var smoothScroll=function(el,duration,callback,context){duration=duration||500;context=context||window;var start=context.scrollTop||window.pageYOffset;if(typeof el==="number"){var end=parseInt(el)}else{var end=getTop(el,start)}var clock=Date.now();var requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(fn){window.setTimeout(fn,15)};var step=function(){var elapsed=Date.now()-clock;if(context!==window){context.scrollTop=position(start,end,elapsed,duration)}else{window.scroll(0,position(start,end,elapsed,duration))}if(elapsed>duration){if(typeof callback==="function"){callback(el)}}else{requestAnimationFrame(step)}};step()};var linkHandler=function(ev){if(!ev.defaultPrevented){ev.preventDefault();if(location.hash!==this.hash)window.history.pushState(null,null,this.hash);var node=document.getElementById(this.hash.substring(1));if(!node)return;smoothScroll(node,500,function(el){location.replace("#"+el.id)})}};document.addEventListener("DOMContentLoaded",function(){var internal=document.querySelectorAll('a[href^="#"]:not([href="#"])'),a;for(var i=internal.length;a=internal[--i];){a.addEventListener("click",linkHandler,false)}});return smoothScroll});