Merge "Update jquery.uls and adapt styling"

This commit is contained in:
jenkins-bot
2016-05-23 11:09:01 +00:00
committed by Gerrit Code Review
18 changed files with 148 additions and 100 deletions

View File

@@ -331,7 +331,6 @@
"remoteExtPath": "UniversalLanguageSelector/lib" "remoteExtPath": "UniversalLanguageSelector/lib"
}, },
"jquery.uls.compact": { "jquery.uls.compact": {
"styles": "jquery.uls/css/jquery.uls.compact.css",
"dependencies": "jquery.uls", "dependencies": "jquery.uls",
"localBasePath": "lib", "localBasePath": "lib",
"remoteExtPath": "UniversalLanguageSelector/lib" "remoteExtPath": "UniversalLanguageSelector/lib"

View File

@@ -1,3 +1,4 @@
.uls-trigger { .uls-trigger {
/* @embed */ /* @embed */
background: transparent url('../images/icon-language.png') no-repeat scroll left center; background: transparent url('../images/icon-language.png') no-repeat scroll left center;
@@ -7,6 +8,7 @@
background-image: linear-gradient(transparent, transparent), url('../images/icon-language.svg'); background-image: linear-gradient(transparent, transparent), url('../images/icon-language.svg');
padding-left: 30px; padding-left: 30px;
} }
.uls-menu { .uls-menu {
position: absolute; position: absolute;
z-index: 1000; z-index: 1000;
@@ -16,7 +18,6 @@
background-color: #ffffff; background-color: #ffffff;
border: 1px solid #ccc; border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.2); border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 5px;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
@@ -24,6 +25,7 @@
-moz-background-clip: padding; -moz-background-clip: padding;
background-clip: padding-box; background-clip: padding-box;
} }
.uls-wide { .uls-wide {
min-width: 715px; min-width: 715px;
width: 45%; width: 45%;
@@ -104,30 +106,9 @@ div.uls-region {
width: 99%; width: 99%;
} }
.uls-icon-close {
/* @embed */
background: transparent url('../images/close.png') no-repeat scroll center center;
/* @embed */
background-image: -webkit-linear-gradient(transparent, transparent), url('../images/close.svg');
/* @embed */
background-image: linear-gradient(transparent, transparent), url('../images/close.svg');
float: right;
padding: 15px;
cursor: pointer;
}
.uls-search { .uls-search {
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#F0F0F0', endColorstr='#FBFBFB'); background-color: white;
background: #f8f8f8; padding: 5px;
background: -webkit-gradient(linear, left top, left bottom, from(#F0F0F0), to(#FBFBFB));
background: -webkit-linear-gradient(top, #F0F0F0, #FBFBFB);
background: -moz-linear-gradient(top, #F0F0F0, #FBFBFB);
background: -o-linear-gradient(top, #F0F0F0, #FBFBFB);
background: linear-gradient(#F0F0F0, #FBFBFB);
border-top-color: #AAA;
border-top-style: solid;
border-top-width: 1px;
padding: 0.8em 0;
border-bottom-width: 1px; border-bottom-width: 1px;
border-bottom-style: solid; border-bottom-style: solid;
border-bottom-color: #DDD; border-bottom-color: #DDD;
@@ -161,12 +142,14 @@ div.uls-region {
/* There are two input boxes. This class applies to both of them */ /* There are two input boxes. This class applies to both of them */
.uls-filterinput { .uls-filterinput {
font-size: 14px; font-size: 18px;
height: 32px; height: 32px;
width: 100%; width: 100%;
/* For the custom clear (X) icon */ /* For the custom clear (X) icon */
padding: 6px 25px 6px 6px; padding: 6px 25px 6px 6px;
border-width: 1px;
outline: none;
border: none;
display: block; display: block;
position: absolute; position: absolute;
@@ -177,26 +160,14 @@ div.uls-region {
/* This is the actual input */ /* This is the actual input */
.uls-languagefilter { .uls-languagefilter {
background-color: transparent; background-color: transparent;
border: 1px solid #c9c9c9; border: none;
border-radius: 2px 2px 2px 2px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) inset;
color: #333; color: #333;
-moz-transition: border 0.15s linear 0s;
-o-transition: border 0.15s linear 0s;
-webkit-transition: border 0.15s linear 0s;
transition: border 0.15s linear 0s;
}
.uls-languagefilter:focus {
border: 1px solid #3366bb;
} }
/* This is the shadow input box showing completion suggestions */ /* This is the shadow input box showing completion suggestions */
.uls-filtersuggestion { .uls-filtersuggestion {
background-color: white; background-color: white;
color: #888; color: #888;
border-radius: 2px 2px 2px 2px;
box-shadow: 0 1px 2px transparent inset;
} }
.uls-languagefilter-clear { .uls-languagefilter-clear {

View File

@@ -8,9 +8,10 @@
/* Language list */ /* Language list */
.uls-language-list { .uls-language-list {
height: 17em; height: 20em;
overflow: auto; overflow: auto;
width: auto; width: auto;
background: #FCFCFC;
} }
.uls-language-block ul { .uls-language-block ul {

View File

@@ -5,7 +5,6 @@
"locale": "en", "locale": "en",
"message-documentation": "qqq" "message-documentation": "qqq"
}, },
"uls-select-language": "Select language",
"uls-region-WW": "Worldwide", "uls-region-WW": "Worldwide",
"uls-region-SP": "Special", "uls-region-SP": "Special",
"uls-region-AM": "America", "uls-region-AM": "America",

View File

@@ -6,7 +6,6 @@
"Shirayuki" "Shirayuki"
] ]
}, },
"uls-select-language": "Language Selector Title.\n{{Identical|Select language}}",
"uls-region-WW": "Label for worldwide languages. They are languages spoken in multiple countries. Eg: English, French, Spanish etc. This label is used in the map region of ULS and as the title of section showing worldwide languages. Translation should not be descriptive.", "uls-region-WW": "Label for worldwide languages. They are languages spoken in multiple countries. Eg: English, French, Spanish etc. This label is used in the map region of ULS and as the title of section showing worldwide languages. Translation should not be descriptive.",
"uls-region-SP": "Label for the special languages section. This section may include special custom languages that can be added in run time. It's shown after the Worldwide section.\n\nThe special language is everything that isn't a real language. Like code qqq or qqx.\n{{Identical|Special}}", "uls-region-SP": "Label for the special languages section. This section may include special custom languages that can be added in run time. It's shown after the Worldwide section.\n\nThe special language is everything that isn't a real language. Like code qqq or qqx.\n{{Identical|Special}}",
"uls-region-AM": "Label for America", "uls-region-AM": "Label for America",

View File

@@ -26,12 +26,6 @@
// Region numbers in id attributes also appear in the langdb. // Region numbers in id attributes also appear in the langdb.
/*jshint multistr:true */ /*jshint multistr:true */
template = '<div class="grid uls-menu"> \ template = '<div class="grid uls-menu"> \
<div class="row"> \
<span id="uls-close" class="uls-icon-close"></span> \
<div class="uls-title-region seven columns">\
<h1 data-i18n="uls-select-language" class="uls-title">Select Language</h1>\
</div>\
</div>\
<div id="search" class="row uls-search"> \ <div id="search" class="row uls-search"> \
<div class="uls-search-wrapper"> \ <div class="uls-search-wrapper"> \
<label class="uls-search-label" for="uls-languagefilter"></label>\ <label class="uls-search-label" for="uls-languagefilter"></label>\
@@ -165,10 +159,6 @@
this.$menu.addClass( widthClasses[this.getMenuWidth()] ); this.$menu.addClass( widthClasses[this.getMenuWidth()] );
this.$menu.css( this.position() ); this.$menu.css( this.position() );
if ( this.options.compact ) {
this.$menu.addClass( 'uls-compact' );
}
if ( !this.initialized ) { if ( !this.initialized ) {
$( 'body' ).prepend( this.$menu ); $( 'body' ).prepend( this.$menu );
this.i18n(); this.i18n();
@@ -239,8 +229,6 @@
// Register all event listeners to the ULS here. // Register all event listeners to the ULS here.
this.$element.on( 'click', $.proxy( this.click, this ) ); this.$element.on( 'click', $.proxy( this.click, this ) );
// Close when clicking on the close button
this.$menu.find( '#uls-close' ).on( 'click', $.proxy( this.cancel, this ) );
// Don't do anything if pressing on empty space in the ULS // Don't do anything if pressing on empty space in the ULS
this.$menu.on( 'click', function ( e ) { this.$menu.on( 'click', function ( e ) {
e.stopPropagation(); e.stopPropagation();
@@ -424,7 +412,6 @@
searchAPI: null, // Language search API searchAPI: null, // Language search API
languages: $.uls.data.getAutonyms(), // Languages to be used for ULS, default is all languages languages: $.uls.data.getAutonyms(), // Languages to be used for ULS, default is all languages
quickList: null, // Array of language codes or function that returns such quickList: null, // Array of language codes or function that returns such
compact: false, // Show ULS in compact mode
// The options are wide (4 columns), medium (2 columns), and narrow (1 column). // The options are wide (4 columns), medium (2 columns), and narrow (1 column).
// If not specified, it will be set automatically. // If not specified, it will be set automatically.
menuWidth: null, menuWidth: null,

View File

@@ -1,25 +1,43 @@
/* Overrides to follow MediaWiki style */
.uls-menu {
border-radius: 4px;
}
.uls-search,
.uls-language-settings-close-block {
border-top-right-radius: 4px;
border-top-left-radius: 4px;
}
.uls-language-list {
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
}
.uls-menu a { .uls-menu a {
cursor: pointer; cursor: pointer;
} }
.uls-menu.callout .caret-before { .uls-menu.callout .caret-before,
border-top: 20px solid transparent; .uls-menu.callout .caret-after {
border-right: 20px solid #C9C9C9; border-top: 10px solid transparent;
border-bottom: 20px solid transparent; border-right: 10px solid #C9C9C9;
border-bottom: 10px solid transparent;
display: inline-block; display: inline-block;
left: -21px; left: -11px;
top: 30px; /* 17px aligns nicely with the size of the search row in language selection */
top: 17px;
position: absolute; position: absolute;
} }
.uls-menu.callout .caret-after { .uls-menu.callout .caret-after {
border-top: 20px solid transparent; border-right: 10px solid #FCFCFC;
border-right: 20px solid #FCFCFC;
border-bottom: 20px solid transparent;
display: inline-block; display: inline-block;
left: -20px; left: -10px;
top: 30px; }
position: absolute;
.uls-menu.callout--languageselection .caret-after {
border-right: 10px solid #FFF;
} }
.uls-ui-languages button { .uls-ui-languages button {
@@ -47,3 +65,47 @@ button.uls-more-languages {
div.display-settings-block:hover .settings-text { div.display-settings-block:hover .settings-text {
color: #252525; color: #252525;
} }
.uls-search-wrapper-wrapper {
position: relative;
padding-left: 40px;
margin-top: 5px;
margin-bottom: 5px;
}
.uls-icon-back {
background: transparent url('../images/back-grey-ltr.png') no-repeat scroll center center;
background-image: -webkit-linear-gradient(transparent, transparent), url('../images/back-grey-ltr.svg');
/* @embed */
background-image: linear-gradient(transparent, transparent), url('../images/back-grey-ltr.svg');
background-size: 28px;
background-position: center center;
height: 32px;
width: 40px;
display: block;
position: absolute;
left: 0;
border-right: 1px solid #C9C9C9;
opacity: 0.8;
}
.uls-icon-back:hover {
opacity: 1;
cursor: pointer;
}
/* TODO: move to jquery.uls */
.grid .uls-search {
padding-left: 0px;
}
.uls-search-label {
background-size: 28px;
opacity: 0.8;
}
.uls-filterinput {
padding-left: 0px;
}

View File

@@ -63,11 +63,6 @@
font-size: 12pt; font-size: 12pt;
} }
#languagesettings-settings-panel h5 {
color: #252525;
font-size: 10pt;
}
/* Buttons in the selector panel */ /* Buttons in the selector panel */
.menu-section { .menu-section {
color: #777; color: #777;
@@ -83,7 +78,6 @@
.uls-language-settings-close-block { .uls-language-settings-close-block {
background: #FFFFFF; background: #FFFFFF;
border-top-right-radius: 5px;
} }
#languagesettings-panels .menu-section.active, #languagesettings-panels .menu-section.active,
@@ -140,3 +134,13 @@ label.checkbox input[type="checkbox"] {
.waiting { .waiting {
cursor: progress; cursor: progress;
} }
.uls-icon-close {
background: transparent url('../images/close.png') no-repeat scroll center center;
background-image: -webkit-linear-gradient(transparent, transparent), url('../images/close.svg');
/* @embed */
background-image: linear-gradient(transparent, transparent), url('../images/close.svg');
float: right;
padding: 15px;
cursor: pointer;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="Layer_1">
<path d="M7 13.1l8.9 8.9c.8-.8.8-2 0-2.8l-6.1-6.1 6-6.1c.8-.8.8-2 0-2.8L7 13.1z" id="path3" fill="#555"/>
</svg>

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="Layer_1">
<path d="M7 4c-.8.8-.8 2.2 0 3l6 6-6 6c-.8.8-.8 2.2 0 3l9-9-9-9z" id="path3" fill="#555"/>
</svg>

After

Width:  |  Height:  |  Size: 231 B

BIN
resources/images/close.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="13.592" height="13.592"><g transform="translate(-578.659 -309.301)" fill="#555"><rect width="3.204" height="16.018" x="188.862" y="629.484" transform="rotate(-45)"/><rect width="3.204" height="16.018" x="-639.095" y="182.455" transform="matrix(-.707 -.707 .707 -.707 0 0)"/></g></svg>

After

Width:  |  Height:  |  Size: 369 B

View File

@@ -172,8 +172,6 @@
onCancel: function () { onCancel: function () {
$trigger.removeClass( 'selector-open' ); $trigger.removeClass( 'selector-open' );
}, },
// Use compact version of ULS
compact: true,
languages: ulsLanguageList, languages: ulsLanguageList,
// Show common languages // Show common languages
quickList: self.getCommonLanguages( languages ) quickList: self.getCommonLanguages( languages )

View File

@@ -300,20 +300,22 @@
left: displaySettings.$parent.left, left: displaySettings.$parent.left,
top: displaySettings.$parent.top, top: displaySettings.$parent.top,
onReady: function () { onReady: function () {
var uls = this, var $wrap,
$back = $( '<a>' ) uls = this,
.data( 'i18n', 'ext-uls-back-to-display-settings' ) $back = $( '<div>' )
.i18n(); .addClass( 'uls-icon-back' );
$back.click( function () { $back.click( function () {
uls.hide(); uls.hide();
displaySettings.$parent.show(); displaySettings.$parent.show();
} ); } );
uls.$menu.find( 'div.uls-title-region' ).append( $back ); $wrap = $( '<div>' )
uls.$menu.find( 'h1.uls-title' ) .addClass( 'uls-search-wrapper-wrapper' );
.data( 'i18n', 'ext-uls-display-settings-ui-language' )
.i18n(); uls.$menu.find( '.uls-search-wrapper' ).wrap( $wrap );
uls.$menu.find( '.uls-search-wrapper-wrapper' ).prepend( $back );
uls.$menu.prepend( uls.$menu.prepend(
$( '<span>' ).addClass( 'caret-before' ), $( '<span>' ).addClass( 'caret-before' ),
$( '<span>' ).addClass( 'caret-after' ) $( '<span>' ).addClass( 'caret-after' )
@@ -322,6 +324,9 @@
onVisible: function () { onVisible: function () {
var $parent; var $parent;
this.$menu.find( '.uls-languagefilter' )
.prop( 'placeholder', $.i18n( 'ext-uls-display-settings-ui-language' ) );
if ( !displaySettings.$parent.$window.hasClass( 'callout' ) ) { if ( !displaySettings.$parent.$window.hasClass( 'callout' ) ) {
// Callout menus will have position rules. // Callout menus will have position rules.
// Others use the default position. // Others use the default position.
@@ -340,7 +345,7 @@
// If the ULS is shown in the the sidebar, // If the ULS is shown in the the sidebar,
// add a caret pointing to the icon // add a caret pointing to the icon
if ( displaySettings.$parent.$window.hasClass( 'callout' ) ) { if ( displaySettings.$parent.$window.hasClass( 'callout' ) ) {
this.$menu.addClass( 'callout' ); this.$menu.addClass( 'callout callout--languageselection' );
} else { } else {
this.$menu.removeClass( 'callout' ); this.$menu.removeClass( 'callout' );
} }

View File

@@ -326,19 +326,24 @@
top: inputSettings.$parent.top, top: inputSettings.$parent.top,
onReady: function () { onReady: function () {
var uls = this, var uls = this,
$back = $( '<a>' ) $wrap,
$back = $( '<div>' )
.addClass( 'uls-icon-back' )
.data( 'i18n', 'ext-uls-back-to-input-settings' ) .data( 'i18n', 'ext-uls-back-to-input-settings' )
.i18n(); .i18n()
.text( ' ' );
$back.click( function () { $back.click( function () {
uls.hide(); uls.hide();
inputSettings.$parent.show(); inputSettings.$parent.show();
} ); } );
uls.$menu.find( 'div.uls-title-region' ).append( $back ); $wrap = $( '<div>' )
uls.$menu.find( 'h1.uls-title' ) .addClass( 'uls-search-wrapper-wrapper' );
.data( 'i18n', 'ext-uls-input-settings-ui-language' )
.i18n(); uls.$menu.find( '.uls-search-wrapper' ).wrap( $wrap );
uls.$menu.find( '.uls-search-wrapper-wrapper' ).prepend( $back );
uls.$menu.prepend( uls.$menu.prepend(
$( '<span>' ).addClass( 'caret-before' ), $( '<span>' ).addClass( 'caret-before' ),
$( '<span>' ).addClass( 'caret-after' ) $( '<span>' ).addClass( 'caret-after' )
@@ -347,6 +352,9 @@
onVisible: function () { onVisible: function () {
var $parent; var $parent;
this.$menu.find( '.uls-languagefilter' )
.prop( 'placeholder', $.i18n( 'ext-uls-input-settings-ui-language' ) );
if ( !inputSettings.$parent.$window.hasClass( 'callout' ) ) { if ( !inputSettings.$parent.$window.hasClass( 'callout' ) ) {
// callout menus will have position rules. others use // callout menus will have position rules. others use
// default position // default position
@@ -364,7 +372,7 @@
} }
if ( inputSettings.$parent.$window.hasClass( 'callout' ) ) { if ( inputSettings.$parent.$window.hasClass( 'callout' ) ) {
this.$menu.addClass( 'callout' ); this.$menu.addClass( 'callout callout--languageselection' );
} else { } else {
this.$menu.removeClass( 'callout' ); this.$menu.removeClass( 'callout' );
} }

View File

@@ -383,9 +383,10 @@
languageSettingsOptions = { languageSettingsOptions = {
defaultModule: 'display', defaultModule: 'display',
onVisible: function () { onVisible: function () {
var topRowHeight, caretHeight, caretWidth, var caretRadius, caretPosition,
$caretBefore = $( '<span>' ).addClass( 'caret-before' ), $caretBefore = $( '<span>' ).addClass( 'caret-before' ),
$caretAfter = $( '<span>' ).addClass( 'caret-after' ), $caretAfter = $( '<span>' ).addClass( 'caret-after' ),
ulsTriggerHeight = this.$element.height(),
ulsTriggerWidth = this.$element.width(), ulsTriggerWidth = this.$element.width(),
ulsTriggerOffset = this.$element.offset(); ulsTriggerOffset = this.$element.offset();
@@ -396,17 +397,22 @@
// Calculate the positioning of the panel // Calculate the positioning of the panel
// according to the position of the trigger icon // according to the position of the trigger icon
caretRadius = parseInt( $caretBefore.css( 'border-top-width' ), 10 );
if ( rtlPage ) { if ( rtlPage ) {
caretWidth = parseInt( $caretBefore.css( 'border-left-width' ), 10 ); this.left = ulsTriggerOffset.left - this.$window.width() - caretRadius;
this.left = ulsTriggerOffset.left - this.$window.width() - caretWidth;
} else { } else {
caretWidth = parseInt( $caretBefore.css( 'border-right-width' ), 10 ); this.left = ulsTriggerOffset.left + ulsTriggerWidth + caretRadius;
this.left = ulsTriggerOffset.left + ulsTriggerWidth + caretWidth;
} }
topRowHeight = this.$window.find( '.row' ).height(); caretPosition = $caretBefore.position();
caretHeight = parseInt( $caretBefore.css( 'top' ), 10 );
this.top = ulsTriggerOffset.top - topRowHeight - caretHeight / 2; // The top of the dialog is aligned in relation to
// the middle of the trigger, so that middle of the
// caret aligns with it. 2 is for border and margin.
this.top = ulsTriggerOffset.top +
( ulsTriggerHeight / 2 ) -
( caretRadius + caretPosition.top + 2 );
this.position(); this.position();
} }