Add statics

This commit is contained in:
el Mau 2023-02-12 23:22:21 -06:00
parent 3cf7440760
commit b3bec81d84
21 changed files with 1061 additions and 142 deletions

View File

@ -0,0 +1,33 @@
@media (prefers-color-scheme: dark) {
:root {
--primary: #264b5d;
--primary-fg: #f7f7f7;
--body-fg: #eeeeee;
--body-bg: #121212;
--body-quiet-color: #e0e0e0;
--body-loud-color: #ffffff;
--breadcrumbs-link-fg: #e0e0e0;
--breadcrumbs-bg: var(--primary);
--link-fg: #81d4fa;
--link-hover-color: #4ac1f7;
--link-selected-fg: #6f94c6;
--hairline-color: #272727;
--border-color: #353535;
--error-fg: #e35f5f;
--message-success-bg: #006b1b;
--message-warning-bg: #583305;
--message-error-bg: #570808;
--darkened-bg: #212121;
--selected-bg: #1b1b1b;
--selected-row: #00363a;
--close-button-bg: #333333;
--close-button-hover-bg: #666666;
}
}

View File

@ -153,24 +153,6 @@ Requires core.js and SelectBox.js.
// Move selected from_box options to to_box
SelectBox.move(field_id + '_from', field_id + '_to');
if (!is_stacked) {
// In horizontal mode, give the same height to the two boxes.
const j_from_box = document.getElementById(field_id + '_from');
const j_to_box = document.getElementById(field_id + '_to');
let height = filter_p.offsetHeight + j_from_box.offsetHeight;
const j_to_box_style = window.getComputedStyle(j_to_box);
if (j_to_box_style.getPropertyValue('box-sizing') === 'border-box') {
// Add the padding and border to the final height.
height += parseInt(j_to_box_style.getPropertyValue('padding-top'), 10)
+ parseInt(j_to_box_style.getPropertyValue('padding-bottom'), 10)
+ parseInt(j_to_box_style.getPropertyValue('border-top-width'), 10)
+ parseInt(j_to_box_style.getPropertyValue('border-bottom-width'), 10);
}
j_to_box.style.height = height + 'px';
}
// Initial icon refresh
SelectFilter.refresh_icons(field_id);
},

View File

@ -0,0 +1,30 @@
/**
* Persist changelist filters state (collapsed/expanded).
*/
'use strict';
{
// Init filters.
let filters = JSON.parse(sessionStorage.getItem('django.admin.filtersState'));
if (!filters) {
filters = {};
}
Object.entries(filters).forEach(([key, value]) => {
const detailElement = document.querySelector(`[data-filter-title='${key}']`);
// Check if the filter is present, it could be from other view.
if (detailElement) {
value ? detailElement.setAttribute('open', '') : detailElement.removeAttribute('open');
}
});
// Save filter state when clicks.
const details = document.querySelectorAll('details');
details.forEach(detail => {
detail.addEventListener('toggle', event => {
filters[`${event.target.dataset.filterTitle}`] = detail.open;
sessionStorage.setItem('django.admin.filtersState', JSON.stringify(filters));
});
});
}

View File

@ -88,7 +88,12 @@
if (options.added) {
options.added(row);
}
$(document).trigger('formset:added', [row, options.prefix]);
row.get(0).dispatchEvent(new CustomEvent("formset:added", {
bubbles: true,
detail: {
formsetName: options.prefix
}
}));
};
/**
@ -130,7 +135,11 @@
if (options.removed) {
options.removed(row);
}
$(document).trigger('formset:removed', [row, options.prefix]);
document.dispatchEvent(new CustomEvent("formset:removed", {
detail: {
formsetName: options.prefix
}
}));
// Update the TOTAL_FORMS form count.
const forms = $("." + options.formCssClass);
$("#id_" + options.prefix + "-TOTAL_FORMS").val(forms.length);
@ -218,12 +227,10 @@
// instantiate a new SelectFilter instance for it.
if (typeof SelectFilter !== 'undefined') {
$('.selectfilter').each(function(index, value) {
const namearr = value.name.split('-');
SelectFilter.init(value.id, namearr[namearr.length - 1], false);
SelectFilter.init(value.id, this.dataset.fieldName, false);
});
$('.selectfilterstacked').each(function(index, value) {
const namearr = value.name.split('-');
SelectFilter.init(value.id, namearr[namearr.length - 1], true);
SelectFilter.init(value.id, this.dataset.fieldName, true);
});
}
};
@ -283,12 +290,10 @@
// If any SelectFilter widgets were added, instantiate a new instance.
if (typeof SelectFilter !== "undefined") {
$(".selectfilter").each(function(index, value) {
const namearr = value.name.split('-');
SelectFilter.init(value.id, namearr[namearr.length - 1], false);
SelectFilter.init(value.id, this.dataset.fieldName, false);
});
$(".selectfilterstacked").each(function(index, value) {
const namearr = value.name.split('-');
SelectFilter.init(value.id, namearr[namearr.length - 1], true);
SelectFilter.init(value.id, this.dataset.fieldName, true);
});
}
};
@ -300,7 +305,13 @@
dependency_list = input.data('dependency_list') || [],
dependencies = [];
$.each(dependency_list, function(i, field_name) {
dependencies.push('#' + row.find('.form-row .field-' + field_name).find('input, select, textarea').attr('id'));
// Dependency in a fieldset.
let field_element = row.find('.form-row .field-' + field_name);
// Dependency without a fieldset.
if (!field_element.length) {
field_element = row.find('.form-row.field-' + field_name);
}
dependencies.push('#' + field_element.find('input, select, textarea').attr('id'));
});
if (dependencies.length) {
input.prepopulate(dependencies, input.attr('maxlength'));

View File

@ -13,6 +13,12 @@
navLink.tabIndex = 0;
}
}
function disableNavFilterTabbing() {
document.getElementById('nav-filter').tabIndex = -1;
}
function enableNavFilterTabbing() {
document.getElementById('nav-filter').tabIndex = 0;
}
const main = document.getElementById('main');
let navSidebarIsOpen = localStorage.getItem('django.admin.navSidebarIsOpen');
@ -21,6 +27,7 @@
}
if (navSidebarIsOpen === 'false') {
disableNavLinkTabbing();
disableNavFilterTabbing();
}
main.classList.toggle('shifted', navSidebarIsOpen === 'true');
@ -28,12 +35,68 @@
if (navSidebarIsOpen === 'true') {
navSidebarIsOpen = 'false';
disableNavLinkTabbing();
disableNavFilterTabbing();
} else {
navSidebarIsOpen = 'true';
enableNavLinkTabbing();
enableNavFilterTabbing();
}
localStorage.setItem('django.admin.navSidebarIsOpen', navSidebarIsOpen);
main.classList.toggle('shifted');
});
}
function initSidebarQuickFilter() {
const options = [];
const navSidebar = document.getElementById('nav-sidebar');
if (!navSidebar) {
return;
}
navSidebar.querySelectorAll('th[scope=row] a').forEach((container) => {
options.push({title: container.innerHTML, node: container});
});
function checkValue(event) {
let filterValue = event.target.value;
if (filterValue) {
filterValue = filterValue.toLowerCase();
}
if (event.key === 'Escape') {
filterValue = '';
event.target.value = ''; // clear input
}
let matches = false;
for (const o of options) {
let displayValue = '';
if (filterValue) {
if (o.title.toLowerCase().indexOf(filterValue) === -1) {
displayValue = 'none';
} else {
matches = true;
}
}
// show/hide parent <TR>
o.node.parentNode.parentNode.style.display = displayValue;
}
if (!filterValue || matches) {
event.target.classList.remove('no-results');
} else {
event.target.classList.add('no-results');
}
sessionStorage.setItem('django.admin.navSidebarFilterValue', filterValue);
}
const nav = document.getElementById('nav-filter');
nav.addEventListener('change', checkValue, false);
nav.addEventListener('input', checkValue, false);
nav.addEventListener('keyup', checkValue, false);
const storedValue = sessionStorage.getItem('django.admin.navSidebarFilterValue');
if (storedValue) {
nav.value = storedValue;
checkValue({target: nav, key: ''});
}
}
window.initSidebarQuickFilter = initSidebarQuickFilter;
initSidebarQuickFilter();
}

View File

@ -3,7 +3,11 @@
const $ = django.jQuery;
const fields = $('#django-admin-prepopulated-fields-constants').data('prepopulatedFields');
$.each(fields, function(index, field) {
$('.empty-form .form-row .field-' + field.name + ', .empty-form.form-row .field-' + field.name).addClass('prepopulated_field');
$(
'.empty-form .form-row .field-' + field.name +
', .empty-form.form-row .field-' + field.name +
', .empty-form .form-row.field-' + field.name
).addClass('prepopulated_field');
$(field.id).data('dependency_list', field.dependency_list).prepopulate(
field.dependency_ids, field.maxLength, field.allowUnicode
);

View File

@ -1,4 +1,4 @@
Copyright JS Foundation and other contributors, https://js.foundation/
Copyright OpenJS Foundation and other contributors, https://openjsf.org/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@ -1,15 +1,15 @@
/*!
* jQuery JavaScript Library v3.5.1
* jQuery JavaScript Library v3.6.0
* https://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2020-05-04T22:49Z
* Date: 2021-03-02T17:08Z
*/
( function( global, factory ) {
@ -76,12 +76,16 @@ var support = {};
var isFunction = function isFunction( obj ) {
// Support: Chrome <=57, Firefox <=52
// In some browsers, typeof returns "function" for HTML <object> elements
// (i.e., `typeof document.createElement( "object" ) === "function"`).
// We don't want to classify *any* DOM node as a function.
return typeof obj === "function" && typeof obj.nodeType !== "number";
};
// Support: Chrome <=57, Firefox <=52
// In some browsers, typeof returns "function" for HTML <object> elements
// (i.e., `typeof document.createElement( "object" ) === "function"`).
// We don't want to classify *any* DOM node as a function.
// Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5
// Plus for old WebKit, typeof returns "function" for HTML collections
// (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756)
return typeof obj === "function" && typeof obj.nodeType !== "number" &&
typeof obj.item !== "function";
};
var isWindow = function isWindow( obj ) {
@ -147,7 +151,7 @@ function toType( obj ) {
var
version = "3.5.1",
version = "3.6.0",
// Define a local copy of jQuery
jQuery = function( selector, context ) {
@ -401,7 +405,7 @@ jQuery.extend( {
if ( isArrayLike( Object( arr ) ) ) {
jQuery.merge( ret,
typeof arr === "string" ?
[ arr ] : arr
[ arr ] : arr
);
} else {
push.call( ret, arr );
@ -496,9 +500,9 @@ if ( typeof Symbol === "function" ) {
// Populate the class2type map
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
function( _i, name ) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
} );
function( _i, name ) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
} );
function isArrayLike( obj ) {
@ -518,14 +522,14 @@ function isArrayLike( obj ) {
}
var Sizzle =
/*!
* Sizzle CSS Selector Engine v2.3.5
* Sizzle CSS Selector Engine v2.3.6
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2020-03-14
* Date: 2021-02-16
*/
( function( window ) {
var i,
@ -1108,8 +1112,8 @@ support = Sizzle.support = {};
* @returns {Boolean} True iff elem is a non-HTML XML node
*/
isXML = Sizzle.isXML = function( elem ) {
var namespace = elem.namespaceURI,
docElem = ( elem.ownerDocument || elem ).documentElement;
var namespace = elem && elem.namespaceURI,
docElem = elem && ( elem.ownerDocument || elem ).documentElement;
// Support: IE <=8
// Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
@ -3024,9 +3028,9 @@ var rneedsContext = jQuery.expr.match.needsContext;
function nodeName( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
};
}
var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
@ -3997,8 +4001,8 @@ jQuery.extend( {
resolveContexts = Array( i ),
resolveValues = slice.call( arguments ),
// the master Deferred
master = jQuery.Deferred(),
// the primary Deferred
primary = jQuery.Deferred(),
// subordinate callback factory
updateFunc = function( i ) {
@ -4006,30 +4010,30 @@ jQuery.extend( {
resolveContexts[ i ] = this;
resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
if ( !( --remaining ) ) {
master.resolveWith( resolveContexts, resolveValues );
primary.resolveWith( resolveContexts, resolveValues );
}
};
};
// Single- and empty arguments are adopted like Promise.resolve
if ( remaining <= 1 ) {
adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject,
!remaining );
// Use .then() to unwrap secondary thenables (cf. gh-3000)
if ( master.state() === "pending" ||
if ( primary.state() === "pending" ||
isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
return master.then();
return primary.then();
}
}
// Multiple arguments are aggregated like Promise.all array elements
while ( i-- ) {
adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject );
}
return master.promise();
return primary.promise();
}
} );
@ -4180,8 +4184,8 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
for ( ; i < len; i++ ) {
fn(
elems[ i ], key, raw ?
value :
value.call( elems[ i ], i, fn( elems[ i ], key ) )
value :
value.call( elems[ i ], i, fn( elems[ i ], key ) )
);
}
}
@ -5089,10 +5093,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
}
var
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
function returnTrue() {
return true;
@ -5387,8 +5388,8 @@ jQuery.event = {
event = jQuery.event.fix( nativeEvent ),
handlers = (
dataPriv.get( this, "events" ) || Object.create( null )
)[ event.type ] || [],
dataPriv.get( this, "events" ) || Object.create( null )
)[ event.type ] || [],
special = jQuery.event.special[ event.type ] || {};
// Use the fix-ed jQuery.Event rather than the (read-only) native event
@ -5512,12 +5513,12 @@ jQuery.event = {
get: isFunction( hook ) ?
function() {
if ( this.originalEvent ) {
return hook( this.originalEvent );
return hook( this.originalEvent );
}
} :
function() {
if ( this.originalEvent ) {
return this.originalEvent[ name ];
return this.originalEvent[ name ];
}
},
@ -5656,7 +5657,13 @@ function leverageNative( el, type, expectSync ) {
// Cancel the outer synthetic event
event.stopImmediatePropagation();
event.preventDefault();
return result.value;
// Support: Chrome 86+
// In Chrome, if an element having a focusout handler is blurred by
// clicking outside of it, it invokes the handler synchronously. If
// that handler calls `.remove()` on the element, the data is cleared,
// leaving `result` undefined. We need to guard against this.
return result && result.value;
}
// If this is an inner synthetic event for an event with a bubbling surrogate
@ -5821,34 +5828,7 @@ jQuery.each( {
targetTouches: true,
toElement: true,
touches: true,
which: function( event ) {
var button = event.button;
// Add which for key events
if ( event.which == null && rkeyEvent.test( event.type ) ) {
return event.charCode != null ? event.charCode : event.keyCode;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
if ( button & 1 ) {
return 1;
}
if ( button & 2 ) {
return 3;
}
if ( button & 4 ) {
return 2;
}
return 0;
}
return event.which;
}
which: true
}, jQuery.event.addProp );
jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
@ -5874,6 +5854,12 @@ jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateTyp
return true;
},
// Suppress native focus or blur as it's already being fired
// in leverageNative.
_default: function() {
return true;
},
delegateType: delegateType
};
} );
@ -6541,6 +6527,10 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
// set in CSS while `offset*` properties report correct values.
// Behavior in IE 9 is more subtle than in newer versions & it passes
// some versions of this test; make sure not to make it pass there!
//
// Support: Firefox 70+
// Only Firefox includes border widths
// in computed dimensions. (gh-4529)
reliableTrDimensions: function() {
var table, tr, trChild, trStyle;
if ( reliableTrDimensionsVal == null ) {
@ -6548,17 +6538,32 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
tr = document.createElement( "tr" );
trChild = document.createElement( "div" );
table.style.cssText = "position:absolute;left:-11111px";
table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
tr.style.cssText = "border:1px solid";
// Support: Chrome 86+
// Height set through cssText does not get applied.
// Computed height then comes back as 0.
tr.style.height = "1px";
trChild.style.height = "9px";
// Support: Android 8 Chrome 86+
// In our bodyBackground.html iframe,
// display for all div elements is set to "inline",
// which causes a problem only in Android 8 Chrome 86.
// Ensuring the div is display: block
// gets around this issue.
trChild.style.display = "block";
documentElement
.appendChild( table )
.appendChild( tr )
.appendChild( trChild );
trStyle = window.getComputedStyle( tr );
reliableTrDimensionsVal = parseInt( trStyle.height ) > 3;
reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) +
parseInt( trStyle.borderTopWidth, 10 ) +
parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight;
documentElement.removeChild( table );
}
@ -7022,10 +7027,10 @@ jQuery.each( [ "height", "width" ], function( _i, dimension ) {
// Running getBoundingClientRect on a disconnected node
// in IE throws an error.
( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
swap( elem, cssShow, function() {
return getWidthOrHeight( elem, dimension, extra );
} ) :
getWidthOrHeight( elem, dimension, extra );
swap( elem, cssShow, function() {
return getWidthOrHeight( elem, dimension, extra );
} ) :
getWidthOrHeight( elem, dimension, extra );
}
},
@ -7084,7 +7089,7 @@ jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
swap( elem, { marginLeft: 0 }, function() {
return elem.getBoundingClientRect().left;
} )
) + "px";
) + "px";
}
}
);
@ -7223,7 +7228,7 @@ Tween.propHooks = {
if ( jQuery.fx.step[ tween.prop ] ) {
jQuery.fx.step[ tween.prop ]( tween );
} else if ( tween.elem.nodeType === 1 && (
jQuery.cssHooks[ tween.prop ] ||
jQuery.cssHooks[ tween.prop ] ||
tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
} else {
@ -7468,7 +7473,7 @@ function defaultPrefilter( elem, props, opts ) {
anim.done( function() {
/* eslint-enable no-loop-func */
/* eslint-enable no-loop-func */
// The final step of a "hide" animation is actually hiding the element
if ( !hidden ) {
@ -7588,7 +7593,7 @@ function Animation( elem, properties, options ) {
tweens: [],
createTween: function( prop, end ) {
var tween = jQuery.Tween( elem, animation.opts, prop, end,
animation.opts.specialEasing[ prop ] || animation.opts.easing );
animation.opts.specialEasing[ prop ] || animation.opts.easing );
animation.tweens.push( tween );
return tween;
},
@ -7761,7 +7766,8 @@ jQuery.fn.extend( {
anim.stop( true );
}
};
doAnimation.finish = doAnimation;
doAnimation.finish = doAnimation;
return empty || optall.queue === false ?
this.each( doAnimation ) :
@ -8401,8 +8407,8 @@ jQuery.fn.extend( {
if ( this.setAttribute ) {
this.setAttribute( "class",
className || value === false ?
"" :
dataPriv.get( this, "__className__" ) || ""
"" :
dataPriv.get( this, "__className__" ) || ""
);
}
}
@ -8417,7 +8423,7 @@ jQuery.fn.extend( {
while ( ( elem = this[ i++ ] ) ) {
if ( elem.nodeType === 1 &&
( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
return true;
return true;
}
}
@ -8707,9 +8713,7 @@ jQuery.extend( jQuery.event, {
special.bindType || type;
// jQuery handler
handle = (
dataPriv.get( cur, "events" ) || Object.create( null )
)[ event.type ] &&
handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] &&
dataPriv.get( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
@ -8856,7 +8860,7 @@ var rquery = ( /\?/ );
// Cross-browser xml parsing
jQuery.parseXML = function( data ) {
var xml;
var xml, parserErrorElem;
if ( !data || typeof data !== "string" ) {
return null;
}
@ -8865,12 +8869,17 @@ jQuery.parseXML = function( data ) {
// IE throws on parseFromString with invalid input.
try {
xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
} catch ( e ) {
xml = undefined;
}
} catch ( e ) {}
if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
if ( !xml || parserErrorElem ) {
jQuery.error( "Invalid XML: " + (
parserErrorElem ?
jQuery.map( parserErrorElem.childNodes, function( el ) {
return el.textContent;
} ).join( "\n" ) :
data
) );
}
return xml;
};
@ -8971,16 +8980,14 @@ jQuery.fn.extend( {
// Can add propHook for "elements" to filter or add form elements
var elements = jQuery.prop( this, "elements" );
return elements ? jQuery.makeArray( elements ) : this;
} )
.filter( function() {
} ).filter( function() {
var type = this.type;
// Use .is( ":disabled" ) so that fieldset[disabled] works
return this.name && !jQuery( this ).is( ":disabled" ) &&
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
( this.checked || !rcheckableType.test( type ) );
} )
.map( function( _i, elem ) {
} ).map( function( _i, elem ) {
var val = jQuery( this ).val();
if ( val == null ) {
@ -9033,7 +9040,8 @@ var
// Anchor tag for parsing the document origin
originAnchor = document.createElement( "a" );
originAnchor.href = location.href;
originAnchor.href = location.href;
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
@ -9414,8 +9422,8 @@ jQuery.extend( {
// Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext = s.context &&
( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery( callbackContext ) :
jQuery.event,
jQuery( callbackContext ) :
jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
@ -9727,8 +9735,10 @@ jQuery.extend( {
response = ajaxHandleResponses( s, jqXHR, responses );
}
// Use a noop converter for missing script
if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) {
// Use a noop converter for missing script but not if jsonp
if ( !isSuccess &&
jQuery.inArray( "script", s.dataTypes ) > -1 &&
jQuery.inArray( "json", s.dataTypes ) < 0 ) {
s.converters[ "text script" ] = function() {};
}
@ -10466,12 +10476,6 @@ jQuery.offset = {
options.using.call( elem, props );
} else {
if ( typeof props.top === "number" ) {
props.top += "px";
}
if ( typeof props.left === "number" ) {
props.left += "px";
}
curElem.css( props );
}
}
@ -10640,8 +10644,11 @@ jQuery.each( [ "top", "left" ], function( _i, prop ) {
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
function( defaultExtra, funcName ) {
jQuery.each( {
padding: "inner" + name,
content: type,
"": "outer" + name
}, function( defaultExtra, funcName ) {
// Margin is only for outerHeight, outerWidth
jQuery.fn[ funcName ] = function( margin, value ) {
@ -10726,7 +10733,8 @@ jQuery.fn.extend( {
}
} );
jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
jQuery.each(
( "blur focus focusin focusout resize scroll click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup contextmenu" ).split( " " ),
function( _i, name ) {
@ -10737,7 +10745,8 @@ jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
this.on( name, null, data, fn ) :
this.trigger( name );
};
} );
}
);

File diff suppressed because one or more lines are too long

12
source/static/css/bulma.darkly.min.css vendored Normal file

File diff suppressed because one or more lines are too long

1
source/static/css/bulma.min.css vendored Normal file

File diff suppressed because one or more lines are too long

444
source/static/css/main.css Normal file
View File

@ -0,0 +1,444 @@
/* BASE */
:root {
--color-primary: #375a7f;
--color-background: #343c3d;
--plyr-color-main: var(--color-primary) !important;
}
#nav {
z-index: 101;
}
#nav.is-fixed-top {
position: sticky;
top: -1px;
}
#menu.force-display {
display: flex !important;
}
.navbar-item img {
width: 100%;
}
/* Cada flecha en los títulos de secciones */
.arrows {
font-size: 1.5rem;
}
.arrows:before {
content: " ";
}
/* HOME */
/* Cada sección de pelis */
.hero-cartels {
margin-bottom: 0;
padding-bottom: 0;
}
.cartels {
clear: both;
width: calc(100% + 3rem);
margin-left: -1.5rem !important;
padding-left: 0;
display: grid;
align-items: center;
grid-template-columns: repeat(1, 1fr);
}
@media screen and (min-width: 300px) {
.cartels {
grid-template-columns: repeat(2, 1fr);
}
}
@media screen and (min-width: 450px) {
.cartels {
grid-template-columns: repeat(3, 1fr);
}
}
@media screen and (min-width: 600px) {
.cartels {
grid-template-columns: repeat(4, 1fr);
}
}
@media screen and (min-width: 750px) {
.cartels {
grid-template-columns: repeat(5, 1fr);
}
}
@media screen and (min-width: 900px) {
.cartels {
grid-template-columns: repeat(6, 1fr);
}
}
@media screen and (min-width: 1920px) {
.cartels {
width: auto;
margin: 0 !important;
grid-template-columns: repeat(6, 1fr);
}
}
/* Cada peli */
.cartel {
position: relative;
float: left;
min-width: 150px;
min-height: 225px;
max-width: 300px;
max-height: 450px;
}
.cartel img {
object-fit: cover;
}
.cartel .info {
display: none;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 102;
}
/* HOME / MOVIE */
/* Cada ficha de peli */
.movie-head {
padding: 2rem 2rem 0 2rem !important;
}
.movie-body {
padding: 2rem !important;
}
.full .movie-body {
padding: 0 2rem !important;
line-height: 2;
}
.movie-body video {
display: block;
height: 100%;
width: auto;
margin: auto;
}
.info {
background-color: var(--color-background);
}
.info .full {
height: 100%;
min-height: 100%;
}
.stats span {
padding-right: 2rem;
white-space: nowrap;
}
.stats i {
display: inline-block;
margin-right: .5rem;
}
.stats i.gg-time {
font-size: 1rem;
}
.stars {
font-size: 1.5rem;
}
.about {
max-width: 70rem;
margin: auto;
margin-bottom: 2rem;
}
.about p + p {
margin-top: 1rem;
}
.about *:not(h2) + h2 {
margin-top: 1.5rem;
}
.infobox td:first-child {
text-align: right;
width: 8rem;
}
.extra-info {
position: absolute;
bottom: 0;
width: 100%;
background-color: var(--color-primary);
overflow: hidden;
}
.about figure {
width: 50%;
height: auto;
max-width: 300px;
max-height: 450px;
margin: auto;
}
@media screen and (max-width: 1024px) {
table {
margin: auto;
}
}
/* Despliegue de la ficha; Cfr:
* https://stackoverflow.com/questions/42177216/manipulate-css-class-without-javascript
* https://stackoverflow.com/questions/55858255/custom-checkbox-with-css-before-not-working-in-firefox-edge
*/
.toggle:checked ~ .info {
display: block;
}
.toggle {
position: absolute;
z-index: 100;
width: 100%;
height: 100%;
opacity: 0;
cursor: pointer;
}
.toggle:checked {
display: block;
z-index: 103;
position: absolute;
top: 0;
right: 0;
width: 100%;
height: calc(100% - 3em);
}
/* Tooltip de la ficha; Cfr:
* https://www.w3schools.com/howto/howto_css_tooltip.asp
*/
/* Tooltip container */
.tooltip {
position: relative;
}
/* Tooltip text */
.tooltip .tooltiptext {
visibility: hidden;
opacity: 0;
width: 100%;
background-color: var(--color-background);
color: #fff;
border-top: 3px solid var(--color-primary);
text-align: center;
font-size: 1.25rem;
padding: .5em;
position: absolute;
z-index: 1;
top: 0;
left: 0;
transition: opacity 0.3s;
}
/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
visibility: visible;
opacity: 1;
}
/* Reproductor */
button.plyr__control--overlaid {
opacity: 1;
}
section#notice {
position: absolute;
width: 100%;
z-index: 3;
}
section#notice div {
padding: 1rem;
}
section#notice p {
font-weight: bold;
color: white;
line-height: 1.5;
}
section#notice a {
display: block;
width: fit-content;
margin: auto;
}
/* SEARCH */
.search-div > * {
display: inline-block;
}
.search-div input {
width: calc(100% - 4.1rem);
}
.search-div button {
width: 3.8rem;
height: 3.8rem;
}
/* ICONS; cfr: https://css.gg */
.gg-time {
box-sizing: border-box;
position: relative;
display: block;
transform: scale(var(--ggs,1));
width: 14px;
height: 14px;
border-radius: 100%;
border: 2px solid transparent;
box-shadow: 0 0 0 2px currentColor;
}
.gg-time::after {
content: "";
display: block;
box-sizing: border-box;
position: absolute;
width: 6px;
height: 6px;
border-left: 2px solid;
border-bottom: 2px solid;
top: 0;
left: 4px;
}
.gg-software-download {
box-sizing: border-box;
position: relative;
display: block;
transform: scale(var(--ggs,1));
width: 16px;
height: 6px;
border: 2px solid;
border-top: 0;
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
margin-top: 8px
}
.gg-software-download::after {
content: "";
display: block;
box-sizing: border-box;
position: absolute;
width: 8px;
height: 8px;
border-left: 2px solid;
border-bottom: 2px solid;
transform: rotate(-45deg);
left: 2px;
bottom: 4px
}
.gg-software-download::before {
content: "";
display: block;
box-sizing: border-box;
position: absolute;
border-radius: 3px;
width: 2px;
height: 10px;
background: currentColor;
left: 5px;
bottom: 5px
}
.gg-link {
box-sizing: border-box;
position: relative;
display: block;
transform: rotate(-45deg) scale(var(--ggs,1));
width: 8px;
height: 2px;
background: currentColor;
border-radius: 4px
}
.gg-link::after,
.gg-link::before {
content: "";
display: block;
box-sizing: border-box;
position: absolute;
border-radius: 3px;
width: 8px;
height: 10px;
border: 2px solid;
top: -4px
}
.gg-link::before {
border-right: 0;
border-top-left-radius: 40px;
border-bottom-left-radius: 40px;
left: -6px
}
.gg-link::after {
border-left: 0;
border-top-right-radius: 40px;
border-bottom-right-radius: 40px;
right: -6px
}
.gg-search {
box-sizing: border-box;
position: relative;
display: block;
transform: scale(var(--ggs,1));
width: 16px;
height: 16px;
border: 2px solid;
border-radius: 100%;
margin-left: -4px;
margin-top: -4px
}
.gg-search::after {
content: "";
display: block;
box-sizing: border-box;
position: absolute;
border-radius: 3px;
width: 2px;
height: 8px;
background: currentColor;
transform: rotate(-45deg);
top: 10px;
left: 12px
}

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="512"
height="512"
viewBox="0 0 135.46666 135.46666"
version="1.1"
id="svg8"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
sodipodi:docname="favicon.svg"
inkscape:export-filename="favicon.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs2">
<rect
x="127.8628"
y="131.33685"
width="44.228352"
height="64.944321"
id="rect971" />
<rect
x="214.46635"
y="79.221107"
width="123.64536"
height="102.02128"
id="rect957" />
<rect
x="214.46635"
y="79.221107"
width="123.64536"
height="102.02128"
id="rect1119" />
<rect
x="214.46635"
y="79.221107"
width="123.64536"
height="102.02128"
id="rect1159" />
<rect
x="214.46635"
y="79.221107"
width="123.64536"
height="102.02128"
id="rect1213" />
<rect
x="214.46635"
y="79.221107"
width="123.64536"
height="102.02128"
id="rect1166" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#375a7f"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="0.38532642"
inkscape:cx="-120.67691"
inkscape:cy="-124.56971"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
showguides="true"
inkscape:guide-bbox="true"
inkscape:showpageshadow="2"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Capa 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="rect2398"
style="opacity:1"
transform="translate(0.01602397)" />
<g
id="rect2400"
style="opacity:1"
transform="translate(0.01602397)" />
<g
id="rect2402"
style="opacity:1"
transform="translate(0.01602397)" />
<g
id="rect2404"
style="opacity:1" />
<g
id="rect2406"
style="opacity:1" />
<g
id="rect2408"
style="opacity:1" />
<text
xml:space="preserve"
id="text969"
style="font-size:10.5833px;line-height:1;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;white-space:pre;shape-inside:url(#rect971);display:inline" />
<path
id="path1541"
style="fill:#ffffff;stroke-width:0.332183"
d="M 0.09001667,21.743483 V 96.133805 H 23.957074 v 3.321382 H 0.09001667 v 2.315573 H 23.957074 v 3.32143 H 0.08764702 c -0.0010022,0.79886 -0.01360684,1.27101 -0.02280029,2.27787 H 23.957843 v 1.93632 1.38511 H 0.031897 c -0.01359326,1.02732 -0.031898666667,3.03169 -0.031898666667,3.03169 L 30.611198,113.67122 H 63.749981 L 53.352288,100.57164 h 28.257975 l -10.732186,13.09959 h 33.737113 l 30.85148,-0.047 c 0,0 -9.7e-4,-1.95701 -0.003,-2.93278 H 111.5898 v -2.17185 -1.14953 h 23.86948 c -0.001,-1.0085 -0.003,-1.54115 -0.003,-2.27792 h -23.86679 v -2.17422 -1.14716 h 23.85768 l -0.01,-2.315573 h -23.84954 v -2.171896 -1.149536 h 23.84116 L 135.21275,21.743483 90.171052,52.752817 h -0.124906 c -6.977213,-2.430397 -14.470662,-3.754838 -22.27472,-3.754838 -7.798681,0 -15.288346,1.323621 -22.260545,3.750098 h -0.141319 z"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="377.03391"
height="256"
viewBox="0 0 99.756886 67.733332"
version="1.1"
id="svg8"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
sodipodi:docname="logo.svg"
inkscape:export-filename="favicon.png"
inkscape:export-xdpi="130.36493"
inkscape:export-ydpi="130.36493"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs2">
<rect
x="127.8628"
y="131.33685"
width="44.228352"
height="64.944321"
id="rect971" />
<rect
x="214.46635"
y="79.221107"
width="123.64536"
height="102.02128"
id="rect957" />
<rect
x="214.46635"
y="79.221107"
width="123.64536"
height="102.02128"
id="rect1119" />
<rect
x="214.46635"
y="79.221107"
width="123.64536"
height="102.02128"
id="rect1159" />
<rect
x="214.46635"
y="79.221107"
width="123.64536"
height="102.02128"
id="rect1213" />
<rect
x="214.46635"
y="79.221107"
width="123.64536"
height="102.02128"
id="rect1166" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#375a7f"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="0.38532642"
inkscape:cx="-120.67691"
inkscape:cy="-124.56971"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
showguides="true"
inkscape:guide-bbox="true"
inkscape:showpageshadow="2"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Capa 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="rect2398"
style="opacity:1"
transform="translate(0.01602397)" />
<g
id="rect2400"
style="opacity:1"
transform="translate(0.01602397)" />
<g
id="rect2402"
style="opacity:1"
transform="translate(0.01602397)" />
<g
id="rect2404"
style="opacity:1" />
<g
id="rect2406"
style="opacity:1" />
<g
id="rect2408"
style="opacity:1" />
<text
xml:space="preserve"
id="text969"
style="font-size:10.5833px;line-height:1;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;white-space:pre;shape-inside:url(#rect971);display:inline" />
<path
id="path1541"
style="fill:#ffffff;stroke-width:0.244618"
d="m 0.066289,0 v 54.780614 h 17.575567 v 2.445847 H 0.066289 v 1.705175 h 17.575567 v 2.44588 H 0.064544 c -7.38e-4,0.588275 -0.01002,0.935969 -0.01679,1.677414 h 17.594668 v 1.425891 1.019988 H 0.02349 C 0.01348,66.257327 0,67.733333 0,67.733333 l 22.541915,-0.03826 H 46.945128 L 39.288326,58.04861 h 20.809013 l -7.903121,9.646463 H 77.03804 l 22.71885,-0.03458 c 0,0 -7.1e-4,-1.441129 -0.002,-2.159681 H 82.174101 V 63.901477 63.054966 H 99.75145 c -7.4e-4,-0.742653 -0.002,-1.134892 -0.002,-1.677447 H 82.173871 V 59.776437 58.931672 H 99.74253 l -0.007,-1.705174 H 82.172861 V 55.627126 54.780614 H 99.72936 L 99.56991,0 66.401456,22.835099 h -0.09198 c -5.13798,-1.789731 -10.656114,-2.765042 -16.402978,-2.765042 -5.742905,0 -11.258252,0.974707 -16.39254,2.761551 h -0.104067 z"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

19
source/static/js/main.js Normal file
View File

@ -0,0 +1,19 @@
document.addEventListener('DOMContentLoaded', () => {
modMenu();
});
// Habilita el menú de hamburguesa y que esté fijo
function modMenu() {
document.getElementById('nav').classList.add('is-fixed-top');
document.getElementById('menu').classList.remove('force-display');
// Cfr: https://bulma.io/documentation/components/navbar/#navbar-burger
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
$navbarBurgers.forEach( el => {
el.addEventListener('click', () => {
const target = el.dataset.target;
const $target = document.getElementById(target);
el.classList.toggle('is-active');
$target.classList.toggle('is-active');
});
});
}

View File

@ -0,0 +1,49 @@
// Deshabilita scroll con la tecla de espacio
// Esto es para que en 'player' quede habilitado para reproducción
window.addEventListener('keydown', (e) => {
if (e.keyCode === 32 && e.target === document.body) {
e.preventDefault();
}
});
// Añade un aviso
function add_notice () {
const divs = document.querySelectorAll('.plyr');
// Ejecuta de nuevo hasta que esté implementado el reproductor
if (divs.length == 0) {
setTimeout(add_notice, 500);
} else {
let hero_sec = document.createElement('section'),
hero_div = document.createElement('div'),
hero_tit = document.createElement('p'),
hero_btn = document.createElement('a');
hero_sec.id = 'notice';
hero_sec.classList.add('hero', 'is-small', 'is-warning', 'has-text-centered');
hero_div.classList.add('hero-body');
hero_btn.classList.add('button', 'is-small', 'is-success');
hero_btn.addEventListener('click', remove_notice);  
hero_tit.innerText = 'Mauflix funciona con pocos recursos. Para un uso más eficiente y ecológico te recomendamos descargar la película.';
hero_btn.innerText = '¡Entendido!';
hero_tit.appendChild(hero_btn);
hero_div.appendChild(hero_tit);
hero_sec.appendChild(hero_div);
divs[0].appendChild(hero_sec);
}
}
// Elimina aviso
function remove_notice () {
let notice = document.querySelector('#notice');
console.log('notice', notice)
if (notice !== null) {
notice.parentNode.removeChild(notice);
}
}
// Implementa el reproductor
const player = new Plyr('#player', {
keyboard: { focused: true, global: true },
controls: ['play-large', 'play', 'progress', 'current-time', 'mute',
'volume', 'pip', 'airplay', 'download', 'fullscreen'],
listeners: { seek: add_notice() },
});

1
source/static/js/plyr.js Normal file

File diff suppressed because one or more lines are too long