initial commit
This commit is contained in:
		
							
								
								
									
										17
									
								
								appinfo/info.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								appinfo/info.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
<?xml version="1.0"?>
 | 
			
		||||
<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
 | 
			
		||||
      xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
 | 
			
		||||
    <id>pride</id>
 | 
			
		||||
    <name>Pride</name>
 | 
			
		||||
    <summary>Add pride flags to your nextcloud</summary>
 | 
			
		||||
    <description><![CDATA[Diversity and inclusion are what makes the world worth living in! Let's show some pride!]]></description>
 | 
			
		||||
    <version>0.1.0</version>
 | 
			
		||||
    <licence>cnvpl</licence>
 | 
			
		||||
    <author mail="" homepage="https://github.com/finallycoffee/nextcloud-pride"></author>
 | 
			
		||||
    <namespace>Pride</namespace>
 | 
			
		||||
    <category>customization</category>
 | 
			
		||||
    <bugs>https://github.com/finallycoffee/nextcloud-pride/issues</bugs>
 | 
			
		||||
    <dependencies>
 | 
			
		||||
        <nextcloud min-version="26" max-version="28"/>
 | 
			
		||||
    </dependencies>
 | 
			
		||||
</info>
 | 
			
		||||
							
								
								
									
										3
									
								
								css/pride.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								css/pride.css
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
.files-list__row-icon .folder-icon svg {
 | 
			
		||||
	fill: url("#gradient-pride");
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										66
									
								
								js/pride.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								js/pride.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,66 @@
 | 
			
		||||
const flags = [
 | 
			
		||||
	{
 | 
			
		||||
		id: 'pride',
 | 
			
		||||
		colors: ['#E04641', '#DE7E41', '#E4D56F', '#55B85F', '#2473B5', '#6F5DA5'],
 | 
			
		||||
		transform: 'rotate(90)'
 | 
			
		||||
	}, {
 | 
			
		||||
		id: 'trans',
 | 
			
		||||
		colors: ['#55CDFC', '#F7A8B8', '#FFFFFF', '#F7A8B8', '#55CDFC'],
 | 
			
		||||
		transform: 'rotate(90)'
 | 
			
		||||
	}
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
const generateGradient = colors => {
 | 
			
		||||
	const steps = colors.length;
 | 
			
		||||
	return colors.map((color, index) => { return [
 | 
			
		||||
		[color, (index / steps)],
 | 
			
		||||
		[color, (index + 1) / steps]
 | 
			
		||||
	]}).flat();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const generateStops = (colors, opacity) => {
 | 
			
		||||
	return generateGradient(colors).map(([color, offset]) => {
 | 
			
		||||
		return `<stop stop-color="${color}" stop-opacity="${opacity}" offset="${offset * 100}%"></stop>`;
 | 
			
		||||
	});
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const makeLinearGradientSvg = (id, colors, opacity, transform) => {
 | 
			
		||||
	return `<svg xmlns="http://www.w3.org/2000/svg" id="svg-${id}" preserveAspectRatio="none" width="100%" height="100%">
 | 
			
		||||
		  <defs>
 | 
			
		||||
		    <linearGradient id="gradient-${id}" gradientTransform="${transform}">
 | 
			
		||||
		      ${generateStops(colors, opacity).join('\n')}
 | 
			
		||||
		    </linearGradient>
 | 
			
		||||
		  </defs>
 | 
			
		||||
		  <style>
 | 
			
		||||
		    rect { height: 100%; width: 100%; }
 | 
			
		||||
		  </style>
 | 
			
		||||
		  <rect fill="url(#gradient-${id})" width="100%" height="100%" />
 | 
			
		||||
		</svg>`;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
flags.forEach(flag => {
 | 
			
		||||
	const svg_html = makeLinearGradientSvg(flag.id, flag.colors, flag.opacity ?? '0.8', flag.transform ?? 'rotate(0)');
 | 
			
		||||
	const container = document.createElement('div');
 | 
			
		||||
	container.classList.add('hidden-visually');
 | 
			
		||||
	container.ariaHidden = true;
 | 
			
		||||
	container.innerHTML = svg_html;
 | 
			
		||||
	const style_c = document.createElement('style');
 | 
			
		||||
	style_c.textContent = `
 | 
			
		||||
	body {
 | 
			
		||||
		--image-background-pride-${flag.id}: url('data:image/svg+xml;base64,${btoa(svg_html)}');
 | 
			
		||||
	}
 | 
			
		||||
	.preview-card__header,
 | 
			
		||||
	.profile__primary-action-button,
 | 
			
		||||
	.app-navigation-entry.active {
 | 
			
		||||
		background-image: var(--image-background-pride-trans);
 | 
			
		||||
	}
 | 
			
		||||
	#app-navigation .active,
 | 
			
		||||
	.button-vue--vue-primary,
 | 
			
		||||
	.material-design-icon__svg,
 | 
			
		||||
	.checkbox-radio-switch svg {
 | 
			
		||||
		fill: url(#gradient-trans);
 | 
			
		||||
	}
 | 
			
		||||
	`;
 | 
			
		||||
	document.body.prepend(container);
 | 
			
		||||
	document.head.prepend(style_c);
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										27
									
								
								lib/AppInfo/Application.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								lib/AppInfo/Application.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
<?php
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
namespace OCA\Pride\AppInfo;
 | 
			
		||||
 | 
			
		||||
use OCP\Util;
 | 
			
		||||
use OCP\AppFramework\App;
 | 
			
		||||
use OCP\AppFramework\Bootstrap\IBootContext;
 | 
			
		||||
use OCP\AppFramework\Bootstrap\IBootstrap;
 | 
			
		||||
use OCP\AppFramework\Bootstrap\IRegistrationContext;
 | 
			
		||||
use OCP\IConfig;
 | 
			
		||||
 | 
			
		||||
class Application extends App implements IBootstrap {
 | 
			
		||||
	const APP_ID = 'pride';
 | 
			
		||||
	public function __construct(array $urlParams = []) {
 | 
			
		||||
		parent::__construct(self::APP_ID, $urlParams);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function register(IRegistrationContext $ctx): void {
 | 
			
		||||
		$config = \OC::$server->get(IConfig::class);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function boot(IBootContext $ctx): void {
 | 
			
		||||
		Util::addStyle(self::APP_ID, 'pride');
 | 
			
		||||
		Util::addScript(self::APP_ID, 'pride');
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user