') + ')', 'gi');
if (regex.test(text)) {
found = true;
var frag = document.createDocumentFragment();
var parts = text.split(regex);
parts.forEach(function(part, i) {
if (i % 2 === 0) {
frag.appendChild(document.createTextNode(part));
} else {
var span = document.createElement('span');
span.className = 'userscript-highlight';
span.textContent = part;
frag.appendChild(span);
}
});
node.parentNode.replaceChild(frag, node);
}
});
} else if (node.nodeType === 1 && node.childNodes) { // element
var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];
if (!skipTags.includes(node.tagName)) {
Array.from(node.childNodes).forEach(highlight);
}
}
}
highlight(document.body);
// Re-highlight on dynamic content
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(m) {
m.addedNodes.forEach(function(node) {
if (node.nodeType === 1 || node.nodeType === 3) highlight(node);
});
});
});
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); }
})();
(function(){
try {
var __m = "*";
var __re = new RegExp('^' + ".*" + ', 'i');
if (__m === '*' || __re.test(location.href)) {
// Strip utm_, fbclid, gclid, etc. from all links on page
(function() {
var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',
'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',
'ref', 'ref_src', 'source', 'medium', 'campaign'];
function cleanUrl(url) {
try {
var u = new URL(url, window.location.origin);
var changed = false;
trackingParams.forEach(function(p) {
if (u.searchParams.has(p)) {
u.searchParams.delete(p);
changed = true;
}
});
return changed ? u.toString() : url;
} catch (e) {
return url;
}
}
function cleanLinks() {
document.querySelectorAll('a[href]').forEach(function(a) {
var clean = cleanUrl(a.href);
if (clean !== a.href) a.href = clean;
});
}
cleanLinks();
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(m) {
m.addedNodes.forEach(function(node) {
if (node.nodeType === 1) {
if (node.tagName === 'A') cleanLinks();
node.querySelectorAll('a[href]').forEach(function(a) {
var clean = cleanUrl(a.href);
if (clean !== a.href) a.href = clean;
});
}
});
});
});
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); }
})();
(function(){
try {
var __m = "youtube.com";
var __re = new RegExp('^' + "youtube\\.com" + ', 'i');
if (__m === '*' || __re.test(location.href)) {
// Auto-enable theater mode on YouTube
(function() {
function tryTheater() {
var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]');
if (btn && !btn.classList.contains('activated')) {
btn.click();
}
}
// Try immediately
tryTheater();
// Try after navigation (SPA)
var lastUrl = location.href;
setInterval(function() {
if (location.href !== lastUrl) {
lastUrl = location.href;
setTimeout(tryTheater, 500);
}
}, 1000);
// Also try on player load
var observer = new MutationObserver(tryTheater);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); }
})();
(function(){
try {
var __m = "*";
var __re = new RegExp('^' + ".*" + ', 'i');
if (__m === '*' || __re.test(location.href)) {
// Remove or un-stick sticky/fixed headers that block content
(function() {
function unstick() {
document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) {
if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {
el.style.position = 'static';
el.style.top = 'auto';
el.style.zIndex = 'auto';
}
});
}
unstick();
var observer = new MutationObserver(unstick);
observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });
})();
}
} catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); }
})();
})();
GitHub - granduke/react-native-datepicker: react native datePicker component for both Android and IOS, useing DatePikcerAndroid, TimePickerAndroid and DatePickerIOS · GitHub
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importReact,{Component}from'react'importDatePickerfrom'react-native-datepicker'exportdefaultclassMyDatePickerextendsComponent{constructor(props){super(props)this.state={date:"2016-05-15"}}render(){return(<DatePickerstyle={{width: 200}}date={this.state.date}mode="date"placeholder="select date"format="YYYY-MM-DD"minDate="2016-05-01"maxDate="2016-06-01"confirmBtnText="Confirm"cancelBtnText="Cancel"customStyles={{dateIcon: {position: 'absolute',left: 0,top: 4,marginLeft: 0},dateInput: {marginLeft: 36}// ... You can check the source to find the other keys.}}onDateChange={(date)=>{this.setState({date: date})}}/>)}}
Specify the style of the DatePicker, eg. width, height...
date
-
string | date | Moment instance
Specify the display date of DatePicker. string type value must match the specified format
mode
'date'
enum
The enum of date, datetime and time
androidMode
'default'
enum
The enum of default, calendar and spinner (only Android)
format
'YYYY-MM-DD'
string
Specify the display format of the date, which using moment.js. The default value change according to the mode.
confirmBtnText
'确定'
string
Specify the text of confirm btn in ios.
cancelBtnText
'取消'
string
Specify the text of cancel btn in ios.
iconSource
-
{uri: string} | number
Specify the icon. Same as the source of Image, always using require()
minDate
-
string | date
Restricts the range of possible date values.
maxDate
-
string | date
Restricts the range of possible date values.
duration
300
number
Specify the animation duration of datepicker.
customStyles
-
object
The hook of customize datepicker style, same as the native style. dateTouchBody, dateInput...
showIcon
true
boolean
Controller whether or not show the icon
hideText
false
boolean
Controller whether or not show the dateText
iconComponent
-
element
Set the custom icon
disabled
false
boolean
Controller whether or not disable the picker
is24Hour
-
boolean
Set the TimePicker is24Hour flag. The default value depend on format. Only work in Android
allowFontScaling
true
boolean
Set to false to disable font scaling for every text component
placeholder
''
string
The placeholder show when this.props.date is falsy
onDateChange
-
function
This is called when the user confirm the picked date or time in the UI. The first and only argument is a date or time string representing the new date and time formatted by moment.js with the given format property.
onOpenModal
-
function
This is called when the DatePicker Modal open.
onCloseModal
-
function
This is called when the DatePicker Modal close
onPressMask
-
function
This is called when clicking the ios modal mask
modalOnResponderTerminationRequest
-
function
Set the callback for React Native's Gesture Responder System's call to onResponderTerminationRequest. By default this will reject a termination request, but can be overidden in case the View under the Modal is implementing custom gesture responders, and you wish for those to be overidden in certain cases.
TouchableComponent
TouchableHighlight
Component
Replace the TouchableHighlight with a custom Component. For example : TouchableOpacity
getDateStr
-
Function
A function to override how to format the date into a String for display, receives a Date instance