repo_id
stringlengths
6
101
size
int64
367
5.14M
file_path
stringlengths
2
269
content
stringlengths
367
5.14M
2881099/IdleBus
1,172
IdleBus/IdleBus.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>netstandard2.0;net40</TargetFrameworks> <Version>1.5.3</Version> <GeneratePackageOnBuild>true</GeneratePackageOnBuild> <Authors>YeXiangQin</Authors> <Description>IdleBus 空闲对象管理容器,有效组织对象重复利用,自动创建、销毁,解决【实例】过多且长时间占用的问题。</Description> <PackageProjectUrl>https://github.com/2881099/IdleBus</PackageProjectUrl> <RepositoryUrl>https://github.com/2881099/IdleBus</RepositoryUrl> <RepositoryType>git</RepositoryType> <PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageTags>IdleBus;Idle</PackageTags> <PackageId>$(AssemblyName)</PackageId> <Title>$(AssemblyName)</Title> <IsPackable>true</IsPackable> <GenerateAssemblyInfo>true</GenerateAssemblyInfo> <SignAssembly>true</SignAssembly> <AssemblyOriginatorKeyFile>yxq.snk</AssemblyOriginatorKeyFile> <DelaySign>false</DelaySign> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'"> <DocumentationFile>IdleBus.xml</DocumentationFile> <WarningLevel>3</WarningLevel> </PropertyGroup> </Project>
2881099/IdleBus
8,369
IdleBus/IdleBus`1.cs
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading; /// <summary> /// 空闲对象容器管理,可实现自动创建、销毁、扩张收缩,解决【实例】长时间占用问题 /// </summary> public partial class IdleBus<TKey, TValue> : IDisposable where TValue : class, IDisposable { ConcurrentDictionary<TKey, ItemInfo> _dic; ConcurrentDictionary<string, ItemInfo> _removePending; object _usageLock = new object(); int _usageQuantity; TimeSpan _defaultIdle; /// <summary> /// 按空闲时间1分钟,创建空闲容器 /// </summary> public IdleBus() : this(TimeSpan.FromMinutes(1)) { } /// <summary> /// 指定空闲时间、创建空闲容器 /// </summary> /// <param name="idle">空闲时间</param> public IdleBus(TimeSpan idle) { _dic = new ConcurrentDictionary<TKey, ItemInfo>(); _removePending = new ConcurrentDictionary<string, ItemInfo>(); _usageQuantity = 0; _defaultIdle = idle; } /// <summary> /// 根据 key 获得或创建【实例】(线程安全)<para></para> /// key 未注册时,抛出异常 /// </summary> /// <param name="key"></param> /// <returns></returns> public TValue Get(TKey key) { if (IsDisposed) throw new Exception($"{key} 实例获取失败,{nameof(IdleBus<TValue>)} 对象已释放"); if (_dic.TryGetValue(key, out var item) == false) { var error = new Exception($"{key} 实例获取失败,因为没有注册"); this.OnNotice(new NoticeEventArgs(NoticeType.Get, key, error, error.Message)); throw error; } var now = DateTime.Now; var ret = item.GetOrCreate(); if (item.IsRegisterError) { this.OnNotice(new NoticeEventArgs(NoticeType.Get, key, null, $"{key} 实例获取失败:检测到注册实例的参数 create 返回了相同的实例,应该每次返回新实例,正确:() => new Xxx(),错误:() => 变量")); throw new ArgumentException($"{key} 实例获取失败:检测到注册实例的参数 create 返回了相同的实例,应该每次返回新实例,正确:() => new Xxx(),错误:() => 变量"); } var tsms = DateTime.Now.Subtract(now).TotalMilliseconds; this.OnNotice(new NoticeEventArgs(NoticeType.Get, key, null, $"{key} 实例获取成功 {item.activeCounter}次{(tsms > 5 ? $",耗时 {tsms}ms" : "")}")); //this.ThreadLiveWatch(item); //这种模式采用 Sorted 性能会比较慢 this.ThreadScanWatch(item); //这种在后台扫描 _dic,定时要求可能没那么及时 return ret; } /// <summary> /// 获得或创建所有【实例】(线程安全) /// </summary> /// <returns></returns> public List<TValue> GetAll() => _dic.Keys.ToArray().Select(a => Get(a)).ToList(); /// <summary> /// 获得所有已注册的 key(线程安全) /// </summary> /// <returns></returns> public TKey[] GetKeys(Func<TValue, bool> filter = null) { if (filter == null) return _dic.Keys.ToArray(); return _dic.Keys.ToArray().Where(key => _dic.TryGetValue(key, out var item) && filter(item.value)).ToArray(); } /// <summary> /// 判断 key 是否注册 /// </summary> /// <param name="key"></param> /// <returns></returns> public bool Exists(TKey key) { if (key == null) return false; return _dic.ContainsKey(key); } /// <summary> /// 注册【实例】 /// </summary> /// <param name="key"></param> /// <param name="create">实例创建方法</param> /// <returns></returns> public IdleBus<TKey, TValue> Register(TKey key, Func<TValue> create) { InternalRegister(key, create, null, true); return this; } public IdleBus<TKey, TValue> Register(TKey key, Func<TValue> create, TimeSpan idle) { InternalRegister(key, create, idle, true); return this; } public bool TryRegister(TKey key, Func<TValue> create) => InternalRegister(key, create, null, false); public bool TryRegister(TKey key, Func<TValue> create, TimeSpan idle) => InternalRegister(key, create, idle, false); public bool TryRemove(TKey key, bool now = false) => InternalRemove(key, now, false); /// <summary> /// 已创建【实例】数量 /// </summary> public int UsageQuantity => _usageQuantity; /// <summary> /// 注册数量 /// </summary> public int Quantity => _dic.Count; /// <summary> /// 通知事件 /// </summary> public event EventHandler<NoticeEventArgs> Notice; bool InternalRegister(TKey key, Func<TValue> create, TimeSpan? idle, bool isThrow) { if (IsDisposed) { if (isThrow) throw new Exception($"{key} 注册失败,{nameof(IdleBus<TValue>)} 对象已释放"); return false; } var error = new Exception($"{key} 注册失败,请勿重复注册"); if (_dic.ContainsKey(key)) { this.OnNotice(new NoticeEventArgs(NoticeType.Register, key, error, error.Message)); if (isThrow) throw error; return false; } if (idle == null) idle = _defaultIdle; //if (idle < TimeSpan.FromSeconds(5)) //{ // var limitError = new Exception($"{key} 注册失败,{nameof(idle)} 参数必须 >= 5秒"); // this.OnNotice(new NoticeEventArgs(NoticeType.Register, key, limitError, limitError.Message)); // if (isThrow) throw error; // return this; //} var added = _dic.TryAdd(key, new ItemInfo { ib = this, key = key, create = create, idle = idle.Value, }); if (added == false) { this.OnNotice(new NoticeEventArgs(NoticeType.Register, key, error, error.Message)); if (isThrow) throw error; return false; } this.OnNotice(new NoticeEventArgs(NoticeType.Register, key, null, $"{key} 注册成功,{_usageQuantity}/{Quantity}")); return true; } bool InternalRemove(TKey key, bool isNow, bool isThrow) { if (IsDisposed) { if (isThrow) throw new Exception($"{key} 删除失败 ,{nameof(IdleBus<TValue>)} 对象已释放"); return false; } if (_dic.TryRemove(key, out var item) == false) { var error = new Exception($"{key} 删除失败 ,因为没有注册"); this.OnNotice(new NoticeEventArgs(NoticeType.Remove, key, error, error.Message)); if (isThrow) throw error; return false; } Interlocked.Exchange(ref item.releaseErrorCounter, 0); if (isNow) { item.Release(() => true); this.OnNotice(new NoticeEventArgs(NoticeType.Remove, item.key, null, $"{key} 删除成功,{_usageQuantity}/{Quantity}")); return true; } item.lastActiveTime = DateTime.Now; if (item.value == null) item.lastActiveTime = DateTime.Now.Subtract(item.idle).AddSeconds(-60); //延时删除 _removePending.TryAdd(Guid.NewGuid().ToString(), item); this.OnNotice(new NoticeEventArgs(NoticeType.Remove, item.key, null, $"{key} 删除成功,并且已标记为延时释放,{_usageQuantity}/{Quantity}")); return true; } void InternalRemoveDelayHandler() { //处理延时删除 var removeKeys = _removePending.Keys; foreach (var removeKey in removeKeys) { if (_removePending.TryGetValue(removeKey, out var removeItem) == false) continue; if (DateTime.Now.Subtract(removeItem.lastActiveTime) <= removeItem.idle) continue; try { removeItem.Release(() => true); } catch (Exception ex) { var tmp1 = Interlocked.Increment(ref removeItem.releaseErrorCounter); this.OnNotice(new NoticeEventArgs(NoticeType.Remove, removeItem.key, ex, $"{removeKey} ---延时释放执行出错({tmp1}次):{ex.Message}")); if (tmp1 < 3) continue; } removeItem.Dispose(); _removePending.TryRemove(removeKey, out var oldItem); } } void OnNotice(NoticeEventArgs e) { this.Notice?.Invoke(this, e); } #region Dispose ~IdleBus() => Dispose(); public bool IsDisposed { get; private set; } object isdisposedLock = new object(); public void Dispose() { if (IsDisposed) return; lock (isdisposedLock) { if (IsDisposed) return; IsDisposed = true; } foreach (var item in _removePending.Values) item.Dispose(); foreach (var item in _dic.Values) item.Dispose(); _removePending.Clear(); _dic.Clear(); _usageQuantity = 0; } #endregion }
2881099/IdleBus
3,394
IdleBus/IdleBus`1.ItemInfo.cs
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Text; using System.Threading; partial class IdleBus<TKey, TValue> { class ItemInfo : IDisposable { internal IdleBus<TKey, TValue> ib; internal TKey key; internal Func<TValue> create; internal TimeSpan idle; internal DateTime createTime; internal DateTime lastActiveTime; internal long activeCounter; internal int releaseErrorCounter; internal TValue value { get; private set; } internal TValue firstValue { get; private set; } internal bool IsRegisterError { get; private set; } object valueLock = new object(); internal TValue GetOrCreate() { if (isdisposed == true) return null; if (value == null) { var iscreate = false; var now = DateTime.Now; try { lock (valueLock) { if (isdisposed == true) return null; if (value == null) { value = create(); createTime = DateTime.Now; Interlocked.Increment(ref ib._usageQuantity); iscreate = true; } else { return value; } } if (iscreate) { if (value != null) { if (firstValue == null) firstValue = value; //记录首次值 else if (firstValue == value) IsRegisterError = true; //第二次与首次相等,注册姿势错误 } ib.OnNotice(new NoticeEventArgs(NoticeType.AutoCreate, key, null, $"{key} 实例+++创建成功,耗时 {DateTime.Now.Subtract(now).TotalMilliseconds}ms,{ib._usageQuantity}/{ib.Quantity}")); } } catch (Exception ex) { ib.OnNotice(new NoticeEventArgs(NoticeType.AutoCreate, key, ex, $"{key} 实例+++创建失败:{ex.Message}")); throw ex; } } lastActiveTime = DateTime.Now; Interlocked.Increment(ref activeCounter); return value; } internal bool Release(Func<bool> lockInIf) { lock (valueLock) { if (value != null && lockInIf()) { value?.Dispose(); value = null; Interlocked.Decrement(ref ib._usageQuantity); Interlocked.Exchange(ref activeCounter, 0); return true; } } return false; } ~ItemInfo() => Dispose(); bool isdisposed = false; public void Dispose() { if (isdisposed) return; lock (valueLock) { if (isdisposed) return; isdisposed = true; } try { Release(() => true); } catch { } } } }
2881099/IdleBus
940
IdleBus/IdleBus.cs
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Text; using System.Threading; /// <summary> /// 空闲对象容器管理,可实现自动创建、销毁、扩张收缩,解决【实例】长时间占用问题 /// </summary> public class IdleBus : IdleBus<string, IDisposable> { /// <summary> /// 按空闲时间1分钟,创建空闲容器 /// </summary> public IdleBus() : base() { } /// <summary> /// 指定空闲时间、创建空闲容器 /// </summary> /// <param name="idle">空闲时间</param> public IdleBus(TimeSpan idle) : base(idle) { } } /// <summary> /// 空闲对象容器管理,可实现自动创建、销毁、扩张收缩,解决【实例】长时间占用问题 /// </summary> public class IdleBus<TValue> : IdleBus<string, TValue> where TValue : class, IDisposable { /// <summary> /// 按空闲时间1分钟,创建空闲容器 /// </summary> public IdleBus() : base() { } /// <summary> /// 指定空闲时间、创建空闲容器 /// </summary> /// <param name="idle">空闲时间</param> public IdleBus(TimeSpan idle) : base(idle) { } }
2881099/IdleBus
981
IdleBus/IdleBus`1.Test.cs
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Text; using System.Threading; partial class IdleBus<TKey, TValue> { public static void Test() { //超过1分钟没有使用,连续检测2次都这样,就销毁【实例】 var ib = new IdleBus<string, IDisposable>(TimeSpan.FromMinutes(1)); ib.Notice += (_, e) => { var log = $"[{DateTime.Now.ToString("HH:mm:ss")}] 线程{Thread.CurrentThread.ManagedThreadId}:{e.Log}"; //Trace.WriteLine(log); Console.WriteLine(log); }; ib.Register("key1", () => new ManualResetEvent(false)); ib.Register("key2", () => new AutoResetEvent(false)); var item = ib.Get("key2") as AutoResetEvent; //获得 key2 对象,创建 item = ib.Get("key2") as AutoResetEvent; //获得 key2 对象,已创建 int num1 = ib.UsageQuantity; //【实例】有效数量(即已经创建了的),后台定时清理不活跃的【实例】,此值就会减少 ib.Dispose(); } }
2881099/IdleBus
1,105
IdleScheduler/IdleScheduler.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>netstandard2.0;net40</TargetFrameworks> <Version>1.5.2.9</Version> <GeneratePackageOnBuild>true</GeneratePackageOnBuild> <Authors>YeXiangQin</Authors> <Description>IdleScheduler 轻量定时任务调度,支持临时的延时任务和重复循环任务,可按秒,每天固定时间,每周固定时间,每月固定时间执行。</Description> <PackageProjectUrl>https://github.com/2881099/FreeScheduler</PackageProjectUrl> <RepositoryUrl>https://github.com/2881099/FreeScheduler</RepositoryUrl> <RepositoryType>git</RepositoryType> <PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageTags>IdleScheduler;Scheduler;Timer;TempTask</PackageTags> <PackageId>$(AssemblyName)</PackageId> <Title>$(AssemblyName)</Title> <IsPackable>true</IsPackable> <GenerateAssemblyInfo>true</GenerateAssemblyInfo> <SignAssembly>true</SignAssembly> </PropertyGroup> <ItemGroup> <PackageReference Include="FreeSql" Version="3.2.665" /> <PackageReference Include="WorkQueue" Version="1.3.0" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\IdleBus\IdleBus.csproj" /> </ItemGroup> </Project>
2881099/NPinyin
36,291
PyHash.cs
using System; using System.Collections.Generic; using System.Text; namespace NPinyin { internal class PyHash { internal static short[][] hashes = new short[][] { new short[]{23, 70, 96, 128, 154, 165, 172, 195}, new short[]{25, 35, 87, 108, 120, 128, 132, 137, 168, 180, 325, 334, 336, 353, 361, 380}, new short[]{23, 34, 46, 81, 82, 87, 134, 237, 255, 288, 317, 322, 354, 359}, new short[]{7, 11, 37, 49, 53, 56, 131, 132, 146, 176, 315, 372}, new short[]{11, 69, 73, 87, 96, 103, 159, 175, 195, 296, 298, 359, 361}, new short[]{57, 87, 115, 126, 149, 244, 282, 298, 308, 345, 355}, new short[]{19, 37, 117, 118, 141, 154, 196, 216, 267, 301, 327, 333, 337, 347}, new short[]{4, 11, 59, 61, 62, 87, 119, 169, 183, 198, 262, 334, 362, 380}, new short[]{37, 135, 167, 170, 246, 250, 334, 341, 351, 354, 386, 390, 398}, new short[]{5, 6, 52, 55, 76, 146, 165, 244, 256, 266, 300, 318, 331}, new short[]{6, 71, 94, 129, 137, 141, 169, 179, 225, 226, 235, 248, 289, 290, 333, 345, 391}, new short[]{0, 33, 37, 62, 90, 131, 205, 246, 268, 343, 349, 380}, new short[]{31, 62, 85, 115, 117, 150, 159, 167, 171, 204, 215, 252, 343}, new short[]{69, 81, 98, 140, 165, 195, 239, 240, 259, 265, 329, 368, 375, 392, 393}, new short[]{13, 81, 82, 123, 132, 144, 154, 165, 334, 336, 345, 348, 349, 355, 367, 377, 383}, new short[]{31, 32, 44, 57, 76, 83, 87, 129, 151, 172, 176, 183, 184, 193, 221, 235, 285, 288, 305}, new short[]{10, 14, 60, 76, 85, 97, 115, 125, 128, 130, 286, 288, 301, 313, 382}, new short[]{62, 128, 136, 175, 211, 240, 254, 273, 274, 317, 330, 344, 349, 360, 380}, new short[]{29, 47, 52, 116, 126, 127, 130, 133, 191, 284, 288, 306, 353, 361, 383}, new short[]{1, 15, 25, 67, 83, 90, 117, 121, 150, 228, 308, 324, 336, 351, 386}, new short[]{34, 37, 67, 101, 103, 117, 127, 165, 168, 254, 267, 272, 274, 288, 305, 310, 323, 329, 333, 358, 378}, new short[]{5, 74, 103, 135, 163, 165, 171, 244, 262, 266, 334, 352, 390, 397}, new short[]{4, 17, 95, 125, 165, 186, 203, 221, 252, 282, 317, 333, 339, 348, 351, 353}, new short[]{74, 79, 81, 84, 92, 110, 116, 117, 131, 132, 154, 199, 241, 251, 300, 306, 349, 359, 383, 387}, new short[]{40, 83, 127, 144, 161, 188, 249, 288, 344, 382, 388}, new short[]{8, 55, 61, 76, 85, 98, 111, 127, 186, 230, 241, 247, 267, 287, 327, 341, 344, 347, 359, 364}, new short[]{20, 59, 69, 80, 117, 129, 176, 186, 191, 237, 275, 289, 309, 338, 375, 380}, new short[]{5, 15, 25, 35, 40, 129, 174, 236, 274, 337, 347}, new short[]{14, 22, 47, 56, 87, 120, 129, 144, 155, 160, 237, 283, 284, 309, 327, 337, 365, 372}, new short[]{1, 14, 47, 132, 198, 254, 255, 300, 310, 335, 336, 372}, new short[]{2, 36, 64, 96, 125, 176, 184, 190, 211, 271, 308, 315, 367}, new short[]{20, 76, 79, 81, 110, 117, 120, 129, 182, 192, 235, 353, 378}, new short[]{37, 83, 88, 92, 111, 127, 243, 303, 324, 325, 348, 353, 359, 371, 377}, new short[]{5, 87, 90, 124, 127, 180, 259, 288, 290, 302, 312, 313, 324, 332}, new short[]{55, 62, 89, 98, 108, 132, 168, 240, 248, 322, 325, 327, 347, 353, 391, 396}, new short[]{4, 8, 13, 35, 37, 39, 41, 64, 111, 174, 212, 245, 248, 251, 263, 288, 335, 373, 375}, new short[]{10, 39, 93, 110, 168, 227, 228, 254, 288, 336, 378, 381}, new short[]{75, 92, 122, 176, 198, 211, 214, 283, 334, 353, 359, 379, 386}, new short[]{5, 8, 13, 19, 57, 87, 104, 125, 130, 176, 202, 249, 252, 290, 309, 391}, new short[]{88, 132, 173, 176, 235, 247, 253, 292, 324, 328, 339, 359}, new short[]{19, 32, 61, 84, 87, 118, 120, 125, 129, 132, 181, 190, 288, 290, 331, 355, 359, 366}, new short[]{13, 25, 46, 126, 140, 157, 165, 225, 226, 252, 288, 304, 327, 353, 378}, new short[]{12, 14, 26, 56, 72, 95, 131, 132, 134, 142, 253, 298, 337, 361, 391}, new short[]{4, 18, 37, 49, 87, 93, 196, 225, 226, 246, 248, 250, 255, 310, 354, 358}, new short[]{64, 87, 110, 111, 128, 135, 151, 165, 177, 188, 191, 268, 312, 334, 352, 354, 357, 371}, new short[]{10, 17, 19, 30, 40, 48, 81, 97, 125, 129, 130, 182, 234, 305, 328, 393}, new short[]{13, 69, 80, 114, 192, 200, 235, 343, 345, 353, 354, 360, 374, 378, 383}, new short[]{83, 87, 94, 105, 107, 124, 144, 153, 219, 290, 298, 324, 349, 358, 367}, new short[]{10, 36, 142, 169, 221, 232, 241, 246, 346, 347, 375, 383, 390}, new short[]{26, 104, 126, 143, 176, 186, 241, 247, 250, 318, 320, 333, 360}, new short[]{66, 92, 116, 148, 191, 215, 254, 333, 334, 335, 336, 351, 353, 358, 380}, new short[]{9, 37, 55, 56, 76, 79, 90, 111, 122, 124, 161, 192, 247, 313, 353, 359, 374}, new short[]{17, 30, 34, 56, 64, 68, 90, 125, 151, 168, 176, 188, 286, 333, 338, 360}, new short[]{26, 143, 173, 182, 190, 194, 246, 284, 286, 328, 333, 355, 357, 360, 362, 363, 377, 380}, new short[]{1, 13, 87, 122, 168, 171, 186, 201, 297, 328, 349, 352, 380}, new short[]{18, 39, 61, 88, 98, 123, 129, 131, 148, 162, 165, 243, 285, 314, 340, 349, 360, 377, 378}, new short[]{67, 98, 117, 118, 122, 128, 156, 174, 184, 207, 244, 250, 330, 335, 342, 372, 375}, new short[]{13, 38, 63, 160, 180, 185, 189, 190, 219, 248, 253, 275, 297, 318, 355}, new short[]{1, 44, 47, 93, 107, 172, 235, 276, 281, 287, 290, 306, 333, 334, 337, 347, 353, 376}, new short[]{13, 15, 32, 125, 127, 157, 165, 176, 236, 344, 350, 381}, new short[]{47, 65, 93, 134, 159, 174, 218, 282, 318, 336, 358, 373, 379}, new short[]{7, 17, 40, 66, 102, 141, 154, 159, 165, 172, 174, 177, 328, 329, 334, 348, 379, 382}, new short[]{4, 34, 36, 76, 79, 122, 127, 138, 176, 241, 267, 309, 334, 367, 382}, new short[]{9, 17, 33, 46, 90, 103, 125, 138, 144, 157, 185, 198, 224, 250, 260, 291, 326, 343, 349, 377, 381}, new short[]{29, 31, 53, 58, 134, 138, 193, 287, 305, 308, 333, 334}, new short[]{13, 64, 83, 93, 129, 192, 227, 244, 397}, new short[]{7, 8, 14, 78, 85, 103, 138, 175, 176, 200, 203, 234, 301, 313, 361}, new short[]{13, 75, 87, 111, 244, 253, 288, 321, 339, 341, 357, 395}, new short[]{4, 14, 42, 64, 69, 108, 110, 117, 122, 131, 159, 163, 188, 198, 200, 206, 244, 292, 300, 354, 390}, new short[]{14, 37, 73, 87, 129, 135, 144, 176, 182, 300, 346, 352, 380, 383}, new short[]{23, 50, 87, 143, 171, 186, 191, 223, 290, 333, 334, 364, 378, 380, 388, 391, 393}, new short[]{5, 14, 23, 36, 62, 71, 76, 95, 99, 128, 176, 211, 229, 357}, new short[]{12, 33, 47, 70, 81, 90, 97, 119, 122, 131, 189, 190, 191, 235, 244, 253, 320, 350, 359}, new short[]{10, 13, 23, 93, 110, 120, 135, 171, 195, 250, 293, 298, 329, 344, 354}, new short[]{13, 29, 37, 163, 169, 200, 211, 214, 217, 236, 246, 249, 282, 327, 349, 353, 362, 372}, new short[]{5, 13, 23, 41, 57, 62, 76, 89, 111, 135, 195, 234, 248, 314, 334, 341, 349, 380}, new short[]{17, 35, 57, 117, 121, 206, 235, 243, 265, 329, 358, 374}, new short[]{13, 28, 41, 55, 69, 101, 103, 126, 138, 198, 267, 276, 288, 313, 334, 335, 339, 354, 376, 383, 394}, new short[]{11, 13, 19, 36, 38, 58, 75, 124, 232, 235, 265, 286, 298, 330, 333, 359}, new short[]{4, 19, 25, 43, 110, 125, 165, 331, 334, 341, 349, 355, 372}, new short[]{40, 55, 64, 70, 117, 126, 127, 135, 160, 172, 173, 186, 270, 318, 338, 344, 378}, new short[]{122, 176, 198, 238, 246, 284, 286, 290, 318, 329, 337, 381, 394}, new short[]{23, 36, 37, 44, 117, 124, 198, 204, 233, 248, 282, 288, 297, 314, 332, 336, 388}, new short[]{15, 33, 54, 64, 75, 85, 115, 127, 165, 196, 229, 237, 254, 307, 327, 335, 349, 383}, new short[]{22, 87, 121, 127, 161, 180, 248, 250, 276, 313, 324, 347, 349, 355, 357, 359}, new short[]{14, 48, 67, 88, 130, 131, 172, 188, 195, 203, 267, 282, 333, 339, 350, 392}, new short[]{22, 31, 37, 98, 118, 132, 135, 137, 142, 151, 243, 244, 282, 305, 333, 349, 350, 351, 353, 358, 374}, new short[]{15, 42, 67, 75, 125, 134, 189, 255, 261, 309, 334, 350, 380, 382}, new short[]{10, 39, 87, 97, 105, 109, 125, 137, 225, 226, 253, 329, 341, 354, 363, 372}, new short[]{5, 17, 42, 64, 80, 111, 120, 169, 175, 206, 237, 267, 288, 290, 324, 351, 364, 390}, new short[]{3, 33, 55, 75, 91, 97, 103, 132, 187, 220, 232, 234, 240, 288, 301, 330, 336, 337, 338, 340, 359, 374, 380, 382}, new short[]{13, 87, 98, 125, 126, 127, 128, 250, 330, 341, 353, 360, 374, 382, 391}, new short[]{59, 66, 75, 125, 135, 172, 192, 230, 231, 255, 256, 276, 300, 306, 339, 349, 353, 390}, new short[]{25, 36, 56, 90, 107, 125, 127, 142, 165, 195, 244, 246, 319, 347, 355, 375, 380}, new short[]{2, 33, 35, 36, 72, 74, 87, 92, 111, 131, 145, 176, 244, 248, 282, 333, 355, 359}, new short[]{5, 39, 127, 134, 137, 200, 240, 283, 284, 343, 344, 372}, new short[]{9, 32, 37, 80, 96, 104, 110, 117, 154, 176, 244, 297, 298, 339, 353, 374, 381}, new short[]{38, 51, 64, 76, 80, 93, 96, 134, 150, 173, 275, 290, 340, 347, 359, 363, 380}, new short[]{55, 89, 111, 126, 157, 159, 162, 182, 188, 244, 253, 280, 334, 359, 384, 398}, new short[]{59, 64, 75, 81, 97, 105, 115, 125, 155, 198, 248, 262, 319, 323, 376}, new short[]{13, 41, 76, 125, 127, 130, 134, 135, 159, 167, 183, 229, 230, 240, 246, 308, 319, 329, 333, 334, 340, 344, 363, 382}, new short[]{8, 13, 19, 31, 70, 76, 79, 96, 127, 153, 163, 165, 184, 227, 230, 247, 255, 336, 337, 348, 353, 357, 361, 362}, new short[]{71, 87, 111, 121, 130, 142, 150, 160, 175, 224, 248, 314, 336, 353, 357, 359}, new short[]{67, 84, 101, 130, 287, 288, 332, 333, 359, 361, 377}, new short[]{34, 52, 90, 100, 125, 135, 165, 173, 320, 341, 352, 359, 382, 392}, new short[]{13, 18, 39, 55, 62, 87, 248, 255, 290, 327, 349, 353, 355, 360, 383}, new short[]{1, 9, 12, 29, 32, 36, 82, 139, 140, 149, 153, 165, 167, 180, 185, 231, 241, 244, 274, 299, 309, 329, 355, 362}, new short[]{48, 66, 98, 107, 120, 122, 125, 135, 190, 195, 198, 215, 253, 256, 280, 282, 307, 320, 334, 349, 353, 355}, new short[]{1, 7, 13, 25, 64, 98, 139, 144, 166, 176, 206, 236, 262, 330, 362}, new short[]{37, 55, 116, 123, 125, 131, 165, 234, 266, 276, 328, 329, 342, 349, 353, 359, 391}, new short[]{126, 137, 191, 215, 239, 288, 290, 321, 324, 333, 334, 338, 349, 353, 362, 379}, new short[]{50, 57, 87, 93, 98, 115, 134, 148, 174, 229, 251, 260, 285, 298, 313, 348, 349, 350}, new short[]{5, 13, 31, 45, 69, 81, 108, 122, 127, 160, 165, 176, 179, 237, 244, 301, 316, 352, 360}, new short[]{5, 87, 95, 98, 101, 132, 135, 159, 167, 190, 203, 217, 234, 235, 247, 289, 333, 341, 343, 352}, new short[]{22, 56, 66, 85, 87, 93, 126, 127, 163, 230, 243, 248, 254, 280, 301, 305, 334, 357}, new short[]{13, 19, 53, 59, 76, 91, 117, 122, 195, 298, 303, 309, 337, 345, 398}, new short[]{9, 54, 84, 107, 125, 127, 135, 144, 156, 173, 176, 202, 215, 231, 234, 246, 266, 282, 335, 336, 347, 351, 374}, new short[]{11, 15, 30, 31, 40, 57, 58, 87, 88, 113, 186, 244, 245, 256, 308, 334, 377}, new short[]{62, 111, 176, 196, 228, 231, 288, 294, 302, 306, 350, 353, 375, 378, 392}, new short[]{119, 131, 133, 154, 161, 179, 198, 232, 234, 265, 301, 314, 344, 353, 378}, new short[]{67, 84, 123, 172, 175, 176, 182, 229, 290, 359, 360, 375, 383, 393}, new short[]{33, 36, 39, 102, 116, 136, 137, 208, 234, 256, 307, 329, 341, 347, 376, 380}, new short[]{13, 27, 32, 80, 95, 108, 131, 165, 167, 180, 190, 200, 235, 241, 244, 323, 330, 339, 372}, new short[]{1, 18, 37, 62, 67, 82, 85, 118, 125, 147, 159, 169, 174, 243, 284, 307, 313, 318, 355, 391, 396}, new short[]{10, 87, 91, 135, 169, 176, 215, 246, 267, 282, 295, 320, 345, 353, 380}, new short[]{2, 11, 13, 29, 90, 124, 131, 132, 170, 174, 176, 229, 246, 258, 298, 336, 344, 349}, new short[]{14, 37, 42, 71, 128, 152, 185, 218, 288, 304, 315, 353, 362, 380, 391}, new short[]{17, 20, 36, 73, 93, 128, 163, 194, 211, 217, 282, 290, 320, 354, 383}, new short[]{9, 26, 32, 101, 127, 169, 178, 183, 191, 236, 244, 310, 330, 336, 345, 353, 360, 372, 380, 394}, new short[]{7, 13, 64, 78, 81, 90, 115, 133, 164, 169, 244, 246, 269, 278, 290, 292, 310, 320, 353, 360, 364, 366, 380}, new short[]{8, 65, 81, 84, 91, 126, 129, 158, 183, 184, 194, 254, 262, 333, 334, 339, 351, 363, 382}, new short[]{44, 87, 96, 97, 125, 161, 173, 177, 183, 188, 189, 209, 235, 288, 315, 334, 351}, new short[]{50, 56, 60, 62, 67, 71, 105, 149, 154, 158, 164, 167, 185, 221, 285, 288, 308, 337, 344, 353}, new short[]{6, 10, 37, 62, 74, 79, 81, 128, 139, 154, 167, 198, 228, 244, 267, 290, 302, 368, 394}, new short[]{6, 30, 35, 36, 62, 65, 71, 112, 153, 163, 167, 180, 186, 195, 249, 286, 303, 329, 334}, new short[]{158, 241, 282, 324, 332, 334, 351, 353, 363, 365}, new short[]{17, 89, 117, 144, 165, 180, 185, 198, 229, 244, 290, 334, 335, 380}, new short[]{20, 32, 45, 57, 64, 66, 120, 135, 144, 176, 192, 244, 297, 301, 354, 381}, new short[]{1, 7, 35, 62, 74, 122, 159, 170, 172, 238, 239, 307, 308, 338, 349, 350, 359, 366, 368, 375, 382, 383}, new short[]{7, 9, 23, 66, 92, 103, 111, 135, 182, 203, 246, 247, 265, 285, 288, 303, 317, 329, 348}, new short[]{13, 39, 74, 87, 127, 135, 144, 193, 212, 243, 270, 290, 303, 315, 375, 376}, new short[]{33, 36, 40, 59, 101, 120, 127, 244, 285, 287, 309, 339, 391}, new short[]{4, 10, 39, 195, 268, 284, 336, 354, 359, 375, 381}, new short[]{39, 42, 62, 79, 83, 84, 101, 109, 132, 138, 202, 215, 277, 353, 358, 359}, new short[]{10, 39, 46, 73, 84, 87, 132, 170, 192, 219, 232, 246, 288, 320, 337}, new short[]{10, 12, 56, 87, 91, 101, 132, 227, 254, 301, 303, 333, 343, 347, 351}, new short[]{7, 8, 15, 18, 82, 105, 130, 232, 250, 290, 316, 332, 348, 350}, new short[]{36, 109, 110, 125, 154, 191, 193, 246, 265, 348, 349, 350, 378, 383}, new short[]{12, 16, 45, 57, 87, 92, 101, 105, 129, 130, 155, 167, 218, 292, 293, 327, 349, 354, 361}, new short[]{30, 59, 64, 121, 125, 149, 163, 188, 212, 250, 348, 350, 351, 352, 353, 378, 380}, new short[]{1, 69, 130, 138, 194, 200, 239, 260, 264, 357, 380, 381, 382, 396}, new short[]{7, 10, 19, 40, 57, 61, 125, 137, 141, 212, 239, 251, 310, 333, 347, 359, 380, 383}, new short[]{20, 28, 50, 97, 109, 134, 157, 162, 184, 199, 244, 246, 286, 352, 353, 360, 373, 380}, new short[]{35, 62, 87, 96, 122, 127, 136, 142, 148, 155, 165, 186, 196, 227, 354, 380, 388}, new short[]{81, 82, 101, 115, 125, 200, 243, 313, 351, 359, 367}, new short[]{7, 19, 40, 61, 107, 108, 124, 154, 161, 244, 309, 329, 345, 379, 394}, new short[]{10, 27, 48, 66, 75, 103, 116, 122, 128, 221, 228, 319, 322, 350, 377, 398}, new short[]{2, 64, 74, 117, 130, 165, 172, 180, 191, 218, 221, 288, 299, 325, 347, 353, 355, 360}, new short[]{5, 76, 79, 87, 106, 111, 137, 168, 180, 235, 243, 288, 315, 321, 338, 344, 348, 378, 382, 383}, new short[]{0, 29, 31, 37, 40, 50, 88, 100, 129, 134, 137, 144, 174, 186, 203, 254, 310, 313, 329, 341, 359, 364}, new short[]{69, 70, 71, 96, 115, 121, 130, 157, 159, 200, 230, 246, 250, 299, 318, 324, 353, 359, 380, 391}, new short[]{7, 90, 95, 116, 127, 128, 135, 137, 141, 154, 161, 254, 330, 359, 379, 388}, new short[]{10, 14, 56, 91, 108, 125, 130, 167, 211, 228, 246, 258, 280, 306, 324, 333, 336, 338, 379}, new short[]{4, 5, 14, 57, 85, 98, 125, 135, 136, 176, 254, 334, 336, 337, 351, 358, 362, 379, 383}, new short[]{1, 4, 13, 18, 19, 32, 50, 60, 62, 87, 117, 176, 211, 251, 329, 343, 359}, new short[]{38, 56, 94, 103, 117, 125, 129, 144, 159, 176, 244, 251, 253, 324, 345, 353, 386, 390}, new short[]{4, 22, 38, 47, 59, 64, 82, 97, 110, 135, 153, 176, 235, 236, 241, 287, 288, 303, 333, 347, 358, 359, 361}, new short[]{2, 5, 20, 52, 97, 125, 127, 132, 135, 137, 174, 188, 191, 243, 288, 310, 334, 346, 348, 349, 362, 372, 378}, new short[]{19, 35, 55, 98, 125, 131, 134, 147, 153, 246, 255, 390}, new short[]{5, 59, 62, 129, 136, 153, 198, 225, 235, 239, 254, 295, 334, 338, 341, 359, 361}, new short[]{8, 13, 51, 94, 121, 122, 125, 126, 129, 240, 272, 290, 297, 323, 352, 358, 376, 391, 395}, new short[]{6, 111, 116, 122, 125, 131, 135, 164, 175, 200, 212, 221, 267, 287, 319, 328, 334, 344, 378}, new short[]{83, 108, 143, 172, 176, 192, 198, 246, 262, 286, 287, 308, 338, 340, 343, 348, 353, 367, 380, 383}, new short[]{39, 82, 92, 118, 126, 128, 144, 171, 211, 234, 244, 253, 328, 333, 339, 357, 359, 380}, new short[]{37, 62, 64, 81, 97, 122, 125, 127, 137, 211, 246, 344, 360}, new short[]{7, 29, 62, 67, 69, 81, 87, 107, 132, 151, 160, 229, 244, 284, 285, 317, 358, 387, 390}, new short[]{13, 75, 76, 83, 87, 154, 165, 190, 212, 258, 285, 308, 309, 316, 320, 332, 336, 340, 352, 353, 354, 358, 383}, new short[]{9, 19, 29, 46, 122, 125, 127, 130, 170, 171, 174, 180, 182, 232, 282, 290, 359, 362, 367}, new short[]{13, 40, 71, 98, 101, 116, 125, 127, 169, 172, 175, 283, 288, 309, 311, 313, 323, 334, 353, 391}, new short[]{3, 9, 70, 104, 118, 173, 200, 219, 246, 262, 288, 297, 309, 328, 329, 334, 341, 353}, new short[]{32, 89, 93, 131, 132, 142, 199, 200, 214, 246, 287, 298, 307, 339, 348, 349, 357, 358, 368, 372, 391}, new short[]{103, 134, 159, 176, 186, 235, 261, 276, 282, 290, 301, 317, 329, 345, 356}, new short[]{10, 59, 125, 129, 130, 192, 217, 283, 318, 343, 345, 349, 353, 380, 383, 392}, new short[]{19, 76, 79, 102, 107, 126, 155, 161, 180, 253, 288, 289, 290, 314, 329, 333, 334, 360, 368, 378, 394}, new short[]{12, 92, 98, 105, 137, 149, 172, 196, 198, 244, 260, 262, 282, 298, 329, 345, 353, 368, 390}, new short[]{31, 39, 79, 83, 121, 125, 167, 171, 186, 198, 288, 303, 306, 334, 337, 376}, new short[]{13, 20, 36, 57, 98, 108, 114, 165, 171, 225, 226, 262, 269, 305, 309, 351, 377, 389}, new short[]{13, 51, 71, 93, 110, 129, 130, 156, 165, 170, 173, 183, 191, 200, 211, 212, 255, 266, 299, 301, 329, 336, 348}, new short[]{31, 56, 97, 122, 125, 129, 160, 188, 202, 204, 206, 225, 235, 247, 254, 255, 288, 334, 350, 362, 365, 367}, new short[]{9, 32, 37, 70, 75, 87, 88, 96, 125, 130, 162, 163, 168, 169, 257, 285, 308, 310, 337, 373, 392}, new short[]{18, 40, 42, 47, 73, 76, 85, 105, 108, 125, 130, 132, 134, 167, 191, 284, 310, 311, 344, 358, 361, 374, 378, 379}, new short[]{5, 19, 29, 31, 48, 65, 98, 129, 131, 143, 165, 171, 172, 196, 198, 277, 296, 311, 317, 327, 351, 380}, new short[]{51, 69, 96, 98, 117, 123, 130, 131, 148, 161, 168, 172, 176, 184, 202, 324, 332, 336, 348, 392}, new short[]{1, 20, 37, 57, 70, 76, 79, 87, 165, 176, 234, 251, 333, 388}, new short[]{8, 13, 134, 135, 153, 165, 169, 193, 195, 255, 273, 337, 348, 359, 360, 382, 391}, new short[]{2, 14, 53, 71, 83, 127, 136, 144, 149, 208, 234, 235, 293, 301, 347, 352}, new short[]{20, 40, 42, 95, 135, 141, 165, 199, 250, 290, 299, 308, 337, 338, 350, 353, 354, 355, 358, 380}, new short[]{13, 19, 33, 35, 36, 49, 85, 121, 122, 127, 137, 158, 165, 282, 303, 320, 328, 334, 365, 367, 374}, new short[]{17, 37, 123, 126, 127, 139, 140, 143, 167, 185, 192, 235, 254, 275, 315, 340, 349, 353, 362}, new short[]{57, 72, 127, 159, 163, 165, 176, 199, 215, 218, 238, 254, 284, 288, 336, 339, 347, 352, 380, 395}, new short[]{54, 69, 81, 101, 114, 121, 165, 206, 236, 313, 332, 338, 349, 358, 360, 362, 377}, new short[]{29, 37, 43, 120, 127, 176, 193, 244, 246, 254, 284, 288, 336, 339, 372}, new short[]{36, 56, 85, 122, 125, 126, 154, 232, 282, 308, 314, 315, 324, 336, 353, 359, 382}, new short[]{7, 99, 104, 117, 124, 125, 143, 176, 239, 298, 318, 383}, new short[]{13, 20, 71, 90, 108, 122, 176, 186, 214, 231, 247, 262, 267, 280, 286, 300, 332, 358, 377, 380, 385, 390, 393}, new short[]{31, 65, 75, 79, 85, 91, 109, 110, 120, 159, 229, 235, 288, 298, 347, 355, 359, 379, 381}, new short[]{38, 75, 82, 90, 99, 202, 248, 265, 324, 329, 350, 354, 355, 365}, new short[]{7, 15, 72, 90, 117, 125, 140, 144, 171, 198, 269, 271, 282, 305, 325, 338, 343, 353}, new short[]{13, 14, 20, 29, 37, 42, 45, 47, 165, 184, 244, 329, 341, 347, 372}, new short[]{31, 36, 82, 99, 149, 154, 173, 182, 185, 200, 217, 251, 298, 329, 332, 333, 349, 353, 354, 355, 377, 383}, new short[]{32, 44, 45, 52, 93, 97, 108, 114, 120, 144, 155, 172, 236, 240, 267, 272, 282, 288, 329, 333, 334, 343, 381}, new short[]{35, 55, 57, 62, 95, 96, 98, 127, 131, 177, 262, 317, 318, 357, 359, 380, 388}, new short[]{22, 24, 68, 103, 115, 119, 120, 125, 128, 156, 162, 184, 186, 235, 244, 327, 353, 358, 378, 380, 393}, new short[]{29, 37, 62, 67, 81, 83, 93, 104, 110, 129, 132, 142, 172, 274, 298, 354, 380}, new short[]{19, 45, 66, 87, 104, 108, 118, 155, 170, 176, 234, 286, 310, 313, 327, 329, 333, 347, 358, 368, 380, 383, 386}, new short[]{10, 14, 32, 83, 96, 131, 165, 180, 205, 211, 249, 255, 286, 288, 292, 299, 312, 336, 338, 349, 368, 375}, new short[]{2, 13, 48, 75, 85, 98, 116, 125, 126, 128, 135, 136, 151, 188, 195, 243, 280, 289, 333, 339, 349, 378, 382}, new short[]{9, 19, 39, 45, 87, 106, 117, 125, 126, 127, 154, 165, 202, 211, 256, 309, 360, 397, 398}, new short[]{14, 21, 65, 76, 87, 93, 97, 105, 131, 177, 212, 254, 294, 336, 349, 359, 381}, new short[]{36, 55, 65, 70, 87, 93, 96, 98, 108, 127, 254, 337, 352, 359, 375, 380}, new short[]{22, 42, 62, 82, 131, 132, 136, 158, 168, 196, 267, 305, 336}, new short[]{45, 69, 74, 75, 81, 120, 123, 126, 127, 130, 150, 171, 191, 194, 313, 339, 368, 378, 379, 389, 398}, new short[]{35, 43, 85, 98, 122, 131, 135, 176, 189, 250, 259, 277, 288, 303, 333, 336, 345, 376, 381, 387}, new short[]{1, 6, 34, 87, 115, 129, 131, 202, 235, 252, 256, 263, 317, 328, 349, 372, 391}, new short[]{3, 18, 42, 48, 84, 90, 92, 138, 193, 227, 288, 310, 315, 353, 375}, new short[]{2, 10, 31, 66, 124, 145, 240, 314, 334}, new short[]{32, 38, 84, 141, 165, 188, 193, 212, 346, 359, 379, 380}, new short[]{10, 75, 81, 96, 111, 140, 179, 298, 309, 353, 357, 359, 380, 396}, new short[]{2, 34, 121, 127, 132, 134, 184, 234, 244, 251, 262, 290, 308, 359, 380}, new short[]{17, 24, 93, 172, 186, 198, 218, 234, 239, 250, 252, 255, 307, 309, 325, 334, 354, 359}, new short[]{14, 18, 45, 50, 131, 174, 211, 237, 252, 267, 309, 334, 348, 351, 377, 391}, new short[]{32, 61, 87, 97, 125, 126, 132, 184, 249, 252, 273, 284, 288, 339, 383, 398}, new short[]{76, 81, 87, 127, 147, 161, 163, 199, 206, 306, 329, 340, 349, 353, 360, 383}, new short[]{14, 16, 76, 87, 101, 169, 188, 243, 246, 251, 253, 269, 298, 355, 375, 380}, new short[]{32, 79, 87, 103, 117, 125, 127, 177, 244, 301, 305, 317, 333, 338, 340, 342, 391}, new short[]{4, 67, 76, 121, 127, 130, 140, 158, 165, 186, 193, 251, 301, 303, 330, 336}, new short[]{11, 76, 83, 84, 87, 214, 248, 276, 299, 311, 320, 329, 332, 335, 371}, new short[]{2, 4, 19, 40, 42, 71, 98, 119, 121, 137, 167, 262, 288, 295, 306, 339, 350, 382}, new short[]{14, 40, 54, 90, 125, 129, 132, 146, 147, 165, 169, 176, 190, 253, 284, 303, 307, 316, 339, 342, 359, 389}, new short[]{47, 59, 71, 103, 125, 126, 129, 130, 200, 206, 240, 254, 276, 282, 299, 303, 307, 318, 320, 336, 338, 357, 362, 380, 387, 392}, new short[]{4, 22, 58, 102, 113, 115, 153, 167, 188, 212, 262, 286, 305, 333, 348, 354, 360, 371, 379, 386}, new short[]{5, 6, 56, 61, 108, 128, 129, 164, 165, 177, 182, 225, 226, 235, 244, 246, 249, 310, 333, 348, 349, 381, 391}, new short[]{18, 32, 33, 53, 56, 176, 186, 199, 200, 244, 246, 248, 259, 285, 289, 306, 358, 371, 373, 375, 379}, new short[]{40, 43, 70, 76, 83, 84, 90, 93, 101, 125, 159, 204, 276, 282, 304, 320, 339, 351, 353, 367, 391}, new short[]{14, 19, 59, 71, 76, 87, 93, 97, 105, 111, 120, 121, 122, 154, 171, 211, 231, 244, 286, 288, 341, 351}, new short[]{10, 56, 65, 72, 92, 108, 123, 129, 212, 258, 329, 353, 359}, new short[]{5, 76, 124, 127, 161, 172, 188, 244, 250, 266, 290, 318, 347, 351, 369, 382, 391, 395}, new short[]{1, 33, 86, 120, 121, 130, 154, 162, 173, 192, 241, 244, 262, 338, 339, 343, 353, 380, 390}, new short[]{1, 15, 22, 54, 57, 85, 126, 127, 176, 188, 248, 305, 332, 347, 349, 358, 367}, new short[]{91, 111, 122, 125, 130, 178, 190, 224, 225, 226, 235, 286, 308, 329, 334, 345, 346, 349, 358, 362, 367}, new short[]{16, 26, 51, 54, 84, 85, 98, 120, 272, 319, 349, 359, 360, 362, 377, 391, 398}, new short[]{73, 85, 102, 109, 128, 153, 171, 184, 248, 249, 256, 298, 300, 335, 338, 340, 355, 370}, new short[]{9, 108, 122, 131, 164, 168, 173, 176, 195, 218, 235, 286, 341, 350, 353, 358, 375, 377}, new short[]{25, 62, 125, 140, 165, 173, 200, 225, 226, 243, 283, 286, 329, 343, 357, 366, 377}, new short[]{10, 35, 58, 64, 98, 103, 125, 127, 129, 135, 141, 165, 169, 175, 189, 244, 258, 259, 306, 331, 333, 378, 380, 391}, new short[]{54, 87, 89, 99, 116, 125, 129, 221, 246, 269, 324, 335, 348, 351}, new short[]{85, 90, 103, 115, 131, 134, 165, 207, 282, 307, 313, 328, 346, 349, 380, 383, 387, 398}, new short[]{10, 40, 74, 84, 160, 239, 253, 272, 282, 333, 344, 351, 359, 360, 379}, new short[]{32, 38, 54, 74, 76, 117, 163, 171, 176, 217, 227, 250, 251, 280, 329, 330, 350, 378}, new short[]{13, 20, 40, 107, 129, 135, 154, 158, 161, 163, 179, 206, 281, 315, 325, 351, 355, 359, 397}, new short[]{0, 4, 37, 49, 62, 98, 117, 129, 177, 244, 285, 289, 306, 338, 360, 381}, new short[]{36, 38, 43, 61, 71, 87, 120, 128, 172, 200, 235, 247, 251, 282, 299, 329, 341, 352, 355}, new short[]{43, 71, 83, 85, 108, 117, 118, 121, 133, 138, 165, 206, 231, 254, 290, 291, 335, 336, 359, 362, 377}, new short[]{29, 32, 71, 103, 122, 125, 198, 224, 244, 285, 303, 333, 335, 337}, new short[]{54, 55, 82, 87, 101, 108, 127, 229, 230, 269, 290, 306, 349, 353}, new short[]{9, 117, 126, 137, 154, 165, 167, 186, 192, 229, 277, 283, 301, 317, 365, 367, 372, 378}, new short[]{4, 11, 19, 47, 51, 92, 110, 132, 137, 140, 290, 298, 361, 377, 379}, new short[]{23, 83, 98, 134, 165, 170, 186, 190, 253, 269, 308, 322, 327, 332, 335, 344, 398}, new short[]{60, 83, 111, 129, 173, 176, 186, 232, 306, 327, 329, 349, 355}, new short[]{25, 31, 40, 56, 72, 95, 126, 144, 149, 161, 173, 240, 262, 332, 333, 356, 368, 391, 394}, new short[]{91, 127, 134, 144, 155, 158, 161, 232, 251, 280, 287, 353, 380, 394}, new short[]{37, 43, 57, 84, 87, 149, 175, 288, 330, 380}, new short[]{8, 9, 83, 97, 120, 128, 158, 171, 193, 232, 287, 308, 309, 334, 355}, new short[]{39, 40, 62, 82, 94, 98, 101, 144, 147, 205, 290, 333, 339, 353, 372, 397}, new short[]{10, 20, 38, 125, 135, 138, 168, 180, 191, 203, 231, 250, 280, 301, 328, 345, 388}, new short[]{44, 54, 64, 87, 117, 122, 127, 154, 234, 239, 244, 298, 329, 378, 383}, new short[]{13, 62, 70, 97, 121, 176, 244, 267, 282, 318, 324, 334, 341, 353, 386, 388}, new short[]{40, 89, 91, 117, 125, 131, 155, 173, 193, 244, 273, 277, 328, 333, 360, 382}, new short[]{30, 47, 95, 108, 127, 165, 188, 211, 273, 349, 354, 368, 391}, new short[]{19, 52, 87, 98, 100, 122, 125, 157, 159, 215, 217, 235, 254, 309, 336, 344, 349, 382}, new short[]{19, 85, 87, 136, 144, 180, 190, 229, 310, 345, 365, 376, 390}, new short[]{35, 52, 87, 113, 124, 135, 145, 167, 174, 225, 226, 244, 247, 300, 359}, new short[]{10, 35, 69, 103, 129, 144, 165, 180, 230, 232, 329, 335, 353, 359, 371, 390}, new short[]{5, 13, 80, 83, 135, 139, 142, 176, 179, 190, 205, 217, 282, 298, 308, 334, 353, 359}, new short[]{24, 52, 67, 108, 135, 138, 153, 176, 231, 249, 283, 304, 337, 351, 353, 355}, new short[]{90, 93, 127, 132, 136, 163, 165, 196, 284, 306, 353, 383}, new short[]{20, 37, 103, 126, 135, 184, 204, 215, 221, 288, 300, 329, 339, 358, 383}, new short[]{16, 36, 52, 99, 117, 136, 171, 190, 243, 244, 303, 315, 333, 349, 373, 382}, new short[]{0, 57, 69, 98, 125, 129, 132, 158, 165, 190, 191, 193, 198, 254, 256, 285, 288, 303, 339, 346, 351, 391}, new short[]{1, 13, 21, 87, 125, 132, 150, 204, 240, 249, 253, 265, 288, 334, 343, 348, 349, 359}, new short[]{29, 40, 71, 80, 91, 99, 122, 203, 289, 290, 298, 329, 353, 380, 390}, new short[]{2, 5, 36, 57, 93, 102, 135, 140, 314, 343, 398}, new short[]{20, 59, 107, 193, 204, 246, 247, 336, 341, 342, 354, 359, 360, 383}, new short[]{47, 71, 93, 111, 116, 120, 122, 130, 251, 286, 298, 299, 348}, new short[]{21, 52, 56, 69, 76, 118, 120, 125, 137, 274, 280, 324, 327, 335, 339, 340}, new short[]{23, 29, 57, 75, 98, 132, 149, 157, 160, 235, 244, 288, 327, 340, 354, 372, 377}, new short[]{4, 22, 97, 103, 111, 129, 131, 151, 158, 176, 204, 248, 265, 309, 359, 391, 392}, new short[]{15, 17, 73, 105, 115, 170, 186, 228, 255, 317, 321, 339, 349, 379, 380, 381}, new short[]{17, 52, 72, 103, 188, 329, 342, 353, 358, 359, 374, 376, 380, 393}, new short[]{40, 48, 74, 124, 135, 191, 225, 226, 237, 291, 300, 304, 310, 347, 359, 380, 396}, new short[]{2, 36, 47, 57, 122, 125, 174, 188, 203, 224, 255, 325, 353, 359, 387}, new short[]{13, 58, 69, 83, 115, 120, 134, 161, 165, 174, 175, 191, 246, 255, 280, 353, 357, 358, 359, 379}, new short[]{1, 29, 47, 87, 89, 135, 176, 190, 209, 236, 304, 344, 348, 358, 359, 378}, new short[]{8, 13, 40, 52, 58, 61, 71, 125, 144, 168, 189, 210, 260, 337, 338, 340, 347, 376, 380}, new short[]{29, 90, 126, 127, 129, 136, 145, 159, 165, 188, 274, 284, 288, 316, 329, 358, 380}, new short[]{2, 19, 103, 120, 123, 159, 165, 175, 177, 180, 238, 244, 251, 294, 329, 342, 345, 349, 357, 376, 392}, new short[]{41, 42, 59, 71, 81, 98, 101, 117, 159, 171, 180, 240, 285, 290, 299, 344, 353}, new short[]{83, 103, 108, 142, 175, 248, 290, 300, 321, 354, 365, 374, 382}, new short[]{12, 67, 105, 130, 140, 171, 188, 192, 244, 276, 290, 302, 348, 349, 357, 360, 380}, new short[]{4, 13, 36, 65, 75, 160, 165, 185, 198, 235, 293, 324, 327, 333, 345, 347, 375, 383}, new short[]{37, 61, 80, 125, 234, 283, 290, 353, 359, 378, 383}, new short[]{9, 32, 83, 110, 155, 248, 252, 288, 313}, new short[]{37, 48, 52, 93, 167, 170, 179, 244, 267, 288, 296, 333, 335, 355, 374}, new short[]{35, 92, 98, 153, 165, 184, 215, 233, 242, 290, 339, 355}, new short[]{9, 38, 83, 121, 127, 165, 176, 235, 253, 305, 330, 337, 355, 358, 359}, new short[]{35, 117, 122, 125, 132, 136, 183, 235, 254, 280, 285, 286, 329, 334, 338, 353, 372}, new short[]{6, 87, 117, 125, 141, 144, 153, 157, 179, 215, 267, 272, 289, 329, 336, 359}, new short[]{7, 14, 37, 82, 135, 147, 154, 202, 244, 290, 297, 298, 345, 355, 368, 383}, new short[]{105, 135, 173, 244, 255, 280, 288, 299, 304, 307, 337, 338, 341, 344}, new short[]{19, 31, 33, 77, 92, 99, 114, 151, 173, 202, 253, 318, 329, 333, 358, 371}, new short[]{1, 8, 14, 30, 39, 120, 157, 172, 227, 229, 251, 257, 272, 339, 380}, new short[]{19, 98, 171, 191, 213, 246, 289, 353, 357, 366, 374, 383}, new short[]{8, 98, 125, 126, 144, 152, 244, 277, 282, 290, 322, 393}, new short[]{17, 206, 211, 224, 336, 338, 386}, new short[]{52, 55, 71, 99, 105, 191, 211, 215, 224, 246, 290, 300, 336, 339, 361}, new short[]{15, 16, 44, 66, 96, 121, 127, 162, 167, 202, 219, 243, 244, 254, 282, 320, 345, 390}, new short[]{7, 83, 92, 121, 130, 160, 177, 280, 308, 309, 339, 350, 352, 358, 380, 390}, new short[]{67, 122, 144, 148, 170, 173, 184, 222, 280, 374}, new short[]{2, 4, 15, 19, 115, 130, 136, 148, 172, 180, 243, 251, 313, 329, 333, 359, 364}, new short[]{90, 98, 108, 124, 167, 176, 202, 254, 286, 351, 359}, new short[]{80, 126, 135, 167, 212, 242, 243, 256, 283, 286, 295, 327, 337, 340, 346, 357, 358, 364}, new short[]{19, 108, 125, 132, 149, 172, 180, 186, 200, 254, 286, 296, 339, 344, 350, 359, 391}, new short[]{62, 65, 67, 105, 127, 129, 132, 250, 298, 307, 334, 344, 359, 383}, new short[]{31, 59, 87, 107, 121, 131, 132, 160, 244, 246, 247, 253, 344, 360, 394}, new short[]{4, 39, 76, 125, 130, 148, 168, 170, 191, 196, 298, 306, 327, 338, 345, 349, 360, 375}, new short[]{13, 14, 32, 84, 98, 122, 126, 156, 188, 235, 255, 330, 336, 338, 375, 380, 389}, new short[]{5, 18, 31, 54, 71, 74, 76, 81, 87, 93, 126, 129, 182, 303, 327, 353, 359, 373, 391}, new short[]{13, 37, 64, 137, 138, 180, 244, 247, 251, 253, 269, 284, 308, 344, 374, 376}, new short[]{5, 7, 10, 23, 35, 125, 168, 169, 187, 191, 192, 313, 337, 340, 342, 365}, new short[]{62, 67, 122, 125, 165, 190, 217, 243, 254, 256, 265, 299, 318, 353, 394}, new short[]{4, 24, 62, 92, 109, 118, 134, 143, 144, 176, 190, 199, 221, 299, 349, 380}, new short[]{22, 35, 64, 74, 92, 113, 161, 172, 193, 282, 287, 307, 359, 393}, new short[]{37, 50, 66, 75, 76, 78, 82, 87, 139, 159, 172, 176, 188, 231, 352, 371}, new short[]{19, 31, 75, 121, 144, 152, 163, 171, 172, 198, 243, 246, 285, 288, 289, 333, 344, 347, 357, 398}, new short[]{1, 15, 17, 51, 57, 65, 69, 127, 241, 244, 254, 259, 329, 336, 358}, new short[]{9, 95, 117, 121, 125, 137, 204, 242, 247, 301, 309, 314, 334, 339, 350, 354, 358}, new short[]{9, 61, 96, 111, 130, 163, 180, 211, 225, 226, 241, 253, 282, 283, 346, 355, 359, 380, 383}, new short[]{94, 117, 121, 124, 126, 130, 135, 172, 199, 232, 286, 325, 336, 352, 362, 375}, new short[]{110, 125, 163, 250, 265, 303, 329, 334, 391}, new short[]{47, 72, 76, 111, 125, 157, 169, 245, 254, 285, 287, 297, 298, 336, 353, 359, 383}, new short[]{62, 93, 115, 125, 127, 130, 174, 231, 308, 310, 329, 333, 355, 359, 390}, new short[]{44, 116, 163, 167, 180, 191, 200, 245, 254, 329, 343, 345, 354, 364}, new short[]{31, 62, 105, 108, 144, 145, 162, 173, 177, 191, 198, 247, 249, 344, 345, 348, 353}, new short[]{29, 65, 66, 74, 83, 87, 125, 148, 165, 228, 334, 353, 359, 380, 383, 391}, new short[]{2, 15, 125, 130, 239, 290, 312, 336, 337, 341, 398}, new short[]{40, 76, 87, 114, 119, 120, 165, 229, 265, 313, 324, 349, 358, 383}, new short[]{48, 62, 87, 91, 103, 186, 195, 212, 214, 315, 322, 327, 330, 338, 339}, new short[]{9, 32, 85, 108, 135, 191, 224, 237, 257, 288, 307, 310, 313, 318, 329, 337, 352, 395}, new short[]{87, 93, 102, 112, 129, 154, 171, 236, 317, 320, 349, 350, 359, 380}, new short[]{1, 14, 92, 111, 137, 140, 186, 290, 329, 336, 354, 355, 378, 379, 383}, new short[]{7, 26, 37, 47, 84, 101, 144, 153, 175, 180, 198, 232, 243, 305, 333, 353, 357, 383}, new short[]{20, 58, 76, 93, 99, 127, 134, 154, 188, 206, 246, 312, 313, 324}, new short[]{2, 12, 117, 125, 160, 167, 188, 206, 279, 285, 287, 301, 329, 332, 333, 336, 344, 362}, new short[]{2, 76, 126, 127, 137, 165, 244, 288, 290, 339, 346, 351, 359, 365, 383}, new short[]{66, 108, 136, 151, 174, 265, 344, 351, 353, 357, 378, 386}, new short[]{8, 76, 87, 90, 111, 116, 124, 176, 198, 334, 337, 349, 359, 379, 394}, new short[]{32, 36, 42, 76, 81, 125, 127, 205, 227, 262, 280, 288, 326, 336, 390, 398}, new short[]{9, 32, 65, 83, 89, 93, 97, 122, 129, 178, 180, 215, 241, 246, 323, 332, 353, 362, 364, 380}, new short[]{5, 24, 56, 127, 130, 155, 184, 191, 217, 235, 245, 339, 344, 358, 359, 362, 380}, new short[]{14, 40, 64, 71, 93, 108, 131, 165, 188, 204, 217, 235, 237, 241, 248, 308, 309, 318, 380, 387}, new short[]{17, 29, 34, 74, 125, 175, 184, 196, 211, 275, 301, 318, 327, 334, 349, 355, 358, 368}, new short[]{15, 45, 110, 111, 116, 129, 132, 211, 247, 275, 286, 317, 333, 334, 377, 383}, new short[]{4, 5, 59, 87, 103, 124, 125, 127, 130, 165, 241, 265, 299, 353, 360}, new short[]{31, 120, 124, 135, 154, 197, 235, 243, 247, 248, 258, 309, 320, 335, 357}, new short[]{50, 125, 127, 130, 137, 147, 171, 172, 267, 289, 301, 308, 325, 334, 337, 353, 360, 374, 391}, new short[]{62, 64, 69, 87, 111, 118, 129, 134, 212, 239, 244, 246, 250, 254, 307, 322, 329, 370, 372}, new short[]{54, 92, 128, 160, 198, 244, 248, 255, 284, 314, 335, 349, 358, 360, 376, 380}, new short[]{9, 13, 29, 54, 72, 89, 110, 122, 126, 139, 158, 159, 163, 230, 304, 306, 313}, new short[]{1, 9, 54, 95, 108, 132, 176, 193, 243, 251, 339, 378}, new short[]{0, 96, 99, 135, 137, 184, 212, 232, 251, 315, 334}, new short[]{140, 157, 165, 182, 235, 294, 314, 349, 354, 365}, new short[]{14, 18, 31, 56, 117, 125, 138, 227, 246, 283, 334, 345, 352, 357, 361}, new short[]{0, 71, 82, 130, 131, 144, 161, 235, 247, 301, 333, 335, 345, 353, 355, 359, 360, 374}, new short[]{6, 23, 35, 117, 125, 141, 169, 200, 244, 288, 298, 338, 353, 379}, new short[]{10, 98, 125, 127, 138, 153, 219, 244, 307, 350, 353, 366, 367}, new short[]{9, 32, 40, 122, 126, 127, 170, 176, 300, 334, 350, 391}, new short[]{6, 13, 31, 87, 89, 97, 125, 165, 171, 173, 176, 244, 331, 348, 373}, new short[]{10, 61, 87, 105, 123, 125, 127, 195, 260, 265, 323, 361, 362}, new short[]{2, 20, 90, 124, 353, 354, 378, 382}, new short[]{5, 48, 58, 83, 98, 117, 125, 126, 196, 198}, new short[]{13, 37, 50, 64, 66, 79, 99, 132, 135, 244, 247, 380}, new short[]{57, 165, 235, 238, 248, 272, 287, 299, 327, 329, 334, 350, 353, 380}, new short[]{55, 66, 118, 125, 130, 169, 250, 255, 271, 314, 324, 338, 353}, new short[]{7, 31, 62, 84, 103, 105, 111, 126, 132, 149, 154, 191, 250, 334, 372, 375}, new short[]{56, 81, 114, 117, 120, 124, 127, 128, 154, 254, 290, 317, 345, 354}, new short[]{4, 13, 86, 101, 153, 191, 193, 231, 243, 258, 283, 288, 308, 353, 387, 392}, new short[]{5, 37, 58, 62, 67, 84, 87, 176, 237, 267, 333, 334, 347}, new short[]{1, 7, 74, 110, 165, 168, 182, 233, 288, 305, 309, 315, 347, 351, 353, 358, 360, 375}, new short[]{57, 84, 129, 138, 165, 243, 244, 259, 280, 282, 290, 380, 383} }; } }
2881099/IdleBus
1,116
Examples/Examples_IdleBus_Quickstart/Program.cs
using System; namespace Examples_IdleBus_Quickstart { class Program { static void Main(string[] args) { //超过20秒没有使用,就销毁【实例】 var ib = new IdleBus(TimeSpan.FromSeconds(20)); ib.Notice += (_, e) => { Console.WriteLine(" " + e.Log); if (e.NoticeType == IdleBus<IDisposable>.NoticeType.AutoRelease) Console.WriteLine($" [{DateTime.Now.ToString("g")}] {e.Key} 空闲被回收"); }; while (true) { Console.WriteLine("输入 > "); var line = Console.ReadLine().Trim(); if (string.IsNullOrEmpty(line)) break; // 注册 ib.TryRegister(line, () => new TestInfo()); // 第一次:创建 TestInfo item = ib.Get(line) as TestInfo; // 第二次:直接获取,长驻内存直到空闲销毁 item = ib.Get(line) as TestInfo; } ib.Dispose(); } class TestInfo : IDisposable { public void Dispose() { } } } }
2881099/IdleBus
3,625
Examples/Examples_IdleBus_WinformNet40/Examples_IdleBus_WinformNet40.csproj
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProjectGuid>{0FC8305A-114E-4792-9226-726FE3651CB0}</ProjectGuid> <OutputType>WinExe</OutputType> <RootNamespace>Examples_IdleBus_WinformNet40</RootNamespace> <AssemblyName>Examples_IdleBus_WinformNet40</AssemblyName> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <Deterministic>true</Deterministic> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PlatformTarget>AnyCPU</PlatformTarget> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PlatformTarget>AnyCPU</PlatformTarget> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="System" /> <Reference Include="System.Core" /> <Reference Include="System.Xml.Linq" /> <Reference Include="System.Data.DataSetExtensions" /> <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Data" /> <Reference Include="System.Deployment" /> <Reference Include="System.Drawing" /> <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="Form1.cs"> <SubType>Form</SubType> </Compile> <Compile Include="Form1.Designer.cs"> <DependentUpon>Form1.cs</DependentUpon> </Compile> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <EmbeddedResource Include="Form1.resx"> <DependentUpon>Form1.cs</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="Properties\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> <SubType>Designer</SubType> </EmbeddedResource> <Compile Include="Properties\Resources.Designer.cs"> <AutoGen>True</AutoGen> <DependentUpon>Resources.resx</DependentUpon> <DesignTime>True</DesignTime> </Compile> <None Include="Properties\Settings.settings"> <Generator>SettingsSingleFileGenerator</Generator> <LastGenOutput>Settings.Designer.cs</LastGenOutput> </None> <Compile Include="Properties\Settings.Designer.cs"> <AutoGen>True</AutoGen> <DependentUpon>Settings.settings</DependentUpon> <DesignTimeSharedInput>True</DesignTimeSharedInput> </Compile> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\IdleBus\IdleBus.csproj"> <Project>{ab044be0-8676-481f-a454-3ad68b8bbe54}</Project> <Name>IdleBus</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
2881099/IdleBus
5,715
Examples/Examples_IdleBus_WinformNet40/Form1.Designer.cs
namespace Examples_IdleBus_WinformNet40 { partial class Form1 { /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// 清理所有正在使用的资源。 /// </summary> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows 窗体设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要修改 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button(); this.button5 = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.button6 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // button1 // this.button1.Location = new System.Drawing.Point(53, 119); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(138, 23); this.button1.TabIndex = 0; this.button1.Text = "IdleBus.Test()"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // this.button2.Location = new System.Drawing.Point(147, 271); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(183, 23); this.button2.TabIndex = 1; this.button2.Text = "IdleBus.Get(key1)"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // // button3 // this.button3.Location = new System.Drawing.Point(147, 300); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(183, 23); this.button3.TabIndex = 2; this.button3.Text = "IdleBus.Get(key2)"; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click); // // button4 // this.button4.Location = new System.Drawing.Point(147, 230); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(183, 23); this.button4.TabIndex = 3; this.button4.Text = "new IdleBus()"; this.button4.UseVisualStyleBackColor = true; this.button4.Click += new System.EventHandler(this.button4_Click); // // button5 // this.button5.Location = new System.Drawing.Point(147, 408); this.button5.Name = "button5"; this.button5.Size = new System.Drawing.Size(183, 23); this.button5.TabIndex = 4; this.button5.Text = "IdleBus.Dispose()"; this.button5.UseVisualStyleBackColor = true; this.button5.Click += new System.EventHandler(this.button5_Click); // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label1.Location = new System.Drawing.Point(400, 289); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(75, 20); this.label1.TabIndex = 5; this.label1.Text = "label1"; // // button6 // this.button6.Location = new System.Drawing.Point(147, 329); this.button6.Name = "button6"; this.button6.Size = new System.Drawing.Size(183, 23); this.button6.TabIndex = 6; this.button6.Text = "IdleBus.Get Concurrent"; this.button6.UseVisualStyleBackColor = true; this.button6.Click += new System.EventHandler(this.button6_Click); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 450); this.Controls.Add(this.button6); this.Controls.Add(this.label1); this.Controls.Add(this.button5); this.Controls.Add(this.button4); this.Controls.Add(this.button3); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button5; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button button6; } }
2881099/NPinyin
4,465
Pinyin.cs
using System; using System.Collections.Generic; using System.Text; namespace NPinyin { public static class Pinyin { /// <summary> /// 取中文文本的拼音首字母 /// </summary> /// <param name="text">编码为UTF8的文本</param> /// <returns>返回中文对应的拼音首字母</returns> public static string GetInitials(string text) { text = text.Trim(); StringBuilder chars = new StringBuilder(); for (var i = 0; i < text.Length; ++i) { string py = GetPinyin(text[i]); if (py != "") chars.Append(py[0]); } return chars.ToString().ToUpper(); } /// <summary> /// 取中文文本的拼音首字母 /// </summary> /// <param name="text">文本</param> /// <param name="encoding">源文本的编码</param> /// <returns>返回encoding编码类型中文对应的拼音首字母</returns> public static string GetInitials(string text, Encoding encoding) { string temp = ConvertEncoding(text, encoding, Encoding.UTF8); return ConvertEncoding(GetInitials(temp), Encoding.UTF8, encoding); } /// <summary> /// 取中文文本的拼音 /// </summary> /// <param name="text">编码为UTF8的文本</param> /// <returns>返回中文文本的拼音</returns> public static string GetPinyin(string text) { StringBuilder sbPinyin = new StringBuilder(); for (var i = 0; i < text.Length; ++i) { string py = GetPinyin(text[i]); if (py != "") sbPinyin.Append(py); sbPinyin.Append(" "); } return sbPinyin.ToString().Trim(); } /// <summary> /// 取中文文本的拼音 /// </summary> /// <param name="text">编码为UTF8的文本</param> /// <param name="encoding">源文本的编码</param> /// <returns>返回encoding编码类型的中文文本的拼音</returns> public static string GetPinyin(string text, Encoding encoding) { string temp = ConvertEncoding(text.Trim(), encoding, Encoding.UTF8); return ConvertEncoding(GetPinyin(temp), Encoding.UTF8, encoding); } /// <summary> /// 取和拼音相同的汉字列表 /// </summary> /// <param name="pinyin">编码为UTF8的拼音</param> /// <returns>取拼音相同的汉字列表,如拼音“ai”将会返回“唉爱……”等</returns> public static string GetChineseText(string pinyin) { string key = pinyin.Trim().ToLower(); foreach (string str in PyCode.codes) { if (str.StartsWith(key + " ") || str.StartsWith(key + ":")) return str.Substring(7); } return ""; } /// <summary> /// 取和拼音相同的汉字列表,编码同参数encoding /// </summary> /// <param name="pinyin">编码为encoding的拼音</param> /// <param name="encoding">编码</param> /// <returns>返回编码为encoding的拼音为pinyin的汉字列表,如拼音“ai”将会返回“唉爱……”等</returns> public static string GetChineseText(string pinyin, Encoding encoding) { string text = ConvertEncoding(pinyin, encoding, Encoding.UTF8); return ConvertEncoding(GetChineseText(text), Encoding.UTF8, encoding); } /// <summary> /// 返回单个字符的汉字拼音 /// </summary> /// <param name="ch">编码为UTF8的中文字符</param> /// <returns>ch对应的拼音</returns> public static string GetPinyin(char ch) { short hash = GetHashIndex(ch); for (var i = 0; i < PyHash.hashes[hash].Length; ++i) { short index = PyHash.hashes[hash][i]; var pos = PyCode.codes[index].IndexOf(ch, 7); if (pos != -1) return PyCode.codes[index].Substring(0, 6).Trim(); } return ch.ToString(); } /// <summary> /// 返回单个字符的汉字拼音 /// </summary> /// <param name="ch">编码为encoding的中文字符</param> /// <returns>编码为encoding的ch对应的拼音</returns> public static string GetPinyin(char ch, Encoding encoding) { ch = ConvertEncoding(ch.ToString(), encoding, Encoding.UTF8)[0]; return ConvertEncoding(GetPinyin(ch), Encoding.UTF8, encoding); } /// <summary> /// 转换编码 /// </summary> /// <param name="text">文本</param> /// <param name="srcEncoding">源编码</param> /// <param name="dstEncoding">目标编码</param> /// <returns>目标编码文本</returns> public static string ConvertEncoding(string text, Encoding srcEncoding, Encoding dstEncoding) { byte[] srcBytes = srcEncoding.GetBytes(text); byte[] dstBytes = Encoding.Convert(srcEncoding, dstEncoding, srcBytes); return dstEncoding.GetString(dstBytes); } /// <summary> /// 取文本索引值 /// </summary> /// <param name="ch">字符</param> /// <returns>文本索引值</returns> private static short GetHashIndex(char ch) { return (short)((uint)ch % PyCode.codes.Length); } } }
2881099/IdleBus
2,627
Examples/Examples_IdleBus_WinformNet40/Form1.cs
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading; using System.Windows.Forms; namespace Examples_IdleBus_WinformNet40 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { IdleBus.Test(); } IdleBus ib; private void Form1_Load(object sender, EventArgs e) { } private void button4_Click(object sender, EventArgs e) { ib?.Dispose(); ib = new IdleBus(TimeSpan.FromSeconds(10)); ib.Notice += (_, e2) => { var log = $"[{DateTime.Now.ToString("HH:mm:ss")}] 线程{Thread.CurrentThread.ManagedThreadId}:{e2.Log}"; //Trace.WriteLine(log); Console.WriteLine(log); }; var key1Val = new ManualResetEvent(false); ib .Register("key1", () => key1Val) //姿势错误,第二次创建时会抛出异常 .Register("key2", () => new AutoResetEvent(false)); for (var a = 3; a < 2000; a++) ib.Register("key" + a, () => new System.Data.SqlClient.SqlConnection()); } private void button2_Click(object sender, EventArgs e) { label1.Text = ib.Get("key1")?.ToString(); } private void button3_Click(object sender, EventArgs e) { label1.Text = ib.Get("key2")?.ToString(); } private void button6_Click(object sender, EventArgs e) { var now = DateTime.Now; int counter = 100 * 1000; for (var k = 0; k < 100; k++) { new Thread(() => { var rnd = new Random(); for (var a = 0; a < 1000; a++) { for (var l = 0; l < 10; l++) { ib.Get("key" + rnd.Next(1, 2000)); } if (Interlocked.Decrement(ref counter) <= 0) MessageBox.Show($"测试完成,100线程并发 ib.Get() 获取100万次,耗时:{DateTime.Now.Subtract(now).TotalMilliseconds}ms"); } }).Start(); } } private void button5_Click(object sender, EventArgs e) { ib?.Dispose(); } } }
2881099/NPinyin
11,323
PyCode.cs
using System; using System.Collections.Generic; using System.Text; namespace NPinyin { internal class PyCode { internal static string[] codes = new string[]{ "a :阿啊吖嗄腌锕", "ai :爱埃碍矮挨唉哎哀皑癌蔼艾隘捱嗳嗌嫒瑷暧砹锿霭", "an :安按暗岸案俺氨胺鞍谙埯揞犴庵桉铵鹌黯", "ang :昂肮盎", "ao :凹奥敖熬翱袄傲懊澳坳拗嗷岙廒遨媪骜獒聱螯鏊鳌鏖", "ba :把八吧巴拔霸罢爸坝芭捌扒叭笆疤跋靶耙茇菝岜灞钯粑鲅魃", "bai :百白败摆柏佰拜稗捭掰", "ban :办半板班般版拌搬斑扳伴颁扮瓣绊阪坂钣瘢癍舨", "bang :帮棒邦榜梆膀绑磅蚌镑傍谤蒡浜", "bao :报保包剥薄胞暴宝饱抱爆堡苞褒雹豹鲍葆孢煲鸨褓趵龅", "bei :北被倍备背辈贝杯卑悲碑钡狈惫焙孛陂邶埤萆蓓呗悖碚鹎褙鐾鞴", "ben :本奔苯笨畚坌贲锛", "beng :泵崩绷甭蹦迸嘣甏", "bi :比必避闭辟笔壁臂毕彼逼币鼻蔽鄙碧蓖毙毖庇痹敝弊陛匕俾荜荸薜吡哔狴庳愎滗濞弼妣婢嬖璧畀铋秕裨筚箅篦舭襞跸髀", "bian :变边便编遍辩扁辨鞭贬卞辫匾弁苄忭汴缏飚煸砭碥窆褊蝙笾鳊", "biao :表标彪膘婊骠杓飑飙镖镳瘭裱鳔髟", "bie :别鳖憋瘪蹩", "bin :宾彬斌濒滨摈傧豳缤玢槟殡膑镔髌鬓", "bing :并病兵柄冰丙饼秉炳禀邴摒", "bo :波播伯拨博勃驳玻泊菠钵搏铂箔帛舶脖膊渤亳啵饽檗擘礴钹鹁簸跛踣", "bu :不部步布补捕卜哺埠簿怖卟逋瓿晡钚钸醭", "ca :擦嚓礤", "cai :采才材菜财裁彩猜睬踩蔡", "can :参残蚕灿餐惭惨孱骖璨粲黪", "cang :藏仓苍舱沧", "cao :草槽操糙曹嘈漕螬艚", "ce :测策侧册厕恻", "cen :岑涔", "ceng :层蹭", "cha :查差插察茶叉茬碴搽岔诧猹馇汊姹杈楂槎檫锸镲衩", "chai :柴拆豺侪钗瘥虿", "chan :产铲阐搀掺蝉馋谗缠颤冁谄蒇廛忏潺澶羼婵骣觇禅镡蟾躔", "chang :长常场厂唱肠昌倡偿畅猖尝敞伥鬯苌菖徜怅惝阊娼嫦昶氅鲳", "chao :朝超潮巢抄钞嘲吵炒怊晁耖", "che :车彻撤扯掣澈坼砗", "chen :陈沉称衬尘臣晨郴辰忱趁伧谌谶抻嗔宸琛榇碜龀", "cheng :成程称城承乘呈撑诚橙惩澄逞骋秤丞埕噌枨柽塍瞠铖铛裎蛏酲", "chi :持尺齿吃赤池迟翅斥耻痴匙弛驰侈炽傺坻墀茌叱哧啻嗤彳饬媸敕眵鸱瘛褫蚩螭笞篪豉踟魑", "chong :虫充冲崇宠茺忡憧铳舂艟", "chou :抽仇臭酬畴踌稠愁筹绸瞅丑俦帱惆瘳雠", "chu :出处除初础触楚锄储橱厨躇雏滁矗搐亍刍怵憷绌杵楮樗褚蜍蹰黜", "chuai :揣搋啜膪踹", "chuan :传船穿串川椽喘舛遄巛氚钏舡", "chuang:床创窗闯疮幢怆", "chui :吹垂锤炊捶陲棰槌", "chun :春纯醇椿唇淳蠢莼鹑蝽", "chuo :戳绰辍踔龊", "ci :此次刺磁雌词茨疵辞慈瓷赐茈呲祠鹚糍", "cong :从丛聪葱囱匆苁淙骢琮璁", "cou :凑楱辏腠", "cu :粗促醋簇蔟徂猝殂酢蹙蹴", "cuan :篡蹿窜汆撺爨镩", "cui :催脆淬粹摧崔瘁翠萃啐悴璀榱毳隹", "cun :存村寸忖皴", "cuo :错措撮磋搓挫厝嵯脞锉矬痤鹾蹉", "da :大打达答搭瘩耷哒嗒怛妲疸褡笪靼鞑", "dai :代带待袋戴呆歹傣殆贷逮怠埭甙呔岱迨骀绐玳黛", "dan :单但弹担蛋淡胆氮丹旦耽郸掸惮诞儋萏啖殚赕眈疸瘅聃箪", "dang :党当档挡荡谠凼菪宕砀裆", "dao :到道导刀倒稻岛捣盗蹈祷悼叨忉氘纛", "de :的得德锝", "deng :等灯登邓蹬瞪凳噔嶝戥磴镫簦", "di :地第低敌底帝抵滴弟递堤迪笛狄涤翟嫡蒂缔氐籴诋谛邸荻嘀娣绨柢棣觌砥碲睇镝羝骶", "dia :嗲", "dian :电点垫典店颠淀掂滇碘靛佃甸惦奠殿阽坫巅玷钿癜癫簟踮", "diao :调掉吊碉叼雕凋刁钓铞铫貂鲷", "die :迭跌爹碟蝶谍叠垤堞揲喋牒瓞耋蹀鲽", "ding :定顶钉丁订盯叮鼎锭仃啶玎腚碇町疔耵酊", "diu :丢铥", "dong :动东冬懂洞冻董栋侗恫垌咚岽峒氡胨胴硐鸫", "dou :斗豆兜抖陡逗痘蔸窦蚪篼", "du :度都毒独读渡杜堵镀顿督犊睹赌肚妒芏嘟渎椟牍蠹笃髑黩", "duan :断端段短锻缎椴煅簖", "dui :对队堆兑怼憝碓", "dun :盾吨顿蹲敦墩囤钝遁沌炖砘礅盹镦趸", "duo :多夺朵掇哆垛躲跺舵剁惰堕咄哚沲缍柁铎裰踱", "e :而二尔儿恶额恩俄耳饵蛾饿峨鹅讹娥厄扼遏鄂噩谔垩苊莪萼呃愕屙婀轭腭锇锷鹗颚鳄", "ei :诶", "en :恩蒽摁", "er :而二尔儿耳饵洱贰佴迩珥铒鸸鲕", "fa :发法阀乏伐罚筏珐垡砝", "fan :反翻范犯饭繁泛番凡烦返藩帆樊矾钒贩蕃蘩幡梵燔畈蹯", "fang :方放防访房纺仿妨芳肪坊邡枋钫舫鲂", "fei :非肥飞费废肺沸菲匪啡诽吠芾狒悱淝妃绯榧腓斐扉镄痱蜚篚翡霏鲱", "fen :分粉奋份粪纷芬愤酚吩氛坟焚汾忿偾瀵棼鲼鼢", "feng :风封蜂丰缝峰锋疯奉枫烽逢冯讽凤俸酆葑唪沣砜", "fou :否缶", "fu :复服副府夫负富附福伏符幅腐浮辅付腹妇孵覆扶辐傅佛缚父弗甫肤氟敷拂俘涪袱抚俯釜斧脯腑赴赋阜讣咐匐凫郛芙苻茯莩菔拊呋幞怫滏艴孚驸绂绋桴赙祓砩黻黼罘稃馥蚨蜉蝠蝮麸趺跗鲋鳆", "ga :噶嘎尬尕尜旮钆", "gai :改该盖概钙溉丐陔垓戤赅", "gan :干杆感敢赶甘肝秆柑竿赣坩苷尴擀泔淦澉绀橄旰矸疳酐", "gang :刚钢缸纲岗港杠冈肛戆罡筻", "gao :高搞告稿膏篙皋羔糕镐睾诰郜藁缟槔槁杲锆", "ge :个各革格割歌隔哥铬阁戈葛搁鸽胳疙蛤鬲仡哿圪塥嗝搿膈硌镉袼虼舸骼", "gen :根跟亘茛哏艮", "geng :更耕颈庚羹埂耿梗哽赓绠鲠", "gong :工公共供功攻巩贡汞宫恭龚躬弓拱珙肱蚣觥", "gou :够构沟狗钩勾购苟垢佝诟岣遘媾缑枸觏彀笱篝鞲", "gu :鼓固古骨故顾股谷估雇孤姑辜菇咕箍沽蛊嘏诂菰崮汩梏轱牯牿臌毂瞽罟钴锢鸪痼蛄酤觚鲴鹘", "gua :挂刮瓜剐寡褂卦诖呱栝胍鸹", "guai :怪乖拐", "guan :关管观官灌贯惯冠馆罐棺倌莞掼涫盥鹳矜鳏", "guang :光广逛咣犷桄胱", "gui :规贵归硅鬼轨龟桂瑰圭闺诡癸柜跪刽匦刿庋宄妫桧炅晷皈簋鲑鳜", "gun :滚辊棍衮绲磙鲧", "guo :国过果锅郭裹馘埚掴呙帼崞猓椁虢聒蜾蝈", "ha :哈铪", "hai :还海害孩骸氦亥骇嗨胲醢", "han :含焊旱喊汉寒汗函韩酣憨邯涵罕翰撼捍憾悍邗菡撖阚瀚晗焓顸颔蚶鼾", "hang :航夯杭沆绗珩颃", "hao :好号毫耗豪郝浩壕嚎蒿薅嗥嚆濠灏昊皓颢蚝", "he :和合河何核赫荷褐喝贺呵禾盒菏貉阂涸鹤诃劾壑嗬阖纥曷盍颌蚵翮", "hei :黑嘿", "hen :很狠痕恨", "heng :横衡恒哼亨蘅桁", "hong :红洪轰烘哄虹鸿宏弘黉訇讧荭蕻薨闳泓", "hou :后候厚侯喉猴吼堠後逅瘊篌糇鲎骺", "hu :护互湖呼户弧乎胡糊虎忽瑚壶葫蝴狐唬沪冱唿囫岵猢怙惚浒滹琥槲轷觳烀煳戽扈祜瓠鹄鹕鹱笏醐斛", "hua :化花话划滑华画哗猾骅桦砉铧", "huai :坏怀淮槐徊踝", "huan :环换欢缓患幻焕桓唤痪豢涣宦郇奂萑擐圜獾洹浣漶寰逭缳锾鲩鬟", "huang :黄簧荒皇慌蝗磺凰惶煌晃幌恍谎隍徨湟潢遑璜肓癀蟥篁鳇", "hui :会回灰挥辉汇毁慧恢绘惠徽蛔悔卉晦贿秽烩讳诲诙茴荟蕙咴哕喙隳洄浍彗缋珲晖恚虺蟪麾", "hun :混浑荤昏婚魂诨馄阍溷", "huo :活或火货获伙霍豁惑祸劐藿攉嚯夥钬锪镬耠蠖", "ji :级及机极几积给基记己计集即际季激济技击继急剂既纪寄挤鸡迹绩吉脊辑籍疾肌棘畸圾稽箕饥讥姬缉汲嫉蓟冀伎祭悸寂忌妓藉丌亟乩剞佶偈诘墼芨芰荠蒺蕺掎叽咭哜唧岌嵴洎屐骥畿玑楫殛戟戢赍觊犄齑矶羁嵇稷瘠虮笈笄暨跻跽霁鲚鲫髻麂", "jia :加家架价甲夹假钾贾稼驾嘉枷佳荚颊嫁伽郏葭岬浃迦珈戛胛恝铗镓痂瘕袷蛱笳袈跏", "jian :间件见建坚减检践尖简碱剪艰渐肩键健柬鉴剑歼监兼奸箭茧舰俭笺煎缄硷拣捡荐槛贱饯溅涧僭谏谫菅蒹搛湔蹇謇缣枧楗戋戬牮犍毽腱睑锏鹣裥笕翦趼踺鲣鞯", "jiang :将降讲江浆蒋奖疆僵姜桨匠酱茳洚绛缰犟礓耩糨豇", "jiao :较教交角叫脚胶浇焦搅酵郊铰窖椒礁骄娇嚼矫侥狡饺缴绞剿轿佼僬艽茭挢噍峤徼姣敫皎鹪蛟醮跤鲛", "jie :结阶解接节界截介借届街揭洁杰竭皆秸劫桔捷睫姐戒藉芥疥诫讦拮喈嗟婕孑桀碣疖颉蚧羯鲒骱", "jin :进金近紧斤今尽仅劲浸禁津筋锦晋巾襟谨靳烬卺荩堇噤馑廑妗缙瑾槿赆觐衿", "jing :经精京径井静竟晶净境镜景警茎敬惊睛竞荆兢鲸粳痉靖刭儆阱菁獍憬泾迳弪婧肼胫腈旌", "jiong :炯窘迥扃", "jiu :就九旧究久救酒纠揪玖韭灸厩臼舅咎疚僦啾阄柩桕鸠鹫赳鬏", "ju :具据局举句聚距巨居锯剧矩拒鞠拘狙疽驹菊咀沮踞俱惧炬倨讵苣苴莒掬遽屦琚椐榘榉橘犋飓钜锔窭裾趄醵踽龃雎鞫", "juan :卷捐鹃娟倦眷绢鄄狷涓桊蠲锩镌隽", "jue :决觉绝掘撅攫抉倔爵诀厥劂谲矍蕨噘噱崛獗孓珏桷橛爝镢蹶觖", "jun :军均菌君钧峻俊竣浚郡骏捃皲筠麇", "ka :卡喀咖咯佧咔胩", "kai :开凯揩楷慨剀垲蒈忾恺铠锎锴", "kan :看刊坎堪勘砍侃莰戡龛瞰", "kang :抗康炕慷糠扛亢伉闶钪", "kao :考靠拷烤尻栲犒铐", "ke :可克科刻客壳颗棵柯坷苛磕咳渴课嗑岢恪溘骒缂珂轲氪瞌钶锞稞疴窠颏蝌髁", "ken :肯啃垦恳裉", "keng :坑吭铿", "kong :孔空控恐倥崆箜", "kou :口扣抠寇芤蔻叩眍筘", "ku :苦库枯酷哭窟裤刳堀喾绔骷", "kua :跨夸垮挎胯侉", "kuai :快块筷侩蒯郐哙狯脍", "kuan :宽款髋", "kuang :况矿狂框匡筐眶旷诓诳邝圹夼哐纩贶", "kui :奎溃馈亏盔岿窥葵魁傀愧馗匮夔隗蒉揆喹喟悝愦逵暌睽聩蝰篑跬", "kun :困昆坤捆悃阃琨锟醌鲲髡", "kuo :扩括阔廓蛞", "la :拉啦蜡腊蓝垃喇辣剌邋旯砬瘌", "lai :来赖莱崃徕涞濑赉睐铼癞籁", "lan :兰烂蓝览栏婪拦篮阑澜谰揽懒缆滥岚漤榄斓罱镧褴", "lang :浪朗郎狼琅榔廊莨蒗啷阆锒稂螂", "lao :老劳牢涝捞佬姥酪烙唠崂栳铑铹痨耢醪", "le :了乐勒肋仂叻泐鳓", "lei :类雷累垒泪镭蕾磊儡擂肋羸诔嘞嫘缧檑耒酹", "leng :冷棱楞塄愣", "li :理里利力立离例历粒厘礼李隶黎璃励犁梨丽厉篱狸漓鲤莉荔吏栗砾傈俐痢沥哩俪俚郦坜苈莅蓠藜呖唳喱猁溧澧逦娌嫠骊缡枥栎轹戾砺詈罹锂鹂疠疬蛎蜊蠡笠篥粝醴跞雳鲡鳢黧", "lia :俩", "lian :连联练炼脸链莲镰廉怜涟帘敛恋蔹奁潋濂琏楝殓臁裢裣蠊鲢", "liang :量两粮良亮梁凉辆粱晾谅墚椋踉靓魉", "liao :料疗辽僚撩聊燎寥潦撂镣廖蓼尥嘹獠寮缭钌鹩", "lie :列裂烈劣猎冽埒捩咧洌趔躐鬣", "lin :林磷临邻淋麟琳霖鳞凛赁吝蔺啉嶙廪懔遴檩辚膦瞵粼躏", "ling :领另零令灵岭铃龄凌陵拎玲菱伶羚酃苓呤囹泠绫柃棂瓴聆蛉翎鲮", "liu :流六留刘硫柳馏瘤溜琉榴浏遛骝绺旒熘锍镏鹨鎏", "long :龙垄笼隆聋咙窿拢陇垅茏泷珑栊胧砻癃", "lou :漏楼娄搂篓陋偻蒌喽嵝镂瘘耧蝼髅", "lu :路率露绿炉律虑滤陆氯鲁铝录旅卢吕芦颅庐掳卤虏麓碌赂鹿潞禄戮驴侣履屡缕垆撸噜闾泸渌漉逯璐栌榈橹轳辂辘氇胪膂镥稆鸬鹭褛簏舻鲈", "luan :卵乱峦挛孪滦脔娈栾鸾銮", "lue :略掠锊", "lun :论轮伦抡仑沦纶囵", "luo :落罗螺洛络逻萝锣箩骡裸骆倮蠃荦捋摞猡泺漯珞椤脶镙瘰雒", "m :呒", "ma :马麻吗妈骂嘛码玛蚂唛犸嬷杩蟆", "mai :麦脉卖买埋迈劢荬霾", "man :满慢曼漫蔓瞒馒蛮谩墁幔缦熳镘颟螨鳗鞔", "mang :忙芒盲茫氓莽邙漭硭蟒", "mao :毛矛冒貌贸帽猫茅锚铆卯茂袤茆峁泖瑁昴牦耄旄懋瞀蟊髦", "me :么麽", "mei :没每美煤霉酶梅妹眉玫枚媒镁昧寐媚莓嵋猸浼湄楣镅鹛袂魅", "men :们门闷扪焖懑钔", "meng :孟猛蒙盟梦萌锰檬勐甍瞢懵朦礞虻蜢蠓艋艨", "mi :米密迷蜜秘眯醚靡糜谜弥觅泌幂芈谧蘼咪嘧猕汨宓弭脒祢敉糸縻麋", "mian :面棉免绵眠冕勉娩缅沔渑湎腼眄", "miao :苗秒描庙妙瞄藐渺喵邈缈缪杪淼眇鹋", "mie :灭蔑咩蠛篾", "min :民敏抿皿悯闽苠岷闵泯缗玟珉愍黾鳘", "ming :命明名鸣螟铭冥茗溟暝瞑酩", "miu :谬", "mo :磨末模膜摸墨摩莫抹默摹蘑魔沫漠寞陌谟茉蓦馍嫫殁镆秣瘼耱貊貘", "mou :某谋牟侔哞眸蛑蝥鍪", "mu :亩目木母墓幕牧姆穆拇牡暮募慕睦仫坶苜沐毪钼", "n :嗯", "na :那南哪拿纳钠呐娜捺肭镎衲", "nai :耐奶乃氖奈鼐艿萘柰", "nan :南难男喃囝囡楠腩蝻赧", "nang :囊攮囔馕曩", "nao :脑闹挠恼淖孬垴呶猱瑙硇铙蛲", "ne :呢讷", "nei :内馁", "nen :嫩恁", "neng :能", "ni :你泥尼逆拟尿妮霓倪匿腻溺伲坭猊怩昵旎慝睨铌鲵", "nian :年念粘蔫拈碾撵捻酿廿埝辇黏鲇鲶", "niang :娘", "niao :尿鸟茑嬲脲袅", "nie :镍啮涅捏聂孽镊乜陧蘖嗫颞臬蹑", "nin :您", "ning :宁凝拧柠狞泞佞苎咛甯聍", "niu :牛扭钮纽狃忸妞", "nong :农弄浓脓侬哝", "nou :耨", "nu :女奴努怒弩胬孥驽恧钕衄", "nuan :暖", "nue :虐", "nuo :诺挪懦糯傩搦喏锘", "o :欧偶哦鸥殴藕呕沤讴噢怄瓯耦", "ou :欧偶鸥殴藕呕沤讴怄瓯耦", "pa :怕派爬帕啪趴琶葩杷筢", "pai :派排拍牌哌徘湃俳蒎", "pan :判盘叛潘攀磐盼畔胖爿泮袢襻蟠蹒", "pang :旁乓庞耪胖彷滂逄螃", "pao :跑炮刨抛泡咆袍匏狍庖脬疱", "pei :配培陪胚呸裴赔佩沛辔帔旆锫醅霈", "pen :喷盆湓", "peng :碰棚蓬朋捧膨砰抨烹澎彭硼篷鹏堋嘭怦蟛", "pi :批皮坯脾疲砒霹披劈琵毗啤匹痞僻屁譬丕仳陴邳郫圮鼙芘擗噼庀淠媲纰枇甓睥罴铍癖疋蚍蜱貔", "pian :片偏篇骗谝骈犏胼翩蹁", "piao :票漂飘瓢剽嘌嫖缥殍瞟螵", "pie :撇瞥丿苤氕", "pin :品贫频拼苹聘拚姘嫔榀牝颦", "ping :平评瓶凭苹乒坪萍屏俜娉枰鲆", "po :破迫坡泼颇婆魄粕叵鄱珀攴钋钷皤笸", "pou :剖裒掊", "pu :普谱扑埔铺葡朴蒲仆莆菩圃浦曝瀑匍噗溥濮璞氆镤镨蹼", "qi :起其气期七器齐奇汽企漆欺旗畦启弃歧栖戚妻凄柒沏棋崎脐祈祁骑岂乞契砌迄泣讫亓俟圻芑芪萁萋葺蕲嘁屺岐汔淇骐绮琪琦杞桤槭耆欹祺憩碛颀蛴蜞綦綮蹊鳍麒", "qia :恰掐洽葜髂", "qian :前千钱浅签迁铅潜牵钳谴扦钎仟谦乾黔遣堑嵌欠歉倩佥阡芊芡茜荨掮岍悭慊骞搴褰缱椠肷愆钤虔箬箝", "qiang :强枪抢墙腔呛羌蔷戕嫱樯戗炝锖锵镪襁蜣羟跄", "qiao :桥瞧巧敲乔蕉橇锹悄侨鞘撬翘峭俏窍劁诮谯荞愀憔樵硗跷鞒", "qie :切且茄怯窃郄惬妾挈锲箧", "qin :亲侵勤秦钦琴芹擒禽寝沁芩揿吣嗪噙溱檎锓覃螓衾", "qing :情清青轻倾请庆氢晴卿擎氰顷苘圊檠磬蜻罄箐謦鲭黥", "qiong :穷琼邛茕穹蛩筇跫銎", "qiu :求球秋丘邱囚酋泅俅巯犰湫逑遒楸赇虬蚯蝤裘糗鳅鼽", "qu :去区取曲渠屈趋驱趣蛆躯娶龋诎劬蕖蘧岖衢阒璩觑氍朐祛磲鸲癯蛐蠼麴瞿黢", "quan :全权圈劝泉醛颧痊拳犬券诠荃悛绻辁畎铨蜷筌鬈", "que :确却缺炔瘸鹊榷雀阕阙悫", "qun :群裙逡", "ran :然燃染冉苒蚺髯", "rang :让壤嚷瓤攘禳穰", "rao :绕扰饶荛娆桡", "re :热惹", "ren :人认任仁刃忍壬韧妊纫仞荏葚饪轫稔衽", "reng :仍扔", "ri :日", "rong :容溶荣熔融绒戎茸蓉冗嵘狨榕肜蝾", "rou :肉揉柔糅蹂鞣", "ru :如入儒乳茹蠕孺辱汝褥蓐薷嚅洳溽濡缛铷襦颥", "ruan :软阮朊", "rui :瑞锐蕊芮蕤枘睿蚋", "run :润闰", "ruo :弱若偌", "sa :撒萨洒卅仨挲脎飒", "sai :塞赛腮鳃噻", "san :三散叁伞馓毵糁", "sang :桑丧嗓搡磉颡", "sao :扫搔骚嫂埽缫缲臊瘙鳋", "se :色瑟涩啬铯穑", "sen :森", "seng :僧", "sha :沙杀砂啥纱莎刹傻煞杉唼歃铩痧裟霎鲨", "shai :筛晒", "shan :山闪善珊扇陕苫杉删煽衫擅赡膳汕缮剡讪鄯埏芟潸姗嬗骟膻钐疝蟮舢跚鳝", "shang :上商伤尚墒赏晌裳垧绱殇熵觞", "shao :少烧稍绍哨梢捎芍勺韶邵劭苕潲蛸筲艄", "she :社设射摄舌涉舍蛇奢赊赦慑厍佘猞滠歙畲麝", "shen :深身神伸甚渗沈肾审申慎砷呻娠绅婶诜谂莘哂渖椹胂矧蜃", "sheng :生胜声省升盛绳剩圣牲甥嵊晟眚笙", "shi :是时十使事实式识世试石什示市史师始施士势湿适食失视室氏蚀诗释拾饰驶狮尸虱矢屎柿拭誓逝嗜噬仕侍恃谥埘莳蓍弑轼贳炻铈螫舐筮酾豕鲥鲺", "shou :手受收首守授寿兽售瘦狩绶艏", "shu :数书树属术输述熟束鼠疏殊舒蔬薯叔署枢梳抒淑赎孰暑曙蜀黍戍竖墅庶漱恕丨倏塾菽摅沭澍姝纾毹腧殳秫", "shua :刷耍唰", "shuai :衰帅摔甩蟀", "shuan :栓拴闩涮", "shuang:双霜爽孀", "shui :水谁睡税", "shun :顺吮瞬舜", "shuo :说硕朔烁蒴搠妁槊铄", "si :四思死斯丝似司饲私撕嘶肆寺嗣伺巳厮兕厶咝汜泗澌姒驷缌祀锶鸶耜蛳笥", "song :松送宋颂耸怂讼诵凇菘崧嵩忪悚淞竦", "sou :搜艘擞嗽叟薮嗖嗾馊溲飕瞍锼螋", "su :素速苏塑缩俗诉宿肃酥粟僳溯夙谡蔌嗉愫涑簌觫稣", "suan :算酸蒜狻", "sui :随穗碎虽岁隋绥髓遂隧祟谇荽濉邃燧眭睢", "sun :损孙笋荪狲飧榫隼", "suo :所缩锁索蓑梭唆琐唢嗦嗍娑桫睃羧", "ta :他它她塔踏塌獭挞蹋闼溻遢榻沓铊趿鳎", "tai :台太态胎抬泰苔酞汰邰薹肽炱钛跆鲐", "tan :谈碳探炭坦贪滩坍摊瘫坛檀痰潭谭毯袒叹郯澹昙忐钽锬", "tang :堂糖唐塘汤搪棠膛倘躺淌趟烫傥帑溏瑭樘铴镗耥螗螳羰醣", "tao :套讨逃陶萄桃掏涛滔绦淘鼗啕洮韬焘饕", "te :特忒忑铽", "teng :腾疼藤誊滕", "ti :提题体替梯惕剔踢锑蹄啼嚏涕剃屉倜悌逖缇鹈裼醍", "tian :天田添填甜恬舔腆掭忝阗殄畋", "tiao :条跳挑迢眺佻祧窕蜩笤粜龆鲦髫", "tie :铁贴帖萜餮", "ting :听停庭挺廷厅烃汀亭艇莛葶婷梃铤蜓霆", "tong :同通统铜痛筒童桶桐酮瞳彤捅佟仝茼嗵恸潼砼", "tou :头投透偷钭骰", "tu :图土突途徒凸涂吐兔屠秃堍荼菟钍酴", "tuan :团湍抟彖疃", "tui :推退腿颓蜕褪煺", "tun :吞屯臀氽饨暾豚", "tuo :脱拖托妥椭鸵陀驮驼拓唾乇佗坨庹沱柝橐砣箨酡跎鼍", "wa :瓦挖哇蛙洼娃袜佤娲腽", "wai :外歪", "wan :完万晚弯碗顽湾挽玩豌丸烷皖惋宛婉腕剜芄菀纨绾琬脘畹蜿", "wang :往王望网忘妄亡旺汪枉罔尢惘辋魍", "wei :为位委围维唯卫微伟未威危尾谓喂味胃魏伪违韦畏纬巍桅惟潍苇萎蔚渭尉慰偎诿隈葳薇囗帏帷崴嵬猥猬闱沩洧涠逶娓玮韪軎炜煨痿艉鲔", "wen :问温文稳纹闻蚊瘟吻紊刎阌汶璺雯", "weng :嗡翁瓮蓊蕹", "wo :我握窝蜗涡沃挝卧斡倭莴喔幄渥肟硪龌", "wu :无五物武务误伍舞污悟雾午屋乌吴诬钨巫呜芜梧吾毋捂侮坞戊晤勿兀仵阢邬圬芴唔庑怃忤浯寤迕妩婺骛杌牾焐鹉鹜痦蜈鋈鼯", "xi :系席西习细吸析喜洗铣稀戏隙希息袭锡烯牺悉惜溪昔熙硒矽晰嘻膝夕熄汐犀檄媳僖兮隰郗菥葸蓰奚唏徙饩阋浠淅屣嬉玺樨曦觋欷熹禊禧皙穸蜥螅蟋舄舾羲粞翕醯鼷", "xia :下夏吓狭霞瞎虾匣辖暇峡侠厦呷狎遐瑕柙硖罅黠", "xian :线现先县限显鲜献险陷宪纤掀弦腺锨仙咸贤衔舷闲涎嫌馅羡冼苋莶藓岘猃暹娴氙燹祆鹇痫蚬筅籼酰跣跹霰", "xiang :想向相象响项箱乡香像详橡享湘厢镶襄翔祥巷芗葙饷庠骧缃蟓鲞飨", "xiao :小消削效笑校销硝萧肖孝霄哮嚣宵淆晓啸哓崤潇逍骁绡枭枵筱箫魈", "xie :些写斜谢协械卸屑鞋歇邪胁蟹泄泻楔蝎挟携谐懈偕亵勰燮薤撷獬廨渫瀣邂绁缬榭榍躞", "xin :新心信锌芯辛欣薪忻衅囟馨昕歆鑫", "xing :行性形型星兴醒姓幸腥猩惺刑邢杏陉荇荥擤饧悻硎", "xiong :雄胸兄凶熊匈汹芎", "xiu :修锈休袖秀朽羞嗅绣咻岫馐庥溴鸺貅髹", "xu :续许须需序虚絮畜叙蓄绪徐墟戌嘘酗旭恤婿诩勖圩蓿洫溆顼栩煦盱胥糈醑", "xuan :选旋宣悬玄轩喧癣眩绚儇谖萱揎泫渲漩璇楦暄炫煊碹铉镟痃", "xue :学血雪穴靴薛谑泶踅鳕", "xun :训旬迅讯寻循巡勋熏询驯殉汛逊巽埙荀蕈薰峋徇獯恂洵浔曛醺鲟", "ya :压亚呀牙芽雅蚜鸭押鸦丫崖衙涯哑讶伢垭揠岈迓娅琊桠氩砑睚痖", "yan :验研严眼言盐演岩沿烟延掩宴炎颜燕衍焉咽阉淹蜒阎奄艳堰厌砚雁唁彦焰谚厣赝俨偃兖谳郾鄢菸崦恹闫阏湮滟妍嫣琰檐晏胭焱罨筵酽魇餍鼹", "yang :样养氧扬洋阳羊秧央杨仰殃鸯佯疡痒漾徉怏泱炀烊恙蛘鞅", "yao :要药摇腰咬邀耀疟妖瑶尧遥窑谣姚舀夭爻吆崾徭幺珧杳轺曜肴鹞窈繇鳐", "ye :也业页叶液夜野爷冶椰噎耶掖曳腋靥谒邺揶晔烨铘", "yi :一以义意已移医议依易乙艺益异宜仪亿遗伊役衣疑亦谊翼译抑忆疫壹揖铱颐夷胰沂姨彝椅蚁倚矣邑屹臆逸肄裔毅溢诣翌绎刈劓佚佾诒圯埸懿苡荑薏弈奕挹弋呓咦咿噫峄嶷猗饴怿怡悒漪迤驿缢殪轶贻旖熠眙钇镒镱痍瘗癔翊蜴舣羿翳酏黟", "yin :因引阴印音银隐饮荫茵殷姻吟淫寅尹胤鄞垠堙茚吲喑狺夤洇氤铟瘾窨蚓霪龈", "ying :应影硬营英映迎樱婴鹰缨莹萤荧蝇赢盈颖嬴郢茔莺萦蓥撄嘤膺滢潆瀛瑛璎楹媵鹦瘿颍罂", "yo :哟唷", "yong :用勇永拥涌蛹庸佣臃痈雍踊咏泳恿俑壅墉喁慵邕镛甬鳙饔", "you :有由又油右友优幼游尤诱犹幽悠忧邮铀酉佑釉卣攸侑莠莜莸呦囿宥柚猷牖铕疣蚰蚴蝣鱿黝鼬", "yu :于与育鱼雨玉余遇预域语愈渔予羽愚御欲宇迂淤盂榆虞舆俞逾愉渝隅娱屿禹芋郁吁喻峪狱誉浴寓裕豫驭禺毓伛俣谀谕萸蓣揄圄圉嵛狳饫馀庾阈鬻妪妤纡瑜昱觎腴欤於煜熨燠聿钰鹆鹬瘐瘀窬窳蜮蝓竽臾舁雩龉", "yuan :员原圆源元远愿院缘援园怨鸳渊冤垣袁辕猿苑垸塬芫掾沅媛瑗橼爰眢鸢螈箢鼋", "yue :月越约跃曰阅钥岳粤悦龠瀹樾刖钺", "yun :运云匀允孕耘郧陨蕴酝晕韵郓芸狁恽愠纭韫殒昀氲熨", "za :杂咱匝砸咋咂", "zai :在再载栽灾哉宰崽甾", "zan :赞咱暂攒拶瓒昝簪糌趱錾", "zang :脏葬赃奘驵臧", "zao :造早遭燥凿糟枣皂藻澡蚤躁噪灶唣", "ze :则择责泽仄赜啧帻迮昃笮箦舴", "zei :贼", "zen :怎谮", "zeng :增曾憎赠缯甑罾锃", "zha :扎炸闸铡轧渣喳札眨栅榨乍诈揸吒咤哳砟痄蚱齄", "zhai :寨摘窄斋宅债砦瘵", "zhan :战展站占瞻毡詹沾盏斩辗崭蘸栈湛绽谵搌旃", "zhang :张章掌仗障胀涨账樟彰漳杖丈帐瘴仉鄣幛嶂獐嫜璋蟑", "zhao :照找招召赵爪罩沼兆昭肇诏棹钊笊", "zhe :这着者折哲浙遮蛰辙锗蔗谪摺柘辄磔鹧褶蜇赭", "zhen :真针阵镇振震珍诊斟甄砧臻贞侦枕疹圳蓁浈缜桢榛轸赈胗朕祯畛稹鸩箴", "zheng :争正政整证征蒸症郑挣睁狰怔拯帧诤峥徵钲铮筝", "zhi :之制治只质指直支织止至置志值知执职植纸致枝殖脂智肢秩址滞汁芝吱蜘侄趾旨挚掷帜峙稚炙痔窒卮陟郅埴芷摭帙忮彘咫骘栉枳栀桎轵轾贽胝膣祉祗黹雉鸷痣蛭絷酯跖踬踯豸觯", "zhong :中种重众钟终忠肿仲盅衷冢锺螽舯踵", "zhou :轴周洲州皱骤舟诌粥肘帚咒宙昼荮啁妯纣绉胄碡籀酎", "zhu :主注著住助猪铸株筑柱驻逐祝竹贮珠朱诸蛛诛烛煮拄瞩嘱蛀伫侏邾茱洙渚潴杼槠橥炷铢疰瘃竺箸舳翥躅麈", "zhua :抓", "zhuai :拽", "zhuan :转专砖撰赚篆啭馔颛", "zhuang:装状壮庄撞桩妆僮", "zhui :追锥椎赘坠缀惴骓缒", "zhun :准谆肫窀", "zhuo :捉桌拙卓琢茁酌啄灼浊倬诼擢浞涿濯焯禚斫镯", "zi :子自资字紫仔籽姿兹咨滋淄孜滓渍谘嵫姊孳缁梓辎赀恣眦锱秭耔笫粢趑觜訾龇鲻髭", "zong :总纵宗综棕鬃踪偬枞腙粽", "zou :走邹奏揍诹陬鄹驺鲰", "zu :组族足阻祖租卒诅俎菹镞", "zuan :钻纂攥缵躜", "zui :最罪嘴醉蕞", "zun :尊遵撙樽鳟", "zuo :作做左座坐昨佐柞阼唑嘬怍胙祚"}; } }
2881099/IdleBus
1,982
Examples/Examples_IdleBus_Core31/Program.cs
using System; using System.Diagnostics; using System.Threading; namespace Examples_IdleBus_Core31 { class Program { static void Main(string[] args) { var ib = new IdleBus(TimeSpan.FromSeconds(10)); ib.Notice += (_, e2) => { if (e2.NoticeType == IdleBus<IDisposable>.NoticeType.AutoCreate || e2.NoticeType == IdleBus<IDisposable>.NoticeType.AutoRelease) { var log = $"[{DateTime.Now.ToString("HH:mm:ss")}] 线程{Thread.CurrentThread.ManagedThreadId}:{e2.Log}"; //Trace.WriteLine(log); Console.WriteLine(log); } }; var testkey1 = ib.Exists("key1"); ib .Register("key1", () => new ManualResetEvent(false)) .Register("key2", () => new AutoResetEvent(false)); var testkey2 = ib.Exists("key1"); for (var a = 3; a < 2000; a++) ib.Register("key" + a, () => new System.Data.SqlClient.SqlConnection()); for (var a = 1; a < 2000; a++) ib.Get("key" + a); var now = DateTime.Now; int counter = 100 * 1000; for (var k = 0; k < 100; k++) { new Thread(() => { var rnd = new Random(); for (var a = 0; a < 1000; a++) { for (var l = 0; l < 10; l++) { ib.Get("key" + rnd.Next(1, 2000)); } if (Interlocked.Decrement(ref counter) <= 0) Console.WriteLine($"测试完成,100线程并发 ib.Get() 获取100万次,耗时:{DateTime.Now.Subtract(now).TotalMilliseconds}ms"); } }).Start(); } Console.ReadKey(); ib.Dispose(); } } }
2881099/IdleBus
923
Examples/Examples_IdleBus_WinformNet40/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("Test")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Test")] [assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 会使此程序集中的类型 //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 //请将此类型的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("0fc8305a-114e-4792-9226-726fe3651cb0")] // 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
2881099/IdleBus
995
Examples/Examples_IdleBus_WinformNet40/Properties/Settings.Designer.cs
//------------------------------------------------------------------------------ // <auto-generated> // 此代码由工具生成。 // 运行时版本:4.0.30319.42000 // // 对此文件的更改可能会导致不正确的行为,并且如果 // 重新生成代码,这些更改将会丢失。 // </auto-generated> //------------------------------------------------------------------------------ namespace Examples_IdleBus_WinformNet40.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } } }
2881099/IdleBus
2,496
Examples/Examples_IdleBus_WinformNet40/Properties/Resources.Designer.cs
//------------------------------------------------------------------------------ // <auto-generated> // 此代码由工具生成。 // 运行时版本:4.0.30319.42000 // // 对此文件的更改可能会导致不正确的行为,并且如果 // 重新生成代码,这些更改将会丢失。 // </auto-generated> //------------------------------------------------------------------------------ namespace Examples_IdleBus_WinformNet40.Properties { using System; /// <summary> /// 一个强类型的资源类,用于查找本地化的字符串等。 /// </summary> // 此类是由 StronglyTypedResourceBuilder // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen // (以 /str 作为命令选项),或重新生成 VS 项目。 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// 返回此类使用的缓存的 ResourceManager 实例。 /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Examples_IdleBus_WinformNet40.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// 重写当前线程的 CurrentUICulture 属性 /// 重写当前线程的 CurrentUICulture 属性。 /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
2881099/SafeObjectPool
1,350
SafeObjectPool.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>netstandard2.0;net45;net40</TargetFrameworks> <AssemblyName>SafeObjectPool</AssemblyName> <PackageId>SafeObjectPool</PackageId> <RootNamespace>SafeObjectPool</RootNamespace> <Version>3.0.0</Version> <GeneratePackageOnBuild>true</GeneratePackageOnBuild> <PackageProjectUrl>https://github.com/2881099/SafeObjectPool</PackageProjectUrl> <Description>应用场景:连接池,资源池等等</Description> <RepositoryUrl>https://github.com/2881099/SafeObjectPool</RepositoryUrl> <PackageTags>Pool Pooling PoolSize ObjectPool 连接池</PackageTags> <RepositoryType>git</RepositoryType> <PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageId>$(AssemblyName)</PackageId> <Title>$(AssemblyName)</Title> <IsPackable>true</IsPackable> <GenerateAssemblyInfo>true</GenerateAssemblyInfo> <WarningLevel>3</WarningLevel> <SignAssembly>true</SignAssembly> <AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <DocumentationFile>SafeObjectPool.xml</DocumentationFile> </PropertyGroup> <PropertyGroup Condition="'$(TargetFramework)' == 'net40'"> <DefineConstants>net40</DefineConstants> </PropertyGroup> </Project>
2881099/SafeObjectPool
3,347
README.md
## 介绍 数据库操作通常是 new SqlConnection()、 Open()、 使用完后 Close(),其实 ado.net 驱动已经实现了连接池管理,不然每次创建、连接、释放相当浪费性能。假设网站的访问在某一时刻突然爆增100万次,new 100万个SqlConnection对象显然会炸掉服务,连接对象,每次创建,connect,disconnect,disponse,显然开销很大。目前看来,最适合做连接对象的池子,对象池里的连接对象,保持长链接,效率最大化。 ado.net自带的链接池不完美,比如占满的时候再请求会报错。ObjectPool 解决池用尽后,再请求不报错,排队等待机制。 对象池容器化管理一批对象,重复使用从而提升性能,有序排队申请,使用完后归还资源。 对象池在超过10秒仍然未获取到对象时,报出异常: > SafeObjectPool 获取超时(10秒),设置 Policy.IsThrowGetTimeoutException 可以避免该异常。 ## 与dapper比武测试 ```csharp [HttpGet("vs_gen")] async public Task<object> vs_gen() { var select = Tag.Select; var count = await select.CountAsync(); var items = await select.Page(page, limit).ToListAsync(); return new { count, items }; } [HttpGet("vs_dapper")] async public Task<object> vs_dapper() { var conn = new SqlConnection("Data Source=.;Integrated Security=True;Initial Catalog=cms;Pooling=true;Max Pool Size=11"); conn.Open(); var count = await conn.ExecuteScalarAsync<int>("SELECT count(1) FROM[dbo].[tag] a"); //conn.Close(); //conn = new SqlConnection("Data Source=.;Integrated Security=True;Initial Catalog=cms;Pooling=true;Max Pool Size=11"); //conn.Open(); var items = await conn.QueryAsync("SELECT TOP 20 a.[id], a.[parent_id], a.[name] FROM[dbo].[tag] a"); conn.Close(); return new { count, items }; } ``` 连接池最大为:10,11 ab -c 10 -n 1000 -s 6000 测试结果差不多 -c 100 时,vs_dapper直接挂了,vs_gen没影响(使用了SafeObjectPool) > 实践证明ado.net过于暴露,突然的高并发招架不住。 ## 应用场景 * 数据库连接对象池 > [SQLServer连接池](https://github.com/2881099/dng.Mssql/blob/master/Mssql/SqlConnectionPool.cs)、[MySQL连接池](https://github.com/2881099/dng.Mysql/blob/master/MySql.Data.MySqlClient/MySqlConnectionPool.cs)、[PostgreSQL连接池](https://github.com/2881099/dng.Pgsql/blob/master/Npgsql/NpgsqlConnectionPool.cs)、[Redis连接池](https://github.com/2881099/csredis/blob/master/src/CSRedisCore/RedisClientPool.cs) * redis连接对象池 ## 安装 > Install-Package SafeObjectPool ## 使用方法 ```csharp var pool = new SafeObjectPool.ObjectPool<MemoryStream>(10, () => new MemoryStream(), obj => { if (DateTime.Now.Subtract(obj.LastGetTime).TotalSeconds > 5) { // 对象超过5秒未活动,进行操作 } }); var obj = pool.Get(); //借 pool.Return(obj); //归还 //或者 using 自动归还 using (var obj = pool.Get()) { } ``` ## SQLServer连接池 ```csharp var pool = new System.Data.SqlClient.SqlConnectionPool("名称", connectionString, 可用时触发的委托, 不可用时触发的委托); var conn = pool.Get(); try { // 使用 ... pool.Return(conn); //正常归还 } catch (Exception ex) { pool.Return(conn, ex); //发生错误时归还 } ``` ## MySQL连接池 ```csharp var pool = new MySql.Data.MySqlClient.MySqlConnectionPool("名称", connectionString, 可用时触发的委托, 不可用时触发的委托); var conn = pool.Get(); try { // 使用 ... pool.Return(conn); //正常归还 } catch (Exception ex) { pool.Return(conn, ex); //发生错误时归还 } ``` ## PostgreSQL连接池 ```csharp var pool = new Npgsql.NpgsqlConnectionPool("名称", connectionString, 可用时触发的委托, 不可用时触发的委托); var conn = pool.Get(); try { // 使用 ... pool.Return(conn); //正常归还 } catch (Exception ex) { pool.Return(conn, ex); //发生错误时归还 } ``` ## Redis连接池 ```csharp var connectionString = "127.0.0.1[:6379],password=,defaultDatabase=13,poolsize=50,ssl=false,writeBuffer=10240,prefix=key前辍"; var pool = new CSRedis.RedisClientPool("名称", connectionString, client => { }); var conn = pool.Get(); try { // 使用 ... pool.Return(conn); //正常归还 } catch (Exception ex) { pool.Return(conn, ex); //发生错误时归还 } ``` # 更多连接池正在开发中。。。
2881099/SafeObjectPool
7,636
SafeObjectPool.xml
<?xml version="1.0"?> <doc> <assembly> <name>SafeObjectPool</name> </assembly> <members> <member name="P:SafeObjectPool.IObjectPool`1.IsAvailable"> <summary> 是否可用 </summary> </member> <member name="P:SafeObjectPool.IObjectPool`1.UnavailableException"> <summary> 不可用错误 </summary> </member> <member name="P:SafeObjectPool.IObjectPool`1.UnavailableTime"> <summary> 不可用时间 </summary> </member> <member name="M:SafeObjectPool.IObjectPool`1.SetUnavailable(System.Exception,System.DateTime)"> <summary> 将对象池设置为不可用,后续 Get/GetAsync 均会报错,同时启动后台定时检查服务恢复可用 </summary> <param name="exception"></param> <param name="lastGetTime"></param> <returns>由【可用】变成【不可用】时返回true,否则返回false</returns> </member> <member name="P:SafeObjectPool.IObjectPool`1.Statistics"> <summary> 统计对象池中的对象 </summary> </member> <member name="P:SafeObjectPool.IObjectPool`1.StatisticsFullily"> <summary> 统计对象池中的对象(完整) </summary> </member> <member name="M:SafeObjectPool.IObjectPool`1.Get(System.Nullable{System.TimeSpan})"> <summary> 获取资源 </summary> <param name="timeout">超时</param> <returns></returns> </member> <member name="M:SafeObjectPool.IObjectPool`1.GetAsync"> <summary> 获取资源 </summary> <returns></returns> </member> <member name="M:SafeObjectPool.IObjectPool`1.Return(SafeObjectPool.Object{`0},System.Boolean)"> <summary> 使用完毕后,归还资源 </summary> <param name="obj">对象</param> <param name="isReset">是否重新创建</param> </member> <member name="P:SafeObjectPool.IPolicy`1.Name"> <summary> 名称 </summary> </member> <member name="P:SafeObjectPool.IPolicy`1.PoolSize"> <summary> 池容量 </summary> </member> <member name="P:SafeObjectPool.IPolicy`1.SyncGetTimeout"> <summary> 默认获取超时设置 </summary> </member> <member name="P:SafeObjectPool.IPolicy`1.IdleTimeout"> <summary> 空闲时间,获取时若超出,则重新创建 </summary> </member> <member name="P:SafeObjectPool.IPolicy`1.AsyncGetCapacity"> <summary> 异步获取排队队列大小,小于等于0不生效 </summary> </member> <member name="P:SafeObjectPool.IPolicy`1.IsThrowGetTimeoutException"> <summary> 获取超时后,是否抛出异常 </summary> </member> <member name="P:SafeObjectPool.IPolicy`1.IsAutoDisposeWithSystem"> <summary> 监听 AppDomain.CurrentDomain.ProcessExit/Console.CancelKeyPress 事件自动释放 </summary> </member> <member name="P:SafeObjectPool.IPolicy`1.CheckAvailableInterval"> <summary> 后台定时检查可用性间隔秒数 </summary> </member> <member name="M:SafeObjectPool.IPolicy`1.OnCreate"> <summary> 对象池的对象被创建时 </summary> <returns>返回被创建的对象</returns> </member> <member name="M:SafeObjectPool.IPolicy`1.OnDestroy(`0)"> <summary> 销毁对象 </summary> <param name="obj">资源对象</param> </member> <member name="M:SafeObjectPool.IPolicy`1.OnGetTimeout"> <summary> 从对象池获取对象超时的时候触发,通过该方法统计 </summary> </member> <member name="M:SafeObjectPool.IPolicy`1.OnGet(SafeObjectPool.Object{`0})"> <summary> 从对象池获取对象成功的时候触发,通过该方法统计或初始化对象 </summary> <param name="obj">资源对象</param> </member> <member name="M:SafeObjectPool.IPolicy`1.OnGetAsync(SafeObjectPool.Object{`0})"> <summary> 从对象池获取对象成功的时候触发,通过该方法统计或初始化对象 </summary> <param name="obj">资源对象</param> </member> <member name="M:SafeObjectPool.IPolicy`1.OnReturn(SafeObjectPool.Object{`0})"> <summary> 归还对象给对象池的时候触发 </summary> <param name="obj">资源对象</param> </member> <member name="M:SafeObjectPool.IPolicy`1.OnCheckAvailable(SafeObjectPool.Object{`0})"> <summary> 检查可用性 </summary> <param name="obj">资源对象</param> <returns></returns> </member> <member name="M:SafeObjectPool.IPolicy`1.OnAvailable"> <summary> 事件:可用时触发 </summary> </member> <member name="M:SafeObjectPool.IPolicy`1.OnUnavailable"> <summary> 事件:不可用时触发 </summary> </member> <member name="P:SafeObjectPool.Object`1.Pool"> <summary> 所属对象池 </summary> </member> <member name="P:SafeObjectPool.Object`1.Id"> <summary> 在对象池中的唯一标识 </summary> </member> <member name="P:SafeObjectPool.Object`1.Value"> <summary> 资源对象 </summary> </member> <member name="P:SafeObjectPool.Object`1.GetTimes"> <summary> 被获取的总次数 </summary> </member> <member name="P:SafeObjectPool.Object`1.LastGetTime"> 最后获取时的时间 </member> <member name="P:SafeObjectPool.Object`1.LastReturnTime"> <summary> 最后归还时的时间 </summary> </member> <member name="P:SafeObjectPool.Object`1.CreateTime"> <summary> 创建时间 </summary> </member> <member name="P:SafeObjectPool.Object`1.LastGetThreadId"> <summary> 最后获取时的线程id </summary> </member> <member name="P:SafeObjectPool.Object`1.LastReturnThreadId"> <summary> 最后归还时的线程id </summary> </member> <member name="M:SafeObjectPool.Object`1.ResetValue"> <summary> 重置 Value 值 </summary> </member> <member name="T:SafeObjectPool.ObjectPool`1"> <summary> 对象池管理类 </summary> <typeparam name="T">对象类型</typeparam> </member> <member name="M:SafeObjectPool.ObjectPool`1.CheckAvailable(System.Int32)"> <summary> 后台定时检查可用性 </summary> <param name="interval"></param> </member> <member name="M:SafeObjectPool.ObjectPool`1.#ctor(System.Int32,System.Func{`0},System.Action{SafeObjectPool.Object{`0}})"> <summary> 创建对象池 </summary> <param name="poolsize">池大小</param> <param name="createObject">池内对象的创建委托</param> <param name="onGetObject">获取池内对象成功后,进行使用前操作</param> </member> <member name="M:SafeObjectPool.ObjectPool`1.#ctor(SafeObjectPool.IPolicy{`0})"> <summary> 创建对象池 </summary> <param name="policy">策略</param> </member> <member name="M:SafeObjectPool.ObjectPool`1.GetFree(System.Boolean)"> <summary> 获取可用资源,或创建资源 </summary> <returns></returns> </member> </members> </doc>
2881099/SafeObjectPool
2,355
SafeObjectPool/IPolicy.cs
using System; using System.Threading.Tasks; namespace SafeObjectPool { public interface IPolicy<T> { /// <summary> /// 名称 /// </summary> string Name { get; set; } /// <summary> /// 池容量 /// </summary> int PoolSize { get; set; } /// <summary> /// 默认获取超时设置 /// </summary> TimeSpan SyncGetTimeout { get; set; } /// <summary> /// 空闲时间,获取时若超出,则重新创建 /// </summary> TimeSpan IdleTimeout { get; set; } /// <summary> /// 异步获取排队队列大小,小于等于0不生效 /// </summary> int AsyncGetCapacity { get; set; } /// <summary> /// 获取超时后,是否抛出异常 /// </summary> bool IsThrowGetTimeoutException { get; set; } /// <summary> /// 监听 AppDomain.CurrentDomain.ProcessExit/Console.CancelKeyPress 事件自动释放 /// </summary> bool IsAutoDisposeWithSystem { get; set; } /// <summary> /// 后台定时检查可用性间隔秒数 /// </summary> int CheckAvailableInterval { get; set; } /// <summary> /// 对象池的对象被创建时 /// </summary> /// <returns>返回被创建的对象</returns> T OnCreate(); /// <summary> /// 销毁对象 /// </summary> /// <param name="obj">资源对象</param> void OnDestroy(T obj); /// <summary> /// 从对象池获取对象超时的时候触发,通过该方法统计 /// </summary> void OnGetTimeout(); /// <summary> /// 从对象池获取对象成功的时候触发,通过该方法统计或初始化对象 /// </summary> /// <param name="obj">资源对象</param> void OnGet(Object<T> obj); #if net40 #else /// <summary> /// 从对象池获取对象成功的时候触发,通过该方法统计或初始化对象 /// </summary> /// <param name="obj">资源对象</param> Task OnGetAsync(Object<T> obj); #endif /// <summary> /// 归还对象给对象池的时候触发 /// </summary> /// <param name="obj">资源对象</param> void OnReturn(Object<T> obj); /// <summary> /// 检查可用性 /// </summary> /// <param name="obj">资源对象</param> /// <returns></returns> bool OnCheckAvailable(Object<T> obj); /// <summary> /// 事件:可用时触发 /// </summary> void OnAvailable(); /// <summary> /// 事件:不可用时触发 /// </summary> void OnUnavailable(); } }
2881099/SafeObjectPool
2,636
SafeObjectPool/Object.cs
using System; using System.Threading; namespace SafeObjectPool { public class Object<T> : IDisposable { public static Object<T> InitWith(IObjectPool<T> pool, int id, T value) { return new Object<T> { Pool = pool, Id = id, Value = value, LastGetThreadId = Thread.CurrentThread.ManagedThreadId, LastGetTime = DateTime.Now, LastGetTimeCopy = DateTime.Now }; } /// <summary> /// 所属对象池 /// </summary> public IObjectPool<T> Pool { get; internal set; } /// <summary> /// 在对象池中的唯一标识 /// </summary> public int Id { get; internal set; } /// <summary> /// 资源对象 /// </summary> public T Value { get; internal set; } internal long _getTimes; /// <summary> /// 被获取的总次数 /// </summary> public long GetTimes => _getTimes; /// 最后获取时的时间 public DateTime LastGetTime { get; internal set; } public DateTime LastGetTimeCopy { get; internal set; } /// <summary> /// 最后归还时的时间 /// </summary> public DateTime LastReturnTime { get; internal set; } /// <summary> /// 创建时间 /// </summary> public DateTime CreateTime { get; internal set; } = DateTime.Now; /// <summary> /// 最后获取时的线程id /// </summary> public int LastGetThreadId { get; internal set; } /// <summary> /// 最后归还时的线程id /// </summary> public int LastReturnThreadId { get; internal set; } public override string ToString() { return $"{this.Value}, Times: {this.GetTimes}, ThreadId(R/G): {this.LastReturnThreadId}/{this.LastGetThreadId}, Time(R/G): {this.LastReturnTime.ToString("yyyy-MM-dd HH:mm:ss:ms")}/{this.LastGetTime.ToString("yyyy-MM-dd HH:mm:ss:ms")}"; } /// <summary> /// 重置 Value 值 /// </summary> public void ResetValue() { if (this.Value != null) { try { this.Pool.Policy.OnDestroy(this.Value); } catch { } try { (this.Value as IDisposable)?.Dispose(); } catch { } } T value = default(T); try { value = this.Pool.Policy.OnCreate(); } catch { } this.Value = value; this.LastReturnTime = DateTime.Now; } internal bool _isReturned = false; public void Dispose() { Pool?.Return(this); } } }
2881099/SafeObjectPool
19,454
SafeObjectPool/ObjectPool.cs
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Text; using System.Threading; using System.Threading.Tasks; namespace SafeObjectPool { internal class TestTrace { internal static void WriteLine(string text, ConsoleColor backgroundColor) { try //#643 { var bgcolor = Console.BackgroundColor; var forecolor = Console.ForegroundColor; Console.BackgroundColor = backgroundColor; switch (backgroundColor) { case ConsoleColor.Yellow: Console.ForegroundColor = ConsoleColor.White; break; case ConsoleColor.DarkGreen: Console.ForegroundColor = ConsoleColor.White; break; } Console.Write(text); Console.BackgroundColor = bgcolor; Console.ForegroundColor = forecolor; Console.WriteLine(); } catch { try { System.Diagnostics.Debug.WriteLine(text); } catch { } } } } /// <summary> /// 对象池管理类 /// </summary> /// <typeparam name="T">对象类型</typeparam> public partial class ObjectPool<T> : IObjectPool<T> { public IPolicy<T> Policy { get; protected set; } private object _allObjectsLock = new object(); internal List<Object<T>> _allObjects = new List<Object<T>>(); internal ConcurrentStack<Object<T>> _freeObjects = new ConcurrentStack<Object<T>>(); private ConcurrentQueue<GetSyncQueueInfo> _getSyncQueue = new ConcurrentQueue<GetSyncQueueInfo>(); private ConcurrentQueue<TaskCompletionSource<Object<T>>> _getAsyncQueue = new ConcurrentQueue<TaskCompletionSource<Object<T>>>(); private ConcurrentQueue<bool> _getQueue = new ConcurrentQueue<bool>(); public bool IsAvailable => this.UnavailableException == null; public Exception UnavailableException { get; private set; } public DateTime? UnavailableTime { get; private set; } public DateTime? AvailableTime { get; private set; } private object UnavailableLock = new object(); private bool running = true; public bool SetUnavailable(Exception exception, DateTime lastGetTime) { bool isseted = false; if (exception != null && UnavailableException == null) { lock (UnavailableLock) { if (UnavailableException == null) { if (lastGetTime < AvailableTime) return false; //已经恢复 UnavailableException = exception; UnavailableTime = DateTime.Now; AvailableTime = null; isseted = true; } } } if (isseted) { Policy.OnUnavailable(); CheckAvailable(Policy.CheckAvailableInterval); } return isseted; } /// <summary> /// 后台定时检查可用性 /// </summary> /// <param name="interval"></param> private void CheckAvailable(int interval) { new Thread(() => { if (UnavailableException != null) TestTrace.WriteLine($"【{Policy.Name}】Next recovery time:{DateTime.Now.AddSeconds(interval)}", ConsoleColor.DarkYellow); while (UnavailableException != null) { if (running == false) return; Thread.CurrentThread.Join(TimeSpan.FromSeconds(interval)); if (running == false) return; try { var conn = GetFree(false); if (conn == null) throw new Exception($"【{Policy.Name}】Failed to get resource {this.Statistics}"); try { try { Policy.OnCheckAvailable(conn); break; } catch { conn.ResetValue(); } if (Policy.OnCheckAvailable(conn) == false) throw new Exception($"【{Policy.Name}】An exception needs to be thrown"); break; } finally { Return(conn); } } catch (Exception ex) { TestTrace.WriteLine($"【{Policy.Name}】Next recovery time: {DateTime.Now.AddSeconds(interval)} ({ex.Message})", ConsoleColor.DarkYellow); } } RestoreToAvailable(); }).Start(); } private void RestoreToAvailable() { bool isRestored = false; if (UnavailableException != null) { lock (UnavailableLock) { if (UnavailableException != null) { lock (_allObjectsLock) _allObjects.ForEach(a => a.LastGetTime = a.LastReturnTime = new DateTime(2000, 1, 1)); UnavailableException = null; UnavailableTime = null; AvailableTime = DateTime.Now; isRestored = true; } } } if (isRestored) { Policy.OnAvailable(); TestTrace.WriteLine($"【{Policy.Name}】Recovered", ConsoleColor.DarkGreen); } } protected bool LiveCheckAvailable() { try { var conn = GetFree(false); if (conn == null) throw new Exception($"【{Policy.Name}】Failed to get resource {this.Statistics}"); try { if (Policy.OnCheckAvailable(conn) == false) throw new Exception("【{Policy.Name}】An exception needs to be thrown"); } finally { Return(conn); } } catch { return false; } RestoreToAvailable(); return true; } public string Statistics => $"Pool: {_freeObjects.Count}/{_allObjects.Count}, Get wait: {_getSyncQueue.Count}, GetAsync wait: {_getAsyncQueue.Count}"; public string StatisticsFullily { get { var sb = new StringBuilder(); sb.AppendLine(Statistics); sb.AppendLine(""); foreach (var obj in _allObjects) { sb.AppendLine($"{obj.Value}, Times: {obj.GetTimes}, ThreadId(R/G): {obj.LastReturnThreadId}/{obj.LastGetThreadId}, Time(R/G): {obj.LastReturnTime.ToString("yyyy-MM-dd HH:mm:ss:ms")}/{obj.LastGetTime.ToString("yyyy-MM-dd HH:mm:ss:ms")}, "); } return sb.ToString(); } } /// <summary> /// 创建对象池 /// </summary> /// <param name="poolsize">池大小</param> /// <param name="createObject">池内对象的创建委托</param> /// <param name="onGetObject">获取池内对象成功后,进行使用前操作</param> public ObjectPool(int poolsize, Func<T> createObject, Action<Object<T>> onGetObject = null) : this(new DefaultPolicy<T> { PoolSize = poolsize, CreateObject = createObject, OnGetObject = onGetObject }) { } /// <summary> /// 创建对象池 /// </summary> /// <param name="policy">策略</param> public ObjectPool(IPolicy<T> policy) { Policy = policy; AppDomain.CurrentDomain.ProcessExit += (s1, e1) => { if (Policy.IsAutoDisposeWithSystem) running = false; }; try { Console.CancelKeyPress += (s1, e1) => { if (e1.Cancel) return; if (Policy.IsAutoDisposeWithSystem) running = false; }; } catch { } } public void AutoFree() { if (running == false) return; if (UnavailableException != null) return; var list = new List<Object<T>>(); while (_freeObjects.TryPop(out var obj)) list.Add(obj); foreach (var obj in list) { if (obj != null && obj.Value == null || obj != null && Policy.IdleTimeout > TimeSpan.Zero && DateTime.Now.Subtract(obj.LastReturnTime) > Policy.IdleTimeout) { if (obj.Value != null) { Return(obj, true); continue; } } Return(obj); } } /// <summary> /// 获取可用资源,或创建资源 /// </summary> /// <returns></returns> private Object<T> GetFree(bool checkAvailable) { if (running == false) throw new ObjectDisposedException($"【{Policy.Name}】The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079"); if (checkAvailable && UnavailableException != null) throw new Exception($"【{Policy.Name}】Status unavailable, waiting for recovery. {UnavailableException?.Message}", UnavailableException); if ((_freeObjects.TryPop(out var obj) == false || obj == null) && _allObjects.Count < Policy.PoolSize) { lock (_allObjectsLock) if (_allObjects.Count < Policy.PoolSize) _allObjects.Add(obj = new Object<T> { Pool = this, Id = _allObjects.Count + 1 }); } if (obj != null) obj._isReturned = false; if (obj != null && obj.Value == null || obj != null && Policy.IdleTimeout > TimeSpan.Zero && DateTime.Now.Subtract(obj.LastReturnTime) > Policy.IdleTimeout) { try { obj.ResetValue(); } catch { Return(obj); throw; } } return obj; } public Object<T> Get(TimeSpan? timeout = null) { var obj = GetFree(true); if (obj == null) { var queueItem = new GetSyncQueueInfo(); _getSyncQueue.Enqueue(queueItem); _getQueue.Enqueue(false); if (timeout == null) timeout = Policy.SyncGetTimeout; try { if (queueItem.Wait.Wait(timeout.Value)) obj = queueItem.ReturnValue; } catch { } if (obj == null) obj = queueItem.ReturnValue; if (obj == null) lock (queueItem.Lock) queueItem.IsTimeout = (obj = queueItem.ReturnValue) == null; if (obj == null) obj = queueItem.ReturnValue; if (queueItem.Exception != null) throw queueItem.Exception; if (obj == null) { Policy.OnGetTimeout(); if (Policy.IsThrowGetTimeoutException) throw new TimeoutException($"【{Policy.Name}】ObjectPool.Get() timeout {timeout.Value.TotalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081"); return null; } } try { Policy.OnGet(obj); } catch { Return(obj); throw; } obj.LastGetThreadId = Thread.CurrentThread.ManagedThreadId; obj.LastGetTime = DateTime.Now; obj.LastGetTimeCopy = DateTime.Now; Interlocked.Increment(ref obj._getTimes); return obj; } #if net40 #else async public Task<Object<T>> GetAsync() { var obj = GetFree(true); if (obj == null) { if (Policy.AsyncGetCapacity > 0 && _getAsyncQueue.Count >= Policy.AsyncGetCapacity - 1) throw new OutOfMemoryException($"【{Policy.Name}】ObjectPool.GetAsync() The queue is too long. Policy.AsyncGetCapacity = {Policy.AsyncGetCapacity}"); var tcs = new TaskCompletionSource<Object<T>>(); _getAsyncQueue.Enqueue(tcs); _getQueue.Enqueue(true); obj = await tcs.Task; //if (timeout == null) timeout = Policy.SyncGetTimeout; //if (tcs.Task.Wait(timeout.Value)) // obj = tcs.Task.Result; //if (obj == null) { // tcs.TrySetCanceled(); // Policy.GetTimeout(); // if (Policy.IsThrowGetTimeoutException) // throw new TimeoutException($"【{Policy.Name}】ObjectPool.GetAsync() timeout {timeout.Value.TotalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081"); // return null; //} } try { await Policy.OnGetAsync(obj); } catch { Return(obj); throw; } obj.LastGetThreadId = Thread.CurrentThread.ManagedThreadId; obj.LastGetTime = DateTime.Now; obj.LastGetTimeCopy = DateTime.Now; Interlocked.Increment(ref obj._getTimes); return obj; } #endif public void Return(Object<T> obj, bool isReset = false) { if (obj == null) return; if (obj._isReturned) return; if (running == false) { Policy.OnDestroy(obj.Value); try { (obj.Value as IDisposable)?.Dispose(); } catch { } return; } if (isReset) obj.ResetValue(); bool isReturn = false; while (isReturn == false && _getQueue.TryDequeue(out var isAsync)) { if (isAsync == false) { if (_getSyncQueue.TryDequeue(out var queueItem) && queueItem != null) { lock (queueItem.Lock) if (queueItem.IsTimeout == false) queueItem.ReturnValue = obj; if (queueItem.ReturnValue != null) { if (UnavailableException != null) { queueItem.Exception = new Exception($"【{Policy.Name}】Status unavailable, waiting for recovery. {UnavailableException?.Message}", UnavailableException); try { queueItem.Wait.Set(); } catch { } } else { obj.LastReturnThreadId = Thread.CurrentThread.ManagedThreadId; obj.LastReturnTime = DateTime.Now; try { queueItem.Wait.Set(); isReturn = true; } catch { } } } try { queueItem.Dispose(); } catch { } } } else { if (_getAsyncQueue.TryDequeue(out var tcs) && tcs != null && tcs.Task.IsCanceled == false) { if (UnavailableException != null) { try { tcs.TrySetException(new Exception($"【{Policy.Name}】Status unavailable, waiting for recovery. {UnavailableException?.Message}", UnavailableException)); } catch { } } else { obj.LastReturnThreadId = Thread.CurrentThread.ManagedThreadId; obj.LastReturnTime = DateTime.Now; try { isReturn = tcs.TrySetResult(obj); } catch { } } } } } //无排队,直接归还 if (isReturn == false) { try { Policy.OnReturn(obj); } catch { throw; } finally { obj.LastReturnThreadId = Thread.CurrentThread.ManagedThreadId; obj.LastReturnTime = DateTime.Now; obj._isReturned = true; _freeObjects.Push(obj); } } } public void Dispose() { running = false; while (_freeObjects.TryPop(out var fo)) ; while (_getSyncQueue.TryDequeue(out var sync)) { try { sync.Wait.Set(); } catch { } } while (_getAsyncQueue.TryDequeue(out var async)) async.TrySetCanceled(); while (_getQueue.TryDequeue(out var qs)) ; for (var a = 0; a < _allObjects.Count; a++) { Policy.OnDestroy(_allObjects[a].Value); try { (_allObjects[a].Value as IDisposable)?.Dispose(); } catch { } } _allObjects.Clear(); } class GetSyncQueueInfo : IDisposable { internal ManualResetEventSlim Wait { get; set; } = new ManualResetEventSlim(); internal Object<T> ReturnValue { get; set; } internal object Lock = new object(); internal bool IsTimeout { get; set; } = false; internal Exception Exception { get; set; } public void Dispose() { try { if (Wait != null) Wait.Dispose(); } catch { } } } } }
2881099/SafeObjectPool
1,593
SafeObjectPool/IObjectPool.cs
using System; using System.Threading.Tasks; namespace SafeObjectPool { public interface IObjectPool<T> : IDisposable { IPolicy<T> Policy { get; } /// <summary> /// 是否可用 /// </summary> bool IsAvailable { get; } /// <summary> /// 不可用错误 /// </summary> Exception UnavailableException { get; } /// <summary> /// 不可用时间 /// </summary> DateTime? UnavailableTime { get; } /// <summary> /// 将对象池设置为不可用,后续 Get/GetAsync 均会报错,同时启动后台定时检查服务恢复可用 /// </summary> /// <param name="exception"></param> /// <param name="lastGetTime"></param> /// <returns>由【可用】变成【不可用】时返回true,否则返回false</returns> bool SetUnavailable(Exception exception, DateTime lastGetTime); /// <summary> /// 统计对象池中的对象 /// </summary> string Statistics { get; } /// <summary> /// 统计对象池中的对象(完整) /// </summary> string StatisticsFullily { get; } /// <summary> /// 获取资源 /// </summary> /// <param name="timeout">超时</param> /// <returns></returns> Object<T> Get(TimeSpan? timeout = null); #if net40 #else /// <summary> /// 获取资源 /// </summary> /// <returns></returns> Task<Object<T>> GetAsync(); #endif /// <summary> /// 使用完毕后,归还资源 /// </summary> /// <param name="obj">对象</param> /// <param name="isReset">是否重新创建</param> void Return(Object<T> obj, bool isReset = false); } }
2881099/SafeObjectPool
1,518
SafeObjectPool/DefaultPolicy.cs
using System; using System.Threading.Tasks; namespace SafeObjectPool { public class DefaultPolicy<T> : IPolicy<T> { public string Name { get; set; } = typeof(DefaultPolicy<T>).GetType().FullName; public int PoolSize { get; set; } = 1000; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(50); public int AsyncGetCapacity { get; set; } = 10000; public bool IsThrowGetTimeoutException { get; set; } = true; public bool IsAutoDisposeWithSystem { get; set; } = true; public int CheckAvailableInterval { get; set; } = 3; public Func<T> CreateObject; public Action<Object<T>> OnGetObject; public T OnCreate() { return CreateObject(); } public void OnDestroy(T obj) { } public void OnGet(Object<T> obj) { OnGetObject?.Invoke(obj); } #if net40 #else public Task OnGetAsync(Object<T> obj) { OnGetObject?.Invoke(obj); return Task.FromResult(true); } #endif public void OnGetTimeout() { } public void OnReturn(Object<T> obj) { } public bool OnCheckAvailable(Object<T> obj) { return true; } public void OnAvailable() { } public void OnUnavailable() { } } }
2881099/FreeScheduler
5,662
readme.md
FreeScheduler 是利用 IdleBus 实现的轻量化定时任务调度,支持集群、临时的延时任务和重复循环任务(可持久化),可按秒,每天/每周/每月固定时间,自定义间隔执行,支持 .NET Core 2.1+、.NET Framework 4.0+ 运行环境。 > IdleScheduler 已正式改名为 FreeScheduler 如果对本项目感兴趣,欢迎加入 FreeSql QQ讨论群:8578575 ## Quick start > dotnet add package FreeScheduler > Install-Package FreeScheduler ```csharp static Scheduler scheduler = new FreeSchedulerBuilder() .OnExecuting(task => { Console.WriteLine($"[{DateTime.Now.ToString("HH:mm:ss.fff")}] {task.Topic} 被执行"); switch (task.Topic) { case "武林大会": Wulin(task.Body); break; case "攻城活动": AttackCity(task.Body); break; } }) .Build(); ``` | Method | 说明 | | -- | -- | | OnExecuting(Action\<TaskInfo\> executing) | 任务触发 | | UseTimeZone() | 设置时区 | | UseStorage() | 基于 数据库或者 Redis 持久化 | | UseCluster() | 开启集群(依赖 Redis),支持跨进程互通 | | UseCustomInterval() | 自定义间隔(可实现 cron) | | UseScanInterval() | 扫描间隔(默认200ms),值越小触发精准 | | Build() | 创建 Scheduler 对象 | 使用 ASP.NET Core 项目,一行代码解决如下: ```csharp app.UseFreeSchedulerUI("/freescheduler/"); ``` ![image](https://github.com/2881099/FreeSql.Wiki.VuePress/assets/16286519/a5d5f4bb-6af9-4695-9570-8777c39d7329) ## 集群特性 - 支持 单项目,多站点部署 - 支持 多进程,不重复执行 - 支持 进程退出后,由其他进程重新加载任务(约30秒后) - 支持 进程互通,任意进程都可以执行(RemoveTask/ExistsTask/PauseTask/RunNowTask/RemoveTempTask/ExistsTempTask) - 支持 进程意外离线后,卸载进程内的任务,重新安排上线 1、临时任务(不可持久化) ```csharp void Callback() { Console.WriteLine("时间到了"); scheduler.AddTempTask(TimeSpan.FromSeconds(10), Callback); //下一次定时 } scheduler.AddTempTask(TimeSpan.FromSeconds(10), Callback); ``` | Method | 说明 | | -- | -- | | string AddTempTask(TimeSpan, Action) | 创建临时的延时任务,返回 id | | bool RemoveTempTask(string id) | 删除任务(临时任务) | | bool ExistsTempTask(string id) | 判断任务是否存在(临时任务) | | int QuantityTempTask | 任务数量(临时任务) | 2、循环任务/可持久化 ```csharp //每5秒触发,执行N次 var id = scheduler.AddTask("topic1", "body1", round: -1, 5); //每次 不同的间隔秒数触发,执行6次 var id = scheduler.AddTask("topic1", "body1", new [] { 5, 5, 10, 10, 60, 60 }); //每天 20:00:00 触发,执行N次(注意设置时区 UseTimeZone) var id = scheduler.AddTaskRunOnDay("topic1", "body1", round: -1, "20:00:00"); //每周一 20:00:00 触发,执行1次 var id = scheduler.AddTaskRunOnWeek("topic1", "body1", round: 1, "1:20:00:00"); //每月1日 20:00:00 触发,执行12次 var id = scheduler.AddTaskRunOnMonth("topic1", "body1", round: 12, "1:20:00:00"); //每月最后一日 20:00:00 触发,执行12次 var id = scheduler.AddTaskRunOnMonth("topic1", "body1", round: 12, "-1:20:00:00"); //自定义间隔 cron var id = scheduler.AddTaskCustom("topic1", "body1", "0/1 * * * * ? "); new FreeSchedulerBuilder() ... .UseCustomInterval(task => { //利用 cron 功能库解析 task.IntervalArgument 得到下一次执行时间 //与当前时间相减,得到 TimeSpan,若返回 null 则任务完成 return TimeSpan.FromSeconds(5); }) .Build(); ``` | Method | 说明 | | -- | -- | | void ctor(ITaskHandler) | 指定任务调度器(单例) | | string AddTask(string topic, string body, int round, int seconds) | 创建循环定时任务,返回 id | | string AddTask(string topic, string body, int[] seconds) | 创建每轮间隔不同的定时任务,返回 id | | string AddTaskRunOnDay(..) | 创建每日循环任务,返回 id | | string AddTaskRunOnWeek(..) | 创建每周循环任务,返回 id | | string AddTaskRunOnMonth(..) | 创建每月循环任务,返回 id | | string AddTaskCustom(string topic, string body, string expression) | 创建自定义任务,返回 id | | bool RemoveTask(string id) | 删除任务 | | bool ExistsTask(string id) | 判断任务是否存在 | | bool ResumeTask(string id) | 恢复已暂停的任务 | | bool PauseTask(string id) | 暂停正在运行的任务 | | bool RunNowTask(string id) | 立刻运行任务(人工触发) | | TaskInfo[] FindTask(lambda) | 查询正在运行中的任务 | | int QuantityTask | 任务数量 | 3、预留任务 > [系统预留]清理任务数据 ```csharp //每小时触发,定期清理24小时之前的数据(单位:秒) scheduler.AddTask("[系统预留]清理任务数据", "86400", round: -1, 3600); ``` 4、管理任务 ```csharp // 使用 FreeSql 或者 SQL 查询 TaskInfo、TaskLog 两个表进行分页显示 fsql.Select<TaskInfo>().Count(out var total).Page(pageNumber, 30).ToList(); fsql.Select<TaskLog>().Count(out var total).Page(pageNumber, 30).ToList(); //暂停任务 scheduler.PauseTask(id); //恢复暂停的任务 scheduler.ResumeTask(id); //删除任务 scheduler.RemoveTask(id); //立刻运行任务(人工触发) scheduler.RunNowTask(id); ``` 如果正在使用 ASP.NET Core 项目,一行代码解决如下: ```csharp app.UseFreeSchedulerUI("/freescheduler/"); ``` https://github.com/2881099/FreeScheduler/tree/master/Examples/Examples_FreeScheduler_Net60 ![image](https://github.com/2881099/FreeSql.Wiki.VuePress/assets/16286519/a5d5f4bb-6af9-4695-9570-8777c39d7329) ## Performance | FreeScheduler | Quartz.net | FluentScheduler | HashedWheelTimer | | -- | -- | -- | -- | | (500,000 Tasks + 10s) | (500,000 Tasks + 10s) | (500,000 Tasks + 10s) | (500,000 Tasks + 10s) | | <img src="https://github.com/2881099/FreeScheduler/blob/master/Examples/Examples_FreeScheduler_VsQuartz/performance_self.png?raw=true"/> | <img src="https://github.com/2881099/FreeScheduler/blob/master/Examples/Examples_FreeScheduler_VsQuartz/performance_quartz.png?raw=true"/> | <img src="https://github.com/2881099/FreeScheduler/blob/master/Examples/Examples_FreeScheduler_VsQuartz/performance_fluentscheduler.png?raw=true"/> | <img src="https://github.com/2881099/FreeScheduler/blob/master/Examples/Examples_FreeScheduler_VsQuartz/performance_hashedwheeltimer.png?raw=true"/> | | 383M | 1700+M | StackOverflow | 213M | | 70563.6066ms | 50692.5365ms | 未知 | 33697.8758ms | FluentScheduler 单个 Registry 测试正常,但目测单线程执行(间隔1-10ms),处理速度不理想 [View Code](https://github.com/2881099/FreeScheduler/blob/master/Examples/Examples_FreeScheduler_VsQuartz/Program.cs) 我尝试把 FreeScheduler 内核改成 HashedWheelTimer 内存占用更高(600兆),结论:FreeScheduler 功能需要占用更多资源 ## 💕 Donation (捐赠) > 感谢你的打赏 - [Alipay](https://www.cnblogs.com/FreeSql/gallery/image/338860.html) - [WeChat](https://www.cnblogs.com/FreeSql/gallery/image/338859.html) ## 🗄 License (许可证) [MIT](LICENSE)
2881099/FreeScheduler
2,357
FreeScheduler_Dashboard/Program.cs
using FreeRedis; using FreeScheduler; using FreeSql; using Microsoft.Extensions.Hosting.Internal; using Newtonsoft.Json; var fsql = new FreeSql.FreeSqlBuilder() .UseConnectionString(FreeSql.DataType.Sqlite, @"Data Source=test1.db;Pooling=true") .UseAutoSyncStructure(true) .UseNoneCommandParameter(true) .UseMonitorCommand(cmd => Console.WriteLine(cmd.CommandText + "\r\n")) .Build(); /* var redis = new RedisClient("127.0.0.1,poolsize=10,exitAutoDisposePool=false"); redis.Serialize = obj => JsonConvert.SerializeObject(obj); redis.Deserialize = (json, type) => JsonConvert.DeserializeObject(json, type); redis.Notice += (s, e) => { if (e.Exception != null) Console.WriteLine(e.Log); }; */ Scheduler scheduler = new FreeSchedulerBuilder() .OnExecuting(task => { Console.WriteLine($"[{DateTime.Now.ToString("HH:mm:ss.fff")}] {task.Topic} ִ"); task.Remark("log.."); }) .UseStorage(fsql) /* .UseCluster(redis, new ClusterOptions { Name = Environment.GetCommandLineArgs().FirstOrDefault(a => a.StartsWith("--name="))?.Substring(7), HeartbeatInterval = 2, OfflineSeconds = 5, }) */ .Build(); if (Datafeed.GetPage(scheduler, null, null, null, null).Total == 0) { scheduler.AddTask("[ϵͳԤ]", "86400", -1, 3600); scheduler.AddTaskRunOnWeek("һִ", "json", -1, "1:12:00:00"); scheduler.AddTaskRunOnWeek("գӻ", "json", -1, "0:00:00:00"); scheduler.AddTaskRunOnWeek("罻", "json", -1, "6:00:00:00"); scheduler.AddTaskRunOnMonth("βһ", "json", -1, "-1:16:00:00"); scheduler.AddTaskRunOnMonth("³һ", "json", -1, "1:00:00:00"); scheduler.AddTask("ʱ20", "json", 10, 20); scheduler.AddTask("1", "json", new[] { 10, 30, 60, 100, 150, 200 }); } var builder = WebApplication.CreateBuilder(args); builder.Services.AddControllersWithViews(); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSingleton(fsql); //builder.Services.AddSingleton(redis); builder.Services.AddSingleton(scheduler); var app = builder.Build(); var applicationLifeTime = app.Services.GetService<IHostApplicationLifetime>(); applicationLifeTime.ApplicationStopping.Register(() => { scheduler.Dispose(); //redis.Dispose(); fsql.Dispose(); }); app.UseAuthorization(); app.UseDefaultFiles().UseStaticFiles(); app.MapControllers(); app.Run();
2881099/FreeScheduler
18,986
FreeScheduler/Datafeed.cs
using FreeRedis; using FreeScheduler.TaskHandlers; using System; using System.Collections.Generic; using System.Linq; namespace FreeScheduler { public static class Datafeed { public class ResultGetPage { public int Timestamp { get; set; } public string Description { get; set; } public int Total { get; set; } public List<TaskInfo> Tasks { get; set; } public List<DateTime?> NextTimes { get; private set; } public ClusterInfo[] Clusters { get; set; } public class ClusterInfo { public string Id { get; set; } public int Heartbeat { get; set; } public string Name { get; set; } public int TaskCount { get; set; } } internal ResultGetPage RefershNextTimes(Scheduler scheduler) { var now = scheduler.GetDateTime(); NextTimes = Tasks?.Select(t => { if (t.Status == TaskStatus.Completed) return null; TimeSpan? interval = null; if (t.Interval == TaskInterval.Custom) interval = scheduler._taskIntervalCustomHandler?.NextDelay(t); else interval = t.GetInterval(now, t.CurrentRound); return interval != null ? now.Add(interval.Value) : (DateTime?)null; }).ToList(); return this; } } public static Func<Scheduler, string, string, TaskStatus?, DateTime?, DateTime?, int, int, ResultGetPage> GetPageExtend; public static ResultGetPage GetPage(Scheduler scheduler, string clusterId = null, string topic = null, TaskStatus? status = null, DateTime? betweenTime = null, DateTime? endTime = null, int limit = 20, int page = 1) { topic = topic?.Trim(); if (GetPageExtend != null) return GetPageExtend(scheduler, clusterId, topic, status, betweenTime, endTime, limit, page).RefershNextTimes(scheduler); var result = new ResultGetPage(); result.Timestamp = Scheduler.GetJsTime(); var timezone = $"{(scheduler.TimeOffset >= TimeSpan.Zero ? "+" : "-")}{scheduler.TimeOffset.Hours.ToString().PadLeft(2, '0')}:{scheduler.TimeOffset.Minutes.ToString().PadLeft(2, '0')}"; result.Description = $"时区: {timezone}, 集群: {(scheduler.ClusterId == null ? "否" : $"是, 名称: {(string.IsNullOrWhiteSpace(scheduler.ClusterOptions.Name) ? scheduler.ClusterId : scheduler.ClusterOptions.Name)}")}"; if (scheduler._taskHandler is FreeSqlHandler) result.Description += $", 存储: FreeSql"; else if (scheduler._taskHandler is FreeRedisHandler) result.Description += $", 存储: Redis"; else if (scheduler._taskHandler is TestHandler) result.Description += $", 存储: Memory"; var clusterRedis = scheduler._clusterContext?._redis; var clusters = scheduler.ClusterId == null ? new ZMember[0] : clusterRedis.ZRangeByScoreWithScores($"{scheduler.ClusterOptions.RedisPrefix}", "-inf", "+inf"); if (clusters.Any()) { var clusterTasks = new int[clusters.Length]; var clusterNames = new string[clusters.Length]; using (var pipe = clusterRedis.StartPipe()) { foreach (var cluster in clusters) pipe.ZCard($"{scheduler.ClusterOptions.RedisPrefix}_register_{cluster.member}"); foreach (var cluster in clusters) pipe.HGet($"{scheduler.ClusterOptions.RedisPrefix}_name", cluster.member); var ret = pipe.EndPipe(); for (var a = 0; a < clusters.Length; a++) clusterTasks[a] = int.TryParse(ret[a]?.ToString() ?? "0", out var tryint) ? tryint : 0; for (var a = 0; a < clusters.Length; a++) { clusterNames[a] = ret[clusters.Length + a]?.ToString(); if (string.IsNullOrWhiteSpace(clusterNames[a])) clusterNames[a] = clusters[a].member; } } result.Clusters = clusters.Select((a, index) => new ResultGetPage.ClusterInfo { Id = a.member, Heartbeat = (int)a.score, TaskCount = clusterTasks[index], Name = clusterNames[index] }) .OrderByDescending(a => a.Id == scheduler.ClusterId ? int.MaxValue : a.TaskCount) .ThenBy(a => a.Id).ToArray(); } if (clusters.Any(a => a.member == clusterId)) { var taskIds = clusterRedis.ZRevRangeByLex($"{scheduler.ClusterOptions.RedisPrefix}_register_{clusterId}", "+", "-", Math.Max(0, page - 1) * limit, limit); taskIds = taskIds.Where(a => a.StartsWith($"{nameof(Scheduler.AddTask)}_")).Select(a => a.Substring(8)).ToArray(); if (taskIds.Any()) { if (scheduler._taskHandler is FreeSqlHandler fsqlHandler) { result.Tasks = fsqlHandler._fsql.Select<TaskInfo>() .Where(a => taskIds.Contains(a.Id)) .OrderByDescending(a => a.Id) .ToList() .Where(a => string.IsNullOrWhiteSpace(topic) || a.Topic == topic) .Where(a => status == null || a.Status == status) .Where(a => (betweenTime == null || a.CreateTime > betweenTime) && (endTime == null || a.CreateTime <= endTime)) .ToList(); } else if (scheduler._taskHandler is FreeRedisHandler redisHandler) { result.Tasks = redisHandler._redis.HMGet<TaskInfo>("FreeScheduler_hset", taskIds) .Where(a => string.IsNullOrWhiteSpace(topic) || a.Topic == topic) .Where(a => status == null || a.Status == status) .Where(a => (betweenTime == null || a.CreateTime > betweenTime) && (endTime == null || a.CreateTime <= endTime)) .ToList(); } } else result.Tasks = new List<TaskInfo>(); result.Total = result.Clusters.Where((a, index) => a.Id == clusterId).Select(a => a.TaskCount).FirstOrDefault(); } else { if (scheduler._taskHandler is FreeSqlHandler fsqlHandler) { result.Tasks = fsqlHandler._fsql.Select<TaskInfo>() .WhereIf(string.IsNullOrWhiteSpace(topic) == false, a => a.Topic == topic) .WhereIf(status != null, a => a.Status == status) .WhereIf(betweenTime != null, a => a.CreateTime > betweenTime) .WhereIf(endTime != null, a => a.CreateTime <= endTime) .Count(out var total) .Page(page, limit) .OrderByDescending(a => a.Id) .ToList(); result.Total = (int)total; } else if (scheduler._taskHandler is FreeRedisHandler redisHandler) { var zkey = "FreeScheduler_zset_all"; if (string.IsNullOrWhiteSpace(topic) == false) zkey = status == null ? $"FreeScheduler_zset_q:{topic}_all" : $"FreeScheduler_zset_q:{topic}_{status}"; else zkey = status == null ? "FreeScheduler_zset_all" : $"FreeScheduler_zset_{status}"; var max = endTime == null ? "+inf" : string.Concat(Math.Max(0, (int)endTime.Value.Subtract(_2020).TotalSeconds)); var min = betweenTime == null ? "-inf" : string.Concat(Math.Max(0, (int)betweenTime.Value.Subtract(_2020).TotalSeconds)); var taskIds = redisHandler._redis.ZRevRangeByScore(zkey, max, min, Math.Max(0, page - 1) * limit, limit); result.Tasks = taskIds.Any() ? redisHandler._redis.HMGet<TaskInfo>("FreeScheduler_hset", taskIds).ToList() : new List<TaskInfo>(); result.Total = (int)redisHandler._redis.ZCard(zkey); } else if (scheduler._taskHandler is TestHandler testHandler) { var queryTasks = testHandler._memoryTasks.Values .Where(a => string.IsNullOrWhiteSpace(topic) || a.Topic == topic) .Where(a => status == null || a.Status == status.Value) .Where(a => (betweenTime == null || a.CreateTime > betweenTime) && (endTime == null || a.CreateTime <= endTime)); result.Total = queryTasks.Count(); result.Tasks = queryTasks.OrderByDescending(a => a.Id).Skip(Math.Max(0, page - 1) * limit).Take(limit).ToList(); } } return result.RefershNextTimes(scheduler); } public static TaskInfo GetTask(Scheduler scheduler, string id) { if (scheduler._taskHandler is FreeSqlHandler fsqlHandler) return fsqlHandler._fsql.Select<TaskInfo>().Where(a => a.Id == id).First(); else if (scheduler._taskHandler is FreeRedisHandler redisHandler) return redisHandler._redis.HGet<TaskInfo>("FreeScheduler_hset", id); else if (scheduler._taskHandler is TestHandler testHandler) return testHandler._memoryTasks.Values.Where(a => a.Id == id).FirstOrDefault(); return null; } static readonly DateTime _2020 = new DateTime(2020, 1, 1); public static string AddTask(Scheduler scheduler, string topic, string body, int round, TaskInterval interval, string argument) { string taskId = null; switch (interval) { case TaskInterval.SEC: var secs = argument.Split(',').Select(a => int.Parse(a.Trim())).ToArray(); if (secs.Length > 1) taskId = scheduler.AddTask(topic, body, secs); else taskId = scheduler.AddTask(topic, body, round, secs[0]); break; case TaskInterval.RunOnDay: taskId = scheduler.AddTaskRunOnDay(topic, body, round, argument); break; case TaskInterval.RunOnWeek: taskId = scheduler.AddTaskRunOnWeek(topic, body, round, argument); break; case TaskInterval.RunOnMonth: taskId = scheduler.AddTaskRunOnMonth(topic, body, round, argument); break; case TaskInterval.Custom: taskId = scheduler.AddTaskCustom(topic, body, argument); break; } return taskId; } public static int CleanStorageData(Scheduler scheduler, int reserveSeconds) { var affrows = 0; if (scheduler._taskHandler is FreeSqlHandler fsqlHandler) { var fsql = fsqlHandler._fsql; var time1 = scheduler.GetDateTime().AddSeconds(-reserveSeconds); var taskIds = fsql.Select<TaskInfo>().Where(a => a.Status == TaskStatus.Completed && a.LastRunTime < time1).ToList(a => a.Id); if (taskIds.Any()) { fsql.Transaction(() => { affrows += fsql.Delete<TaskLog>().Where(a => taskIds.Contains(a.TaskId)).ExecuteAffrows(); affrows += fsql.Delete<TaskInfo>().Where(a => taskIds.Contains(a.Id)).ExecuteAffrows(); affrows += fsql.Delete<TaskLog>().Where(a => a.CreateTime < time1).ExecuteAffrows(); }); } } else if (scheduler._taskHandler is FreeRedisHandler redisHandler) { var redis = redisHandler._redis; var taskScore = (decimal)scheduler.GetDateTime().AddSeconds(-reserveSeconds).Subtract(_2020).TotalSeconds; var taskIds = redis.ZRangeByScore($"FreeScheduler_zset_{TaskStatus.Completed}", 0, taskScore); if (taskIds.Any()) { var tasks = redis.HMGet<TaskInfo>("FreeScheduler_hset", taskIds); for (var taskIndex = 0; taskIndex < taskIds.Length; taskIndex++) { var taskId = taskIds[taskIndex]; var task = tasks[taskIndex]; using (var pipe = redis.StartPipe()) { pipe.HDel("FreeScheduler_hset", taskId); pipe.ZRem($"FreeScheduler_zset_all", taskId); pipe.ZRem($"FreeScheduler_zset_{TaskStatus.Running}", taskId); pipe.ZRem($"FreeScheduler_zset_{TaskStatus.Paused}", taskId); pipe.ZRem($"FreeScheduler_zset_{TaskStatus.Completed}", taskId); if (task != null) { pipe.ZRem($"FreeScheduler_zset_q:{task.Topic}_all", taskId); pipe.ZRem($"FreeScheduler_zset_q:{task.Topic}_{TaskStatus.Running}", taskId); pipe.ZRem($"FreeScheduler_zset_q:{task.Topic}_{TaskStatus.Paused}", taskId); pipe.ZRem($"FreeScheduler_zset_q:{task.Topic}_{TaskStatus.Completed}", taskId); } pipe.Del($"FreeScheduler_zset_log:{taskId}"); foreach (var scan in redis.ZScan($"FreeScheduler_zset_log:{taskId}", "*", 100)) if (scan.Length > 0) pipe.ZRem("FreeScheduler_zset_log_all", scan.Select(a => a.member).ToArray()); var ret = pipe.EndPipe(); affrows += int.Parse(ret[0]?.ToString()); for (var a = 6; a < ret.Length; a++) affrows += int.Parse(ret[a]?.ToString()); } } } var logs = redis.ZRangeByScore("FreeScheduler_zset_log_all", 0, taskScore); if (logs.Any()) { using (var pipe = redis.StartPipe()) { pipe.ZRemRangeByScore("FreeScheduler_zset_log_all", 0, taskScore); foreach (var log in logs) { var resultMember = redis.Deserialize(log, typeof(TaskLog)) as TaskLog; if (resultMember == null) continue; pipe.ZRem($"FreeScheduler_zset_log:{resultMember.TaskId}", log); } var ret = pipe.EndPipe(); for (var a = 0; a < ret.Length; a++) affrows += int.Parse(ret[a]?.ToString()); } } } if (scheduler._clusterContext != null) { var redis = scheduler._clusterContext._redis; var timestamp = Scheduler.GetJsTime(); foreach (var scan in redis.HScan($"{scheduler.ClusterOptions.RedisPrefix}_offline", "*", 100)) { var fields = scan.Where(a => int.TryParse(a.Value ?? "", out var tryint) && timestamp - tryint > 86400).Select(a => a.Key).ToArray(); if (fields.Any()) redis.HDel($"{scheduler.ClusterOptions.RedisPrefix}_offline", fields); } } return affrows; } public class ResultGetLogs { public int Total { get; set; } public List<TaskLog> Logs { get; set; } } public static Func<Scheduler, string, int, int, ResultGetLogs> GetLogsExtend; public static ResultGetLogs GetLogs(Scheduler scheduler, string taskId, int limit = 20, int page = 1) { if (GetLogsExtend != null) return GetLogsExtend(scheduler, taskId, limit, page); var result = new ResultGetLogs(); if (scheduler._taskHandler is FreeSqlHandler fsqlHandler) { result.Logs = fsqlHandler._fsql.Select<TaskLog>() .WhereIf(string.IsNullOrWhiteSpace(taskId) == false, a => a.TaskId == taskId) .Count(out var total) .Page(page, limit) .OrderByDescending(a => a.CreateTime) .ToList(); result.Total = (int)total; } else if (scheduler._taskHandler is FreeRedisHandler redisHandler) { var zkey = string.IsNullOrWhiteSpace(taskId) ? "FreeScheduler_zset_log_all" : $"FreeScheduler_zset_log:{taskId}"; var logs = redisHandler._redis.ZRevRangeByScore(zkey, "+inf", "-inf", Math.Max(0, page - 1) * limit, limit); result.Logs = logs.Select(a => redisHandler._redis.Deserialize(a, typeof(TaskLog)) as TaskLog).ToList(); result.Total = (int)redisHandler._redis.ZCard(zkey); } else if (scheduler._taskHandler is TestHandler) { throw new Exception($"{nameof(TestHandler)} 未实现 {nameof(TaskLog)} 日志记录"); } return result; } public class ResultGetClusterLogs { public int Total { get; set; } public List<ClusterLog> Logs { get; set; } } public class ClusterLog { public DateTime CreateTime { get; set; } public string ClusterId { get; set; } public string ClusterName { get; set; } public string Message { get; set; } } public static ResultGetClusterLogs GetClusterLogs(Scheduler scheduler, int limit = 20, int page = 1) { var result = new ResultGetClusterLogs(); if (scheduler._clusterContext == null) throw new Exception("未开启集群,无法使用该操作"); var redis = scheduler._clusterContext._redis; var logkey = $"{scheduler.ClusterOptions.RedisPrefix}_log"; result.Total = (int)redis.LLen(logkey); result.Logs = redis.LRange(logkey, Math.Max(0, page - 1) * limit, Math.Max(0, page) * limit).Select(a => { var cols = a.Split(new[] { "|" }, 4, StringSplitOptions.None); return new ClusterLog { CreateTime = new DateTime(1970, 1, 1).Add(scheduler.TimeOffset).AddSeconds(int.TryParse(cols[0], out var tryint) ? tryint : 0), ClusterId = cols[1], ClusterName = cols[2], Message = cols[3], }; }).ToList(); return result; } } }
2881099/FreeScheduler
13,922
FreeScheduler/ClusterContext.cs
using FreeRedis; using System; using System.Collections.Concurrent; using System.Linq; using System.Threading; namespace FreeScheduler { public class ClusterOptions { /// <summary> /// 可视化名称 /// </summary> public string Name { get; set; } /// <summary> /// 心跳间隔,默认值:5秒 /// </summary> public int HeartbeatInterval { get; set; } = 5; /// <summary> /// 离线:心跳停止后的秒数,默认值:30秒 /// </summary> public int OfflineSeconds { get; set; } = 30; /// <summary> /// Redis key 前辍标识 /// </summary> public string RedisPrefix { get; set; } = "freescheduler_cluster"; } class ClusterContext { public string ClusterId { get; private set; } public ClusterOptions Options { get; } internal Scheduler _scheduler { get; set; } internal RedisClient _redis { get; } public ClusterContext(RedisClient redis, ClusterOptions options) { _redis = redis; ClusterId = Guid.NewGuid().ToString("n"); Options = new ClusterOptions(); if (options != null) { Options.Name = options.Name; if (options.HeartbeatInterval > 0) Options.HeartbeatInterval = options.HeartbeatInterval; Options.OfflineSeconds = Math.Max(Options.HeartbeatInterval * 2, options.OfflineSeconds); if (!string.IsNullOrWhiteSpace(options.RedisPrefix)) Options.RedisPrefix = options.RedisPrefix; } } void Logger(string msg) { var timestamp = Scheduler.GetJsTime(); _redis.Eval("redis.call('lpush',KEYS[1],ARGV[1]); if(redis.call('llen',KEYS[1])>1000)then redis.call('rpop',KEYS[1]) end return 1", new[] { $"{Options.RedisPrefix}_log" }, $"{timestamp}|{ClusterId}|{Options.Name}|{msg}"); } internal void Init(Scheduler scheduler) { _scheduler = scheduler; HeartbeatOffline(); _redis.SubscribeList($"{Options.RedisPrefix}_alloc", msg => { if (string.IsNullOrWhiteSpace(msg)) return; if (IsOffline() == true) { _redis.RPush($"{Options.RedisPrefix}_alloc", msg); Thread.CurrentThread.Join(1000); return; } Logger($"alloc: {msg}"); var args = msg.Split('|'); var timestamp = Scheduler.GetJsTime(); int.TryParse(args[0], out var time); if (timestamp - time > 60 * 5) return; //过滤超过5分钟之前的分配 switch (args[1]) { case nameof(ReloadTask): { var taskId = args[2]; if (_scheduler._tasks.ContainsKey(taskId)) return; var task = _scheduler._taskHandler.Load(taskId); if (task == null) return; if (task.Status != TaskStatus.Running) return; if (task.Round != -1 && task.CurrentRound >= task.Round) return; if (task.Interval == TaskInterval.Custom && _scheduler._taskIntervalCustomHandler == null) return; _scheduler.AddTaskPriv(task, false); break; } } }); _redis.Subscribe($"{Options.RedisPrefix}_{ClusterId}", SubscribeClusterId); } void SubscribeClusterId(string chan, object data) { var msg = data as string; if (string.IsNullOrWhiteSpace(msg)) return; Logger($"remote call: {msg}"); var args = msg.Split('|'); var timestamp = Scheduler.GetJsTime(); int.TryParse(args[0], out var time); if (timestamp - time > 60 * 5) return; //过滤超过5分钟之前的命令 switch (args[1]) { case nameof(Scheduler.RemoveTempTask): { var result = _scheduler.RemoveTempTask(args[2]) ? 1 : 0; _redis.Publish($"{Options.RedisPrefix}_{args[3]}", $"{timestamp}|response|{args[4]}|{result}"); break; } case nameof(Scheduler.ExistsTempTask): { var result = _scheduler.ExistsTempTask(args[2]) ? 1 : 0; _redis.Publish($"{Options.RedisPrefix}_{args[3]}", $"{timestamp}|response|{args[4]}|{result}"); break; } case nameof(Scheduler.RemoveTask): { var result = _scheduler.RemoveTask(args[2]) ? 1 : 0; _redis.Publish($"{Options.RedisPrefix}_{args[3]}", $"{timestamp}|response|{args[4]}|{result}"); break; } case nameof(Scheduler.ExistsTask): { var result = _scheduler.ExistsTask(args[2]) ? 1 : 0; _redis.Publish($"{Options.RedisPrefix}_{args[3]}", $"{timestamp}|response|{args[4]}|{result}"); break; } case nameof(Scheduler.PauseTask): { var result = _scheduler.PauseTask(args[2]) ? 1 : 0; _redis.Publish($"{Options.RedisPrefix}_{args[3]}", $"{timestamp}|response|{args[4]}|{result}"); break; } case nameof(Scheduler.RunNowTask): { var result = _scheduler.RunNowTask(args[2]) ? 1 : 0; _redis.Publish($"{Options.RedisPrefix}_{args[3]}", $"{timestamp}|response|{args[4]}|{result}"); break; } case "response": if (_responseWait.TryGetValue(args[2], out var wait)) { wait.Result = args[3]; wait.Wait.Set(); } break; } } public class ClusterResponseWait : IDisposable { public ManualResetEvent Wait { get; } = new ManualResetEvent(false); public string Result { get; set; } public void Dispose() { Wait.Close(); Wait.Dispose(); } } ConcurrentDictionary<string, ClusterResponseWait> _responseWait { get; } = new ConcurrentDictionary<string, ClusterResponseWait>(); public bool RemoteCall(string id, string targetKey, string method, out bool result) { if (_redis != null) { var targetClusterId = _redis.HGet($"{Options.RedisPrefix}_register", $"{targetKey}_{id}"); if (!string.IsNullOrWhiteSpace(targetClusterId) && targetClusterId != ClusterId) { var waitId = Guid.NewGuid().ToString("n"); using (var wait = new ClusterResponseWait()) { if (_responseWait.TryAdd(waitId, wait)) { var timestamp = Scheduler.GetJsTime(); _redis.Publish($"{Options.RedisPrefix}_{targetClusterId}", $"{timestamp}|{method}|{id}|{ClusterId}|{waitId}"); if (!wait.Wait.WaitOne(TimeSpan.FromSeconds(10))) { _responseWait.TryRemove(waitId, out var _); throw new TimeoutException($"Scheduler cluster {method}({id}) timeout"); } result = wait.Result == "1"; return true; } } } } result = false; return false; } void HeartbeatOffline() { var timestamp = Scheduler.GetJsTime(); object timeoutResult = null; try { timeoutResult = _redis.Eval($@"if(redis.call('hexists',KEYS[1],ARGV[2])==1)then return '-1' end redis.call('zadd',KEYS[2],ARGV[1],ARGV[2]){(string.IsNullOrWhiteSpace(Options.Name) ? "" : $" redis.call('hset',KEYS[3],ARGV[2],ARGV[3])")} local a=redis.call('zrangebyscore',KEYS[2],0,ARGV[1]-{Options.OfflineSeconds},'limit',0,1) if(a and a[1]==ARGV[2])then return nil end if(a and a[1])then if(redis.call('hsetnx',KEYS[1],a[1],ARGV[1])==1)then return {{a[1],1}} end if(ARGV[1]-tonumber(redis.call('hget',KEYS[1],a[1]))>120)then redis.call('zrem',KEYS[2],a[1]) end end return nil", new[] { $"{Options.RedisPrefix}_offline", $"{Options.RedisPrefix}", $"{Options.RedisPrefix}_name" }, timestamp, ClusterId, Options.Name); } finally { _scheduler.AddTempTask(TimeSpan.FromSeconds(Options.HeartbeatInterval), HeartbeatOffline, false); } if (timeoutResult == null) return; if (timeoutResult as string == "-1") //被其他进程判定离线 { Logger($"被其他进程判定离线"); _scheduler.CancelAllTask(); var offlinets = timestamp - _redis.HGet<int>($"{Options.RedisPrefix}_offline", ClusterId); if (offlinets > 60 * 5 || offlinets > 5 && _scheduler._quantityTaskRunning <= 0) { var oldClusterId = ClusterId; _redis.UnSubscribe($"{Options.RedisPrefix}_{ClusterId}"); ClusterId = Guid.NewGuid().ToString("n") + "_renew"; //离线超过5分钟,取消本进程任务,重新生成 ClusterId _redis.Subscribe($"{Options.RedisPrefix}_{ClusterId}", SubscribeClusterId); Logger($"重置 ClusterId {oldClusterId} -> {ClusterId}"); } return; } var trobjs = timeoutResult as object[]; if (trobjs.Length != 2 || trobjs[1]?.ToString() != "1") return; //只有一个进程获得 ReloadTask 权 var timeoutClusterId = trobjs[0]?.ToString(); if (string.IsNullOrWhiteSpace(timeoutClusterId)) return; using (var pipe = _redis.StartPipe()) { pipe.ZRem($"{Options.RedisPrefix}", timeoutClusterId); pipe.HDel($"{Options.RedisPrefix}_name", timeoutClusterId); pipe.EndPipe(); } Logger($"{timeoutClusterId} 离线被清理"); ReloadTask(timeoutClusterId); } void ReloadTask(string tempClusterId) { var regkey = $"{Options.RedisPrefix}_register_{tempClusterId}"; try { foreach (var scan in _redis.ZScan(regkey, "*", 100)) { if (scan.Any() == false) continue; _redis.Eval($"for a=2,#ARGV do redis.call('zrem',KEYS[1],ARGV[a]) if(redis.call('hget',KEYS[2],ARGV[a])==ARGV[1])then redis.call('hdel',KEYS[2],ARGV[a]) end end return nil", new[] { regkey, $"{Options.RedisPrefix}_register" }, new[] { tempClusterId }.Concat(scan.Select(a => a.member)).ToArray()); var timestamp = Scheduler.GetJsTime(); var taskIds = scan.Where(sr => sr.member.StartsWith($"{nameof(Scheduler.AddTask)}_")).Select(sr => sr.member.Substring(8)) //忽略内存任务 AddTempTask_ .Where(taskId => _scheduler._tasks.ContainsKey(taskId) == false) .Select(taskId => $"{timestamp}|{nameof(ReloadTask)}|{taskId}").ToArray(); if (taskIds.Any()) { _redis.LPush($"{Options.RedisPrefix}_alloc", taskIds); Logger($"{tempClusterId} 离线有 {taskIds.Length} 个任务被分配"); } break; //数量较多时,延迟处理 } if (_redis.ZCard(regkey) > 0) _scheduler.AddTempTask(TimeSpan.FromMilliseconds(1_000), () => ReloadTask(tempClusterId), false); } catch { _scheduler.AddTempTask(TimeSpan.FromMilliseconds(30_000), () => ReloadTask(tempClusterId), false); } } public bool IsOffline() { try { var offline = _redis.HExists($"{Options.RedisPrefix}_offline", ClusterId); return offline; } catch { return false; } } public bool Register(string id, string targetKey) { var timestamp = Scheduler.GetJsTime(); var result = _redis.Eval(@"if(redis.call('hsetnx',KEYS[1],ARGV[3],ARGV[1])==1)then redis.call('zadd',KEYS[2],ARGV[2],ARGV[3]) return 1 end if(redis.call('hexists',KEYS[3],redis.call('hget',KEYS[1],ARGV[3]))==1)then redis.call('hset',KEYS[1],ARGV[3],ARGV[1]) redis.call('zadd',KEYS[2],ARGV[2],ARGV[3]) return 1 end return 0", new[] { $"{Options.RedisPrefix}_register", $"{Options.RedisPrefix}_register_{ClusterId}", $"{Options.RedisPrefix}_offline" }, ClusterId, timestamp, $"{targetKey}_{id}")?.ToString(); return result == "1"; } public void Remove(string id, string targetKey) { _redis.Eval(@"local a=redis.call('hget',KEYS[1],ARGV[2]) if(a and a==ARGV[1])then redis.call('hdel',KEYS[1],ARGV[2]) redis.call('zrem',KEYS[1]..'_'..a,ARGV[2]) end return 1", new[] { $"{Options.RedisPrefix}_register" }, ClusterId, $"{targetKey}_{id}"); } } }
2881099/FreeScheduler
18,893
FreeScheduler/Scheduler.cs
using System; using System.Collections.Concurrent; using System.Linq; using System.Threading; namespace FreeScheduler { /// <summary> /// 调度管理临时任务(一次性)、循环任务(存储落地) /// </summary> public class Scheduler : IDisposable { IdleBus _ib; int _quantityTempTask; int _quantityTask; internal int _quantityTaskRunning; /// <summary> /// 临时任务数量 /// </summary> public int QuantityTempTask => _quantityTempTask; /// <summary> /// 循环任务数量 /// </summary> public int QuantityTask => _quantityTask; /// <summary> /// 扫描线程间隔(默认值:200毫秒) /// </summary> public TimeSpan ScanInterval { get => _ib.ScanOptions.Interval; set => _ib.ScanOptions.Interval = value; } internal WorkQueue _wq; internal ITaskHandler _taskHandler; internal ITaskIntervalCustomHandler _taskIntervalCustomHandler; internal ConcurrentDictionary<string, TaskInfo> _tasks = new ConcurrentDictionary<string, TaskInfo>(); internal ClusterContext _clusterContext; public string ClusterId => _clusterContext?.ClusterId; public ClusterOptions ClusterOptions => _clusterContext?.Options; /// <summary> /// 时区 /// </summary> public TimeSpan TimeOffset { get; } internal DateTime GetDateTime() => DateTime.UtcNow.Add(TimeOffset); internal static int GetJsTime() => (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds; #region Dispose ~Scheduler() => Dispose(); bool isdisposed = false; object isdisposedLock = new object(); public void Dispose() { if (isdisposed) return; lock (isdisposedLock) { if (isdisposed) return; isdisposed = true; } _ib?.Dispose(); _wq?.Dispose(); _tasks?.Clear(); Interlocked.Exchange(ref _quantityTempTask, 0); Interlocked.Exchange(ref _quantityTask, 0); (_taskHandler as IDisposable)?.Dispose(); } #endregion [Obsolete("请使用最新的 var scheduler = new FreeSchedulerBuilder().OnExecuting(..).Build() 方式创建")] public Scheduler(ITaskHandler taskHandler) : this(taskHandler, null, null, TimeSpan.Zero, true) { } [Obsolete("请使用最新的 var scheduler = new FreeSchedulerBuilder().OnExecuting(..).UseCustomInterval(..).Build() 方式创建")] public Scheduler(ITaskHandler taskHandler, ITaskIntervalCustomHandler taskIntervalCustomHandler) : this(taskHandler, taskIntervalCustomHandler, null, TimeSpan.Zero, true) { } internal Scheduler(ITaskHandler taskHandler, ITaskIntervalCustomHandler taskIntervalCustomHandler, ClusterContext culsterContext, TimeSpan timeOffset, bool autoLoad) { if (taskHandler == null) throw new ArgumentNullException("taskHandler 参数不能为 null"); _taskHandler = taskHandler; _taskIntervalCustomHandler = taskIntervalCustomHandler; _clusterContext = culsterContext; TimeOffset = timeOffset; _ib = new IdleBus(); _ib.ScanOptions.Interval = TimeSpan.FromMilliseconds(200); _ib.ScanOptions.BatchQuantity = 100000; _ib.ScanOptions.BatchQuantityWait = TimeSpan.FromMilliseconds(100); _ib.ScanOptions.QuitWaitSeconds = 20; _ib.Notice += new EventHandler<IdleBus<IDisposable>.NoticeEventArgs>((s, e) => { }); _wq = new WorkQueue(30); if (_clusterContext != null) { _wq.Enqueue(() => { _clusterContext.Init(this); if (autoLoad) LocalLoadTask(1); }); } else { if (autoLoad) LocalLoadTask(1); } void LocalLoadTask(int pageNumber) { if (!autoLoad) return; var tasks = _taskHandler.LoadAll(pageNumber, 100); var tasksCount = tasks.Count(); foreach (var task in tasks) { if (task.Interval == TaskInterval.Custom && taskIntervalCustomHandler == null) continue; AddTaskPriv(task, false); } if (tasksCount < 100) return; AddTempTask(TimeSpan.FromSeconds(1), () => LocalLoadTask(pageNumber + 1), false); } } /// <summary> /// 临时任务(程序重启会丢失) /// </summary> /// <param name="timeout"></param> /// <param name="handle"></param> /// <returns></returns> public string AddTempTask(TimeSpan timeout, Action handle) => AddTempTask(timeout, handle, true); internal string AddTempTask(TimeSpan timeout, Action handle, bool cluster) { var id = Guid.NewGuid().ToString(); if (!cluster) id = $"system_{id}"; var bus = new IdleTimeout(() => { if (isdisposed) return; if (_ib.TryRemove(id) == false) return; Interlocked.Decrement(ref _quantityTempTask); if (handle != null) { if (cluster && _clusterContext?.IsOffline() == true) return; _wq.Enqueue(handle); } if (cluster) _clusterContext?.Remove(id, nameof(AddTempTask)); }); if (_ib.TryRegister(id, () => bus, timeout)) { _ib.Get(id); Interlocked.Increment(ref _quantityTempTask); } if (cluster) _clusterContext?.Register(id, nameof(AddTempTask)); return id; } /// <summary> /// 删除临时任务 /// </summary> /// <param name="id"></param> /// <returns></returns> public bool RemoveTempTask(string id) { if (_tasks.ContainsKey(id) == false && _ib.TryRemove(id)) { Interlocked.Decrement(ref _quantityTempTask); _clusterContext?.Remove(id, nameof(AddTempTask)); return true; } if (_clusterContext?.RemoteCall(id, nameof(AddTempTask), nameof(RemoveTempTask), out var result) == true) return result; return false; } /// <summary> /// 判断临时任务是否存在 /// </summary> /// <param name="id"></param> /// <returns></returns> public bool ExistsTempTask(string id) { if (_tasks.ContainsKey(id) == false && _ib.Exists(id)) return true; if (_clusterContext?.RemoteCall(id, nameof(AddTempTask), nameof(ExistsTempTask), out var result) == true) return result; return false; } /// <summary> /// 添加循环执行的任务(秒) /// </summary> /// <param name="topic">名称</param> /// <param name="body">数据</param> /// <param name="round">循环次数,-1为永久循环</param> /// <param name="seconds">秒数</param> /// <returns></returns> public string AddTask(string topic, string body, int round, int seconds) => AddTaskPriv(topic, body, round, TaskInterval.SEC, string.Concat(seconds)); /// <summary> /// 添加循环执行的任务(秒)<para></para> /// 可设置参数值 10,20,30 分别对每一轮进行设置定时秒数,例如:<para></para> /// round = 12<para></para> /// seconds = 60,60,60,60,60,120,120,120,120,120,1200,1200<para></para> /// Executing 事件可设置 Status 状态,在任意一轮中标记任务【完成】 /// </summary> /// <param name="topic">名称</param> /// <param name="body">数据</param> /// <param name="seconds">每一轮的定时秒数:10,20,30</param> /// <returns></returns> public string AddTask(string topic, string body, int[] seconds) => AddTaskPriv(topic, body, seconds.Length, TaskInterval.SEC, string.Join(",", seconds)); /// <summary> /// 添加循环执行的任务(每天的什么时候执行)<para></para> /// 每天 expression UTC时间: "20:30:00" /// </summary> /// <returns></returns> public string AddTaskRunOnDay(string topic, string body, int round, string expression) => AddTaskPriv(topic, body, round, TaskInterval.RunOnDay, expression); /// <summary> /// 添加循环执行的任务(每个星期的什么时候执行)<para></para> /// 每周日 expression UTC时间: "0:20:30:00"<para></para> /// 每周六 expression UTC时间: "6:20:30:00" /// </summary> /// <returns></returns> public string AddTaskRunOnWeek(string topic, string body, int round, string expression) => AddTaskPriv(topic, body, round, TaskInterval.RunOnWeek, expression); /// <summary> /// 添加循环执行的任务(每个月的什么时候执行)<para></para> /// 每月1号: "1:20:30:00"<para></para> /// 每月最后1天:"-1:20:30:00"<para></para> /// 每月倒数第2天:"-2:20:30:00"<para></para> /// 注意:expression UTC时间 /// </summary> /// <returns></returns> public string AddTaskRunOnMonth(string topic, string body, int round, string expression) => AddTaskPriv(topic, body, round, TaskInterval.RunOnMonth, expression); /// <summary> /// 添加 Custom 任务,new Scheduler(.., new YourCustomHandler()) /// </summary> /// <returns></returns> public string AddTaskCustom(string topic, string body, string expression) => AddTaskPriv(topic, body, -1, TaskInterval.Custom, expression); string AddTaskPriv(string topic, string body, int round, TaskInterval interval, string argument) { var task = new TaskInfo { Id = $"{GetDateTime().ToString("yyyyMMdd")}.{Snowfake.Default.nextId()}", Topic = topic, Body = body, CreateTime = GetDateTime(), Round = round, Interval = interval, IntervalArgument = argument, CurrentRound = 0, ErrorTimes = 0, LastRunTime = new DateTime(1970, 1, 1), Status = TaskStatus.Running }; AddTaskPriv(task, true); return task.Id; } internal void AddTaskPriv(TaskInfo task, bool isSave) { if (task.Status != TaskStatus.Running) return; if (task.Round != -1 && task.CurrentRound >= task.Round) return; if (task.Interval == TaskInterval.Custom && _taskIntervalCustomHandler == null) throw new Exception($"{task.Id} Custom 未设置 {nameof(FreeSchedulerBuilder.UseCustomInterval)}"); if (_clusterContext != null && _clusterContext.Register(task.Id, nameof(AddTask)) == false) return; IdleTimeout bus = null; bus = new IdleTimeout(() => { if (_ib.TryRemove(task.Id) == false && task.InternalFlag == 0) return; var currentRound = task.IncrementCurrentRound(); var round = task.Round; if (task.Status != TaskStatus.Running) return; if (round != -1 && currentRound >= round) { if (_tasks.TryRemove(task.Id, out var old)) { Interlocked.Decrement(ref _quantityTask); _clusterContext?.Remove(task.Id, nameof(AddTask)); } } var remark = task.InternalFlag == 1 ? "[RunNowTask] 立刻运行任务(人工触发)" : ""; if (_clusterContext?.IsOffline() == true) //被其他进程判定离线 { if (_tasks.TryRemove(task.Id, out var old)) Interlocked.Decrement(ref _quantityTask); return; } _wq.Enqueue(() => { Interlocked.Increment(ref _quantityTaskRunning); try { var result = new TaskLog { CreateTime = GetDateTime(), TaskId = task.Id, Round = currentRound, Remark = remark, Success = true }; var startdt = DateTime.UtcNow; var status = task.Status; try { task.RemarkValue = null; _taskHandler.OnExecuting(this, task); } catch (Exception ex) { task.IncrementErrorTimes(); result.Exception = ex.InnerException == null ? $"{ex.Message}\r\n{ex.StackTrace}" : $"{ex.Message}\r\n{ex.StackTrace}\r\n\r\nInnerException: {ex.InnerException.Message}\r\n{ex.InnerException.StackTrace}"; result.Success = false; } finally { if (string.IsNullOrWhiteSpace(task.RemarkValue) == false) { if (task.RemarkValue.StartsWith(", ")) task.RemarkValue = task.RemarkValue.Substring(2); result.Remark += string.IsNullOrWhiteSpace(result.Remark) ? task.RemarkValue : $", {task.RemarkValue}"; } task.RemarkValue = null; if (status != task.Status) result.Remark = $"{result.Remark}{(string.IsNullOrEmpty(result.Remark) ? "" : ", ")}[Executing] 任务状态 `{status}` 已转为 `{task.Status}`"; result.ElapsedMilliseconds = (long)DateTime.UtcNow.Subtract(startdt).TotalMilliseconds; task.LastRunTime = GetDateTime(); if (round != -1 && currentRound >= round) task.Status = TaskStatus.Completed; _taskHandler.OnExecuted(this, task, result); } if (task.Status != TaskStatus.Running) return; if (_tasks.ContainsKey(task.Id) == false) return; if (round == -1 || currentRound < round) { var nextTimeSpan = LocalGetNextTimeSpan(task.Status, currentRound); if (nextTimeSpan != null && _ib.TryRegister(task.Id, () => bus, nextTimeSpan.Value)) _ib.Get(task.Id); } } finally { Interlocked.Decrement(ref _quantityTaskRunning); } }); }); if (_tasks.TryAdd(task.Id, task)) { if (isSave) { try { _taskHandler.OnAdd(task); } catch { _tasks.TryRemove(task.Id, out var old); _clusterContext?.Remove(task.Id, nameof(AddTask)); throw; } } Interlocked.Increment(ref _quantityTask); var nextTimeSpan = LocalGetNextTimeSpan(task.Status, task.CurrentRound); if (nextTimeSpan != null && _ib.TryRegister(task.Id, () => bus, nextTimeSpan.Value)) _ib.Get(task.Id); } TimeSpan? LocalGetNextTimeSpan(TaskStatus status, int curRound) { TimeSpan? nextTimeSpan = null; if (task.Interval == TaskInterval.Custom) nextTimeSpan = _taskIntervalCustomHandler.NextDelay(task); else nextTimeSpan = task.GetInterval(GetDateTime(), curRound); if (nextTimeSpan == null) { if (_tasks.TryRemove(task.Id, out var old)) { Interlocked.Decrement(ref _quantityTask); _clusterContext?.Remove(task.Id, nameof(AddTask)); } task.Status = TaskStatus.Completed; if (status != task.Status) { _taskHandler.OnExecuted(this, task, new TaskLog { CreateTime = GetDateTime(), TaskId = task.Id, Round = task.CurrentRound, Remark = $"[NextInterval] 任务状态 `{status}` 已转为 `{task.Status}`", Success = true, }); } return null; } return nextTimeSpan; } } /// <summary> /// 删除循环任务 /// </summary> /// <param name="id"></param> /// <returns></returns> public bool RemoveTask(string id) { if (_tasks.TryRemove(id, out var old)) { Interlocked.Decrement(ref _quantityTask); _taskHandler.OnRemove(old); _clusterContext?.Remove(id, nameof(AddTask)); return _ib.TryRemove(id, true); } if (_clusterContext?.RemoteCall(id, nameof(AddTask), nameof(RemoveTask), out var result) == true) return result; var task = _taskHandler.Load(id); if (task != null) { _taskHandler.OnRemove(task); _clusterContext?.Remove(id, nameof(AddTask)); return true; } return _ib.TryRemove(id, true); } internal void CancelAllTask() { foreach (var id in _tasks.Keys) { if (_tasks.TryRemove(id, out var old)) { Interlocked.Decrement(ref _quantityTask); _ib.TryRemove(id, true); } } foreach (var id in _ib.GetKeys()) { if (id.StartsWith("system_") == false && _ib.TryRemove(id, true)) Interlocked.Decrement(ref _quantityTempTask); } } /// <summary> /// 判断循环任务是否存在 /// </summary> /// <param name="id"></param> /// <returns></returns> public bool ExistsTask(string id) { if (_tasks.ContainsKey(id)) return true; if (_clusterContext?.RemoteCall(id, nameof(AddTask), nameof(ExistsTask), out var result) == true) return result; return false; } /// <summary> /// 查询正在运行中的循环任务 /// </summary> /// <param name="where"></param> /// <returns></returns> public TaskInfo[] FindTask(Func<TaskInfo, bool> where) => _tasks.Values.Where(where).ToArray(); /// <summary> /// 恢复已暂停的任务 /// </summary> /// <param name="id"></param> /// <returns></returns> public bool ResumeTask(string id) { var task = _taskHandler.Load(id); if (task == null) return false; if (task.Status != TaskStatus.Paused) return false; var status = task.Status; task.Status = TaskStatus.Running; _taskHandler.OnExecuted(this, task, new TaskLog { CreateTime = GetDateTime(), TaskId = task.Id, Round = task.CurrentRound, Remark = $"[ResumeTask] 任务状态 `{status}` 已转为 `{task.Status}`", Success = true, }); AddTaskPriv(task, false); return true; } /// <summary> /// 暂停正在运行的任务 /// </summary> /// <param name="id"></param> /// <returns></returns> public bool PauseTask(string id) { if (_tasks.TryRemove(id, out var task)) { Interlocked.Decrement(ref _quantityTask); _clusterContext?.Remove(id, nameof(AddTask)); var status = task.Status; task.Status = TaskStatus.Paused; if (status != task.Status) { _taskHandler.OnExecuted(this, task, new TaskLog { CreateTime = GetDateTime(), TaskId = task.Id, Round = task.CurrentRound, Remark = $"[PauseTask] 任务状态 `{status}` 已转为 `{task.Status}`", Success = true, }); } return _ib.TryRemove(id, true); } if (_clusterContext?.RemoteCall(id, nameof(AddTask), nameof(PauseTask), out var result) == true) return result; return false; } /// <summary> /// 立刻运行任务(人工触发) /// </summary> /// <param name="id"></param> /// <returns></returns> public bool RunNowTask(string id) { if (_tasks.TryGetValue(id, out var task)) { if (_ib.Exists(id) == false) return false; //正在触发 task.InternalFlag = 1; try { return _ib.TryRemove(id, true); //立即触发 } finally { task.InternalFlag = 0; } } if (_clusterContext?.RemoteCall(id, nameof(AddTask), nameof(RunNowTask), out var result2) == true) return result2; task = _taskHandler.Load(id); if (task != null) { var currentRound = task.IncrementCurrentRound(); var result = new TaskLog { CreateTime = GetDateTime(), TaskId = task.Id, Round = currentRound, Remark = $"[RunNowTask] 立刻运行任务(人工触发)", Success = true, }; var startdt = DateTime.UtcNow; var status = task.Status; try { task.RemarkValue = null; _taskHandler.OnExecuting(this, task); } catch (Exception ex) { task.IncrementErrorTimes(); result.Exception = ex.InnerException == null ? $"{ex.Message}\r\n{ex.StackTrace}" : $"{ex.Message}\r\n{ex.StackTrace}\r\n\r\nInnerException: {ex.InnerException.Message}\r\n{ex.InnerException.StackTrace}"; result.Success = false; } finally { if (string.IsNullOrWhiteSpace(task.RemarkValue) == false) { if (task.RemarkValue.StartsWith(", ")) task.RemarkValue = task.RemarkValue.Substring(2); result.Remark += string.IsNullOrWhiteSpace(result.Remark) ? task.RemarkValue : $", {task.RemarkValue}"; } task.RemarkValue = null; if (status != task.Status) result.Remark = $"{result.Remark}{(string.IsNullOrEmpty(result.Remark) ? "" : ", ")}[Executing] 任务状态 `{status}` 已转为 `{task.Status}`"; result.ElapsedMilliseconds = (long)DateTime.UtcNow.Subtract(startdt).TotalMilliseconds; task.LastRunTime = GetDateTime(); _taskHandler.OnExecuted(this, task, result); } return true; } return false; } } }
2881099/FreeScheduler
7,871
FreeScheduler/FreeSchedulerBuilder.cs
using FreeRedis; using FreeScheduler; using FreeScheduler.TaskHandlers; using Newtonsoft.Json.Linq; using System; using System.Reflection; /// <summary> /// Scheduler 对象构建器 /// </summary> public class FreeSchedulerBuilder { Action<TaskInfo> _executing; Action<TaskInfo, TaskLog> _executed; IFreeSql _fsql; RedisClient _redis; RedisClient _clusterRedis; ClusterOptions _clusterOptions; ITaskIntervalCustomHandler _customIntervalHandler; TimeSpan _scanInterval = TimeSpan.FromMilliseconds(200); TimeSpan _timeOffset = TimeSpan.Zero; bool _autoLoad = true; /// <summary> /// 任务触发 /// </summary> /// <returns></returns> public FreeSchedulerBuilder OnExecuting(Action<TaskInfo> executing) { _executing = executing; return this; } /// <summary> /// 任务触发之后 /// </summary> /// <returns></returns> public FreeSchedulerBuilder OnExecuted(Action<TaskInfo, TaskLog> executed) { _executed = executed; return this; } /// <summary> /// 设置时区(默认UTC时区)<para></para> /// 北京 -> TimeSpan.FromHours(8) /// </summary> /// <param name="timeOffset"></param> /// <returns></returns> public FreeSchedulerBuilder UseTimeZone(TimeSpan timeOffset) { _timeOffset = timeOffset; return this; } /// <summary> /// 基于 数据库,使用 FreeSql ORM 持久化 /// </summary> public FreeSchedulerBuilder UseStorage(IFreeSql fsql, bool autoLoad = true) { _fsql = fsql; if (_fsql != null) _redis = null; _autoLoad = autoLoad; return this; } /// <summary> /// 基于 Redis,使用 FreeRedis 持久化 /// </summary> public FreeSchedulerBuilder UseStorage(IRedisClient redis, bool autoLoad = true) { var prefix = redis?.GetType().GetProperty("Prefix", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(redis, new object[0]) as string; if (string.IsNullOrWhiteSpace(prefix) == false) throw new Exception($"UseStorage 不支持设置了 Prefix 前辍的 FreeRedis"); _redis = redis as RedisClient; if (_redis != null) _fsql = null; _autoLoad = autoLoad; return this; } /// <summary> /// 开启集群(依赖 Redis)<para></para> /// 特点:<para></para> /// - 支持 单项目,多站点部署<para></para> /// - 支持 多进程,不重复执行<para></para> /// - 支持 进程退出后,由其他进程重新加载任务(约30秒后)<para></para> /// - 支持 进程互通,任意进程都可以执行(RemoveTask/ExistsTask/PauseTask/RunNowTask/RemoveTempTask/ExistsTempTask)<para></para> /// - 支持 进程意外离线后,卸载进程内的任务,重新安排上线<para></para> /// </summary> public FreeSchedulerBuilder UseCluster(IRedisClient redis, ClusterOptions options = null) { var prefix = redis?.GetType().GetProperty("Prefix", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(redis, new object[0]) as string; if (string.IsNullOrWhiteSpace(prefix) == false) throw new Exception($"由于 UseCluster 核心代码使用了较多 LuaScript,因此不支持设置 FreeRedis Prefix 前辍"); _clusterRedis = redis as RedisClient; _clusterOptions = options; return this; } /// <summary> /// 自定义间隔(可实现 cron) /// </summary> /// <param name="nextDelay">获取下一次定时间隔,返回 null 时结束</param> /// <returns></returns> public FreeSchedulerBuilder UseCustomInterval(Func<TaskInfo, TimeSpan?> nextDelay) { if (nextDelay == null) throw new Exception($"参数 {nameof(nextDelay)} 不能为 null"); _customIntervalHandler = new CustomIntervalHandler { NextDelay = nextDelay }; return this; } /// <summary> /// 扫描线程间隔(默认值:200毫秒) /// </summary> public FreeSchedulerBuilder UseScanInterval(TimeSpan value) { _scanInterval = value; return this; } public Scheduler Build() { ITaskHandler taskHandler = null; if (_fsql != null) taskHandler = new FreeSqlTaskHandler(_fsql) { Executing = _executing, Executed = _executed }; else if (_redis != null) taskHandler = new FreeRedisTaskHandler(_redis) { Executing = _executing, Executed = _executed }; else { if (_clusterRedis != null) throw new Exception($"UseCluster 集群功能仅支持 UseStorage 持久化"); taskHandler = new MemoryTaskHandler() { Executing = _executing, Executed = _executed }; } var scheduler = new Scheduler(taskHandler, _customIntervalHandler, _clusterRedis != null ? new ClusterContext(_clusterRedis, _clusterOptions) : null, _timeOffset, _autoLoad); scheduler.ScanInterval = _scanInterval; if (_clusterRedis != null) Snowfake.Default = new Snowfake(_clusterRedis.Incr($"{scheduler.ClusterOptions.RedisPrefix}_Snowfake") % 16); return scheduler; } class CustomIntervalHandler : ITaskIntervalCustomHandler { public Func<TaskInfo, TimeSpan?> NextDelay; TimeSpan? ITaskIntervalCustomHandler.NextDelay(TaskInfo task) => NextDelay?.Invoke(task); } class MemoryTaskHandler : TestHandler { public Action<TaskInfo> Executing; public Action<TaskInfo, TaskLog> Executed; public override void OnExecuting(Scheduler scheduler, TaskInfo task) { FreeSqlTaskHandler.SystemExecuting(scheduler, task); Executing?.Invoke(task); } public override void OnExecutedExt(TaskInfo task, TaskLog result) { Executed?.Invoke(task, result); } } class FreeSqlTaskHandler : FreeSqlHandler { public FreeSqlTaskHandler(IFreeSql fsql) : base(fsql) { } public Action<TaskInfo> Executing; public Action<TaskInfo, TaskLog> Executed; public override void OnExecuting(Scheduler scheduler, TaskInfo task) { SystemExecuting(scheduler, task); Executing?.Invoke(task); } public override void OnExecutedExt(TaskInfo task, TaskLog result) { Executed?.Invoke(task, result); } internal static void SystemExecuting(Scheduler scheduler, TaskInfo task) { switch (task.Topic) { case "[系统预留]清理任务数据": var affrows = Datafeed.CleanStorageData(scheduler, (int)uint.Parse(task.Body) + 1); task.Remark($"已清理 {affrows} 条数据"); break; } if (task.Topic?.StartsWith("[系统预留]Http请求") == true) { var httpArgs = JToken.Parse(task.Body); using (var http = new TcpClientHttpRequest()) { http.Timeout = 1000 * (int.TryParse(httpArgs["timeout"]?.ToString() ?? "30", out var tryint) ? tryint : 30); http.Method = httpArgs["method"]?.ToString(); http.Action = httpArgs["url"]?.ToString(); if (httpArgs["header"]?.Type == JTokenType.Object) { foreach (var head in ((JObject)httpArgs["header"]).Properties()) http.Headers[head.Name] = head.Value?.ToString(); } http.Send(httpArgs["body"]?.ToString()); if (http.Response.ContentType.Contains("text/json") || http.Response.ContentType.Contains("application/json") || http.ContentType.Contains("application/json")) task.Remark(http.Response.StatusCode.ToString() + " " + http.Response.Xml); else task.Remark(http.Response.StatusCode.ToString()); } } } } class FreeRedisTaskHandler : FreeRedisHandler { public FreeRedisTaskHandler(RedisClient redis) : base(redis) { } public Action<TaskInfo> Executing; public Action<TaskInfo, TaskLog> Executed; public override void OnExecuting(Scheduler scheduler, TaskInfo task) { FreeSqlTaskHandler.SystemExecuting(scheduler, task); Executing?.Invoke(task); } public override void OnExecutedExt(TaskInfo task, TaskLog result) { Executed?.Invoke(task, result); } } }
2881099/FreeScheduler
15,132
FreeScheduler/FreeScheduler.xml
<?xml version="1.0"?> <doc> <assembly> <name>FreeScheduler</name> </assembly> <members> <member name="P:FreeScheduler.ClusterOptions.Name"> <summary> 可视化名称 </summary> </member> <member name="P:FreeScheduler.ClusterOptions.HeartbeatInterval"> <summary> 心跳间隔,默认值:5秒 </summary> </member> <member name="P:FreeScheduler.ClusterOptions.OfflineSeconds"> <summary> 离线:心跳停止后的秒数,默认值:30秒 </summary> </member> <member name="P:FreeScheduler.ClusterOptions.RedisPrefix"> <summary> Redis key 前辍标识 </summary> </member> <member name="M:FreeScheduler.Snowfake.#ctor(System.Int64)"> <summary> 机器码 </summary> <param name="workerId"></param> </member> <member name="M:FreeScheduler.Snowfake.tillNextMillis(System.Int64)"> <summary> 获取下一微秒时间戳 </summary> <param name="lastTimestamp"></param> <returns></returns> </member> <member name="M:FreeScheduler.Snowfake.timeGen"> <summary> 生成当前时间戳 </summary> <returns></returns> </member> <member name="M:FreeScheduler.ITaskHandler.LoadAll(System.Int32,System.Int32)"> <summary> 加载正在运行中的任务(从持久化中加载) </summary> <returns></returns> </member> <member name="M:FreeScheduler.ITaskHandler.Load(System.String)"> <summary> 加载单个任务(从持久化中加载) </summary> <param name="id"></param> <returns></returns> </member> <member name="M:FreeScheduler.ITaskHandler.OnAdd(FreeScheduler.TaskInfo)"> <summary> 添加任务的时候触发(持久化) </summary> <param name="task"></param> </member> <member name="M:FreeScheduler.ITaskHandler.OnRemove(FreeScheduler.TaskInfo)"> <summary> 删除任务的时候触发(持久化) </summary> <param name="task"></param> </member> <member name="M:FreeScheduler.ITaskHandler.OnExecuted(FreeScheduler.Scheduler,FreeScheduler.TaskInfo,FreeScheduler.TaskLog)"> <summary> 执行任务完成的时候触发(持久化) </summary> <param name="scheduler"></param> <param name="task"></param> <param name="result"></param> </member> <member name="M:FreeScheduler.ITaskHandler.OnExecuting(FreeScheduler.Scheduler,FreeScheduler.TaskInfo)"> <summary> 执行任务的时候触发 </summary> <param name="scheduler"></param> <param name="task"></param> </member> <member name="P:FreeScheduler.TaskInfo.Id"> <summary> 任务编号 </summary> </member> <member name="P:FreeScheduler.TaskInfo.Topic"> <summary> 任务标题,可用于查询 </summary> </member> <member name="P:FreeScheduler.TaskInfo.Body"> <summary> 任务数据 </summary> </member> <member name="P:FreeScheduler.TaskInfo.Round"> <summary> 任务执行多少轮,-1为永久循环 </summary> </member> <member name="P:FreeScheduler.TaskInfo.Interval"> <summary> 定时类型 </summary> </member> <member name="P:FreeScheduler.TaskInfo.IntervalArgument"> <summary> 定时参数值<para></para> Interval SEC 可设置参数值 10,20,30 分别对每一轮进行设置定时秒数,例如:<para></para> Round = 12<para></para> Interval = SEC<para></para> Argument = 60,60,60,60,60,120,120,120,120,120,1200,1200<para></para> Executing 事件可设置 Status 状态,在任意一轮中标记任务【完成】 </summary> </member> <member name="P:FreeScheduler.TaskInfo.CreateTime"> <summary> 创建时间 </summary> </member> <member name="P:FreeScheduler.TaskInfo.LastRunTime"> <summary> 最后运行时间 </summary> </member> <member name="P:FreeScheduler.TaskInfo.CurrentRound"> <summary> 当前运行到第几轮 </summary> </member> <member name="P:FreeScheduler.TaskInfo.ErrorTimes"> <summary> 错次数 </summary> </member> <member name="P:FreeScheduler.TaskInfo.Status"> <summary> 任务状态 </summary> </member> <member name="F:FreeScheduler.TaskInterval.SEC"> <summary> 按秒触发 </summary> </member> <member name="F:FreeScheduler.TaskInterval.RunOnDay"> <summary> 每天 什么时间 触发<para></para> 如:15:55:59<para></para> 每天15点55分59秒 </summary> </member> <member name="F:FreeScheduler.TaskInterval.RunOnWeek"> <summary> 每星期几 什么时间 触发<para></para> 如:2:15:55:59<para></para> 每星期二15点55分59秒 </summary> </member> <member name="F:FreeScheduler.TaskInterval.RunOnMonth"> <summary> 每月第几天 什么时间 触发<para></para> 如:5:15:55:59<para></para> 每月第5天15点55分59秒<para></para> 如:-1:15:55:59<para></para> 每月倒数第1天15点55分59秒 </summary> </member> <member name="F:FreeScheduler.TaskInterval.Custom"> <summary> 自定义触发,要求设置 UseCustomInterval </summary> </member> <member name="M:FreeScheduler.ITaskIntervalCustomHandler.NextDelay(FreeScheduler.TaskInfo)"> <summary> 获取下一次定时间隔,返回 null 时结束 </summary> <param name="task">持久化任务对象</param> <returns></returns> </member> <member name="P:FreeScheduler.TaskLog.TaskId"> <summary> 任务编号 </summary> </member> <member name="P:FreeScheduler.TaskLog.Round"> <summary> 第几轮 </summary> </member> <member name="P:FreeScheduler.TaskLog.ElapsedMilliseconds"> <summary> 耗时(毫秒) </summary> </member> <member name="P:FreeScheduler.TaskLog.Success"> <summary> 是否成功 </summary> </member> <member name="P:FreeScheduler.TaskLog.Exception"> <summary> 异常信息 </summary> </member> <member name="P:FreeScheduler.TaskLog.Remark"> <summary> 自定义备注 </summary> </member> <member name="P:FreeScheduler.TaskLog.CreateTime"> <summary> 创建时间 </summary> </member> <member name="F:FreeScheduler.TaskStatus.Running"> <summary> 正在运行,可使用 PauseTask 方法暂停任务 </summary> </member> <member name="F:FreeScheduler.TaskStatus.Paused"> <summary> 暂停,可使用 ResumeTask 方法恢复为 Running </summary> </member> <member name="F:FreeScheduler.TaskStatus.Completed"> <summary> 完成 </summary> </member> <member name="T:FreeScheduler.Scheduler"> <summary> 调度管理临时任务(一次性)、循环任务(存储落地) </summary> </member> <member name="P:FreeScheduler.Scheduler.QuantityTempTask"> <summary> 临时任务数量 </summary> </member> <member name="P:FreeScheduler.Scheduler.QuantityTask"> <summary> 循环任务数量 </summary> </member> <member name="P:FreeScheduler.Scheduler.ScanInterval"> <summary> 扫描线程间隔(默认值:200毫秒) </summary> </member> <member name="P:FreeScheduler.Scheduler.TimeOffset"> <summary> 时区 </summary> </member> <member name="M:FreeScheduler.Scheduler.AddTempTask(System.TimeSpan,System.Action)"> <summary> 临时任务(程序重启会丢失) </summary> <param name="timeout"></param> <param name="handle"></param> <returns></returns> </member> <member name="M:FreeScheduler.Scheduler.RemoveTempTask(System.String)"> <summary> 删除临时任务 </summary> <param name="id"></param> <returns></returns> </member> <member name="M:FreeScheduler.Scheduler.ExistsTempTask(System.String)"> <summary> 判断临时任务是否存在 </summary> <param name="id"></param> <returns></returns> </member> <member name="M:FreeScheduler.Scheduler.AddTask(System.String,System.String,System.Int32,System.Int32)"> <summary> 添加循环执行的任务(秒) </summary> <param name="topic">名称</param> <param name="body">数据</param> <param name="round">循环次数,-1为永久循环</param> <param name="seconds">秒数</param> <returns></returns> </member> <member name="M:FreeScheduler.Scheduler.AddTask(System.String,System.String,System.Int32[])"> <summary> 添加循环执行的任务(秒)<para></para> 可设置参数值 10,20,30 分别对每一轮进行设置定时秒数,例如:<para></para> round = 12<para></para> seconds = 60,60,60,60,60,120,120,120,120,120,1200,1200<para></para> Executing 事件可设置 Status 状态,在任意一轮中标记任务【完成】 </summary> <param name="topic">名称</param> <param name="body">数据</param> <param name="seconds">每一轮的定时秒数:10,20,30</param> <returns></returns> </member> <member name="M:FreeScheduler.Scheduler.AddTaskRunOnDay(System.String,System.String,System.Int32,System.String)"> <summary> 添加循环执行的任务(每天的什么时候执行)<para></para> 每天 expression UTC时间: "20:30:00" </summary> <returns></returns> </member> <member name="M:FreeScheduler.Scheduler.AddTaskRunOnWeek(System.String,System.String,System.Int32,System.String)"> <summary> 添加循环执行的任务(每个星期的什么时候执行)<para></para> 每周日 expression UTC时间: "0:20:30:00"<para></para> 每周六 expression UTC时间: "6:20:30:00" </summary> <returns></returns> </member> <member name="M:FreeScheduler.Scheduler.AddTaskRunOnMonth(System.String,System.String,System.Int32,System.String)"> <summary> 添加循环执行的任务(每个月的什么时候执行)<para></para> 每月1号: "1:20:30:00"<para></para> 每月最后1天:"-1:20:30:00"<para></para> 每月倒数第2天:"-2:20:30:00"<para></para> 注意:expression UTC时间 </summary> <returns></returns> </member> <member name="M:FreeScheduler.Scheduler.AddTaskCustom(System.String,System.String,System.String)"> <summary> 添加 Custom 任务,new Scheduler(.., new YourCustomHandler()) </summary> <returns></returns> </member> <member name="M:FreeScheduler.Scheduler.RemoveTask(System.String)"> <summary> 删除循环任务 </summary> <param name="id"></param> <returns></returns> </member> <member name="M:FreeScheduler.Scheduler.ExistsTask(System.String)"> <summary> 判断循环任务是否存在 </summary> <param name="id"></param> <returns></returns> </member> <member name="M:FreeScheduler.Scheduler.FindTask(System.Func{FreeScheduler.TaskInfo,System.Boolean})"> <summary> 查询正在运行中的循环任务 </summary> <param name="where"></param> <returns></returns> </member> <member name="M:FreeScheduler.Scheduler.ResumeTask(System.String)"> <summary> 恢复已暂停的任务 </summary> <param name="id"></param> <returns></returns> </member> <member name="M:FreeScheduler.Scheduler.PauseTask(System.String)"> <summary> 暂停正在运行的任务 </summary> <param name="id"></param> <returns></returns> </member> <member name="M:FreeScheduler.Scheduler.RunNowTask(System.String)"> <summary> 立刻运行任务(人工触发) </summary> <param name="id"></param> <returns></returns> </member> <member name="T:FreeSchedulerBuilder"> <summary> Scheduler 对象构建器 </summary> </member> <member name="M:FreeSchedulerBuilder.OnExecuting(System.Action{FreeScheduler.TaskInfo})"> <summary> 任务触发 </summary> <returns></returns> </member> <member name="M:FreeSchedulerBuilder.OnExecuted(System.Action{FreeScheduler.TaskInfo,FreeScheduler.TaskLog})"> <summary> 任务触发之后 </summary> <returns></returns> </member> <member name="M:FreeSchedulerBuilder.UseTimeZone(System.TimeSpan)"> <summary> 设置时区(默认UTC时区)<para></para> 北京 -> TimeSpan.FromHours(8) </summary> <param name="timeOffset"></param> <returns></returns> </member> <member name="M:FreeSchedulerBuilder.UseStorage(IFreeSql,System.Boolean)"> <summary> 基于 数据库,使用 FreeSql ORM 持久化 </summary> </member> <member name="M:FreeSchedulerBuilder.UseStorage(FreeRedis.IRedisClient,System.Boolean)"> <summary> 基于 Redis,使用 FreeRedis 持久化 </summary> </member> <member name="M:FreeSchedulerBuilder.UseCluster(FreeRedis.IRedisClient,FreeScheduler.ClusterOptions)"> <summary> 开启集群(依赖 Redis)<para></para> 特点:<para></para> - 支持 单项目,多站点部署<para></para> - 支持 多进程,不重复执行<para></para> - 支持 进程退出后,由其他进程重新加载任务(约30秒后)<para></para> - 支持 进程互通,任意进程都可以执行(RemoveTask/ExistsTask/PauseTask/RunNowTask/RemoveTempTask/ExistsTempTask)<para></para> - 支持 进程意外离线后,卸载进程内的任务,重新安排上线<para></para> </summary> </member> <member name="M:FreeSchedulerBuilder.UseCustomInterval(System.Func{FreeScheduler.TaskInfo,System.Nullable{System.TimeSpan}})"> <summary> 自定义间隔(可实现 cron) </summary> <param name="nextDelay">获取下一次定时间隔,返回 null 时结束</param> <returns></returns> </member> <member name="M:FreeSchedulerBuilder.UseScanInterval(System.TimeSpan)"> <summary> 扫描线程间隔(默认值:200毫秒) </summary> </member> </members> </doc>
2881099/FreeScheduler
3,530
FreeScheduler/FreeScheduler.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>net8.0;net7.0;net6.0;net5.0;netcoreapp3.1;netstandard2.0;net40</TargetFrameworks> <Version>2.0.37</Version> <GeneratePackageOnBuild>true</GeneratePackageOnBuild> <Authors>YeXiangQin</Authors> <Description>轻量化定时任务调度,支持集群任务、临时的延时任务和重复循环任务,可按秒,每天/每周/每月固定时间,自定义间隔执行,支持 .NET Core 2.1+、.NET Framework 4.0+ 运行环境。</Description> <PackageProjectUrl>https://github.com/2881099/FreeScheduler</PackageProjectUrl> <RepositoryUrl>https://github.com/2881099/FreeScheduler</RepositoryUrl> <RepositoryType>git</RepositoryType> <PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageTags>FreeScheduler;Scheduler;Timer;TempTask;Quartz;FluentScheduler;HashedWheelTimer</PackageTags> <PackageId>$(AssemblyName)</PackageId> <Title>$(AssemblyName)</Title> <IsPackable>true</IsPackable> <GenerateAssemblyInfo>true</GenerateAssemblyInfo> <SignAssembly>true</SignAssembly> <AssemblyOriginatorKeyFile>yxq.snk</AssemblyOriginatorKeyFile> <PackageReadmeFile>readme.md</PackageReadmeFile> </PropertyGroup> <ItemGroup> <None Include="../readme.md" Pack="true" PackagePath="\" /> </ItemGroup> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'"> <DocumentationFile>FreeScheduler.xml</DocumentationFile> <WarningLevel>3</WarningLevel> </PropertyGroup> <ItemGroup> <PackageReference Include="FreeRedis" Version="1.3.6" /> <PackageReference Include="FreeSql.DbContext" Version="3.5.203" /> <PackageReference Include="IdleBus" Version="1.5.3" /> <PackageReference Include="WorkQueue" Version="1.3.0" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> </ItemGroup> <PropertyGroup Condition="'$(TargetFramework)' == 'net9.0' or '$(TargetFramework)' == 'net8.0' or '$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'netcoreapp3.1'"> <DefineConstants>Dashboard</DefineConstants> </PropertyGroup> <ItemGroup Condition="'$(TargetFramework)' == 'net9.0' or '$(TargetFramework)' == 'net8.0' or '$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'netcoreapp3.1'"> <EmbeddedResource Include="Dashboard\wwwroot.zip" /> <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.3.0" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == 'net9.0'"> <PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="9.0.0" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == 'net8.0'"> <PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="8.0.0" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == 'net7.0'"> <PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="7.0.0" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == 'net6.0'"> <PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="6.0.0" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == 'net5.0'"> <PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="5.0.0" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'"> <PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="3.1.0" /> </ItemGroup> <ItemGroup> <None Remove="Dashboard\wwwroot.zip" /> </ItemGroup> </Project>
2881099/FreeScheduler
1,122
FreeScheduler/ITaskHandler.cs
using System.Collections.Generic; namespace FreeScheduler { public interface ITaskHandler { /// <summary> /// 加载正在运行中的任务(从持久化中加载) /// </summary> /// <returns></returns> IEnumerable<TaskInfo> LoadAll(int pageNumber = 1, int pageSize = 100); /// <summary> /// 加载单个任务(从持久化中加载) /// </summary> /// <param name="id"></param> /// <returns></returns> TaskInfo Load(string id); /// <summary> /// 添加任务的时候触发(持久化) /// </summary> /// <param name="task"></param> void OnAdd(TaskInfo task); /// <summary> /// 删除任务的时候触发(持久化) /// </summary> /// <param name="task"></param> void OnRemove(TaskInfo task); /// <summary> /// 执行任务完成的时候触发(持久化) /// </summary> /// <param name="scheduler"></param> /// <param name="task"></param> /// <param name="result"></param> void OnExecuted(Scheduler scheduler, TaskInfo task, TaskLog result); /// <summary> /// 执行任务的时候触发 /// </summary> /// <param name="scheduler"></param> /// <param name="task"></param> void OnExecuting(Scheduler scheduler, TaskInfo task); } }
2881099/FreeScheduler
3,151
FreeScheduler_Dashboard/Controllers/ApiResult.cs
using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using System.Text.RegularExpressions; [JsonObject(MemberSerialization.OptIn)] public partial class ApiResult : ContentResult { /// <summary> /// 错误代码 /// </summary> [JsonProperty("code")] public int Code { get; protected set; } /// <summary> /// 错误消息 /// </summary> [JsonProperty("message")] public string Message { get; protected set; } public ApiResult() { } public ApiResult(int code, string message) => this.SetCode(code); public virtual ApiResult SetCode(int value) { this.Code = value; return this; } public virtual ApiResult SetCode(Enum value) { this.Code = Convert.ToInt32(value); this.Message = value.ToString(); return this; } public virtual ApiResult SetMessage(string value) { this.Message = value; return this; } #region form 表单 target=iframe 提交回调处理 protected void Jsonp(ActionContext context) { string __callback = context.HttpContext.Request.HasFormContentType ? context.HttpContext.Request.Form["__callback"].ToString() : null; if (string.IsNullOrEmpty(__callback)) { this.ContentType = "text/json;charset=utf-8;"; this.Content = JsonConvert.SerializeObject(this); } else { this.ContentType = "text/html;charset=utf-8"; this.Content = $"<script>top.{__callback}({GlobalExtensions.Json(null, this)});</script>"; } } public override void ExecuteResult(ActionContext context) { Jsonp(context); base.ExecuteResult(context); } public override Task ExecuteResultAsync(ActionContext context) { Jsonp(context); return base.ExecuteResultAsync(context); } #endregion public static ApiResult Success => new ApiResult(0, "成功"); public static ApiResult Failed => new ApiResult(99, "失败"); } [JsonObject(MemberSerialization.OptIn)] public partial class ApiResult<T> : ApiResult { [JsonProperty("data")] public T Data { get; protected set; } public ApiResult() { } public ApiResult(int code) => this.SetCode(code); public ApiResult(string message) => this.SetMessage(message); public ApiResult(int code, string message) => this.SetCode(code).SetMessage(message); new public ApiResult<T> SetCode(int value) { this.Code = value; return this; } new public ApiResult<T> SetCode(Enum value) { this.Code = Convert.ToInt32(value); this.Message = value.ToString(); return this; } new public ApiResult<T> SetMessage(string value) { this.Message = value; return this; } public ApiResult<T> SetData(T value) { this.Data = value; return this; } new public static ApiResult<T> Success => new ApiResult<T>(0, "成功"); } public static class GlobalExtensions { public static object Json(this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper html, object obj) { string str = JsonConvert.SerializeObject(obj); if (!string.IsNullOrEmpty(str)) str = Regex.Replace(str, @"<(/?script[\s>])", "<\"+\"$1", RegexOptions.IgnoreCase); if (html == null) return str; return html.Raw(str); } }
2881099/FreeScheduler
4,030
FreeScheduler_Dashboard/Views/TaskInfo/Edit.cshtml
@{ Layout = ""; } <div class="box"> <div class="box-header with-border"> <h3 class="box-title" id="box-title"></h3> </div> <div class="box-body"> <div class="table-responsive"> <form id="form_add" method="post"> <input type="hidden" name="__callback" value="edit_callback" /> <div> <table cellspacing="0" rules="all" class="table table-bordered table-hover" border="1" style="border-collapse:collapse;"> <tr> <td>标题</td> <td><input name="Topic" type="text" class="datepicker" style="width:60%;" placeholder="用在 OnExecuting 区分任务" /></td> </tr> <tr> <td>数据</td> <td><textarea name="Body" style="width:60%;height:100px;" editor="ueditor" placeholder="用在 OnExecuting 区分相同 Title 任务的参数数据"></textarea></td> </tr> <tr> <td>轮次</td> <td><input name="Round" type="text" class="datepicker" style="width:60%;" placeholder="循环多少次,-1 是永久循环" /></td> </tr> <tr> <td>定时类型</td> <td> <select name="Interval" onchange="top.IntervalChange(this.value);"><option value="">------ 请选择 ------</option> @foreach (object eo in Enum.GetValues(typeof(FreeScheduler.TaskInterval))) { <option value="@eo">@eo</option> } </select> </td> </tr> <tr> <td>定时参数(UTC)</td> <td> <input name="IntervalArgument" type="text" class="datepicker" style="width:60%;" /> <div id="IntervalArgument_tips"></div> </td> </tr> <tr> <td width="8%">&nbsp</td> <td><input type="submit" class="btn btn-info" value="添加" />&nbsp;<input type="button" class="btn" value="取消" /></td> </tr> </table> </div> </form> </div> </div> </div> <script type="text/javascript"> (function () { var form = $('#form_add')[0]; top.IntervalChange = function(val) { var tips = null; if (val == 'SEC') { form.IntervalArgument.value = '5' tips = ` //每5秒触发,执行N次 var id = scheduler.AddTask("topic1", "body1", round: -1, 5) //每次 不同的间隔秒数触发,执行6次 var id = scheduler.AddTask("topic1", "body1", new [] { 5, 5, 10, 10, 60, 60 })` } if (val == 'RunOnDay') { form.IntervalArgument.value = '08:00:00' tips = ` //每天 08:00:00 触发,指定utc时间,执行N次 var id = scheduler.AddTaskRunOnDay("topic1", "body1", round: -1, "08:00:00")` } if (val == 'RunOnWeek') { form.IntervalArgument.value = '1:08:00:00' tips = ` //每周一 08:00:00 触发,指定utc时间,执行1次 var id = scheduler.AddTaskRunOnWeek("topic1", "body1", round: 1, "1:08:00:00") //每周日 08:00:00 触发,指定utc时间,执行1次 var id = scheduler.AddTaskRunOnWeek("topic1", "body1", round: 1, "0:08:00:00")` } if (val == 'RunOnMonth') { form.IntervalArgument.value = '1:08:00:00' tips = ` //每月1日 08:00:00 触发,指定utc时间,执行12次 var id = scheduler.AddTaskRunOnMonth("topic1", "body1", round: 12, "1:08:00:00") //每月最后一日 08:00:00 触发,指定utc时间,执行12次 var id = scheduler.AddTaskRunOnMonth("topic1", "body1", round: 12, "-1:08:00:00")` } if (val == 'Custom') { form.IntervalArgument.value = '0/1 * * * * ?' tips = ` //自定义间隔 cron var id = scheduler.AddTaskCustom("topic1", "body1", "0/1 * * * * ? ") new FreeSchedulerBuilder() ... .UseCustomInterval(task => { //利用 cron 功能库解析 task.IntervalArgument 得到下一次执行时间 //与当前时间相减,得到 TimeSpan,若返回 null 则任务完成 return TimeSpan.FromSeconds(5); }) .Build();` } if (tips) $('#IntervalArgument_tips').html(tips.replace(/ /g, '&nbsp;').replace(/\n/g, '<br>')) } top.edit_callback = function (rt) { if (rt.code == 0) return top.mainViewNav.goto('./?' + new Date().getTime()); alert(rt.message); }; var item = null; top.mainViewInit(); })(); </script> @if (Context.Request.Query["tpl"] == "CleanStorageData") { <script> (function () { var form = $('#form_add')[0]; form.Topic.value = '[系统预留]清理任务数据'; form.Body.value = '86400'; $('#form_add #BodyLabel').html('清理多久之前的记录(单位:秒)<br>已完成的任务'); form.Round.value = -1; })() </script> }
2881099/FreeScheduler
4,563
FreeScheduler_Dashboard/Views/TaskInfo/List.cshtml
@{ Layout = ""; var dto = ViewBag.dto as Datafeed.ResultGetPage; } <div class="box"> <div class="box-header with-border"> <h3 id="box-title" class="box-title"></h3> (@dto.Description <a href="./add?tpl=CleanStorageData">数据太多如何清理?</a>) <span class="form-group mr15"></span><a href="./add" data-toggle="modal" class="btn btn-success pull-right">添加</a> </div> <div class="box-body"> <div class="table-responsive"> <form id="form_search"> <div id="div_filter"></div> </form> <form id="form_list" action="./del" method="post"> <input type="hidden" name="__callback" value="del_callback"/> <table id="GridView1" cellspacing="0" rules="all" border="1" style="border-collapse:collapse;" class="table table-bordered table-hover text-nowrap"> <tr> <th scope="col">操作</th> <th scope="col">编号</th> <th scope="col">标题</th> <th scope="col">定时</th> <th scope="col" class="text-right">轮次</th> <th scope="col">状态</th> <th scope="col">Body</th> <th scope="col">创建时间</th> <th scope="col">最后运行时间</th> <th scope="col">错次数</th> </tr> <tbody> @foreach(var item in dto.Tasks) { <tr> <td> <input type="button" class="btn btn-xs btn-danger" value="删除" onclick="if (confirm('确认删除吗?')) top.callTask('delete', '@item.Id')" /> @if (item.Status != FreeScheduler.TaskStatus.Completed) { @if (item.Status == FreeScheduler.TaskStatus.Paused) { <input type="button" class="btn btn-xs btn-success" value="恢复" onclick="top.callTask('resume', '@item.Id')" /> } @if (item.Status == FreeScheduler.TaskStatus.Running) { <input type="button" class="btn btn-xs btn-warning" value="暂停" onclick="top.callTask('pause', '@item.Id')" /> } <input type="button" class="btn btn-xs btn-info" value="立即触发" onclick="top.callTask('run', '@item.Id')" /> } </td> <td>@item.Id</td> <td>@item.Topic</td> <td>@item.Interval @item.IntervalArgument</td> <td class="text-right"> @if (dto.Description.Contains("存储: Memory")) { @(item.CurrentRound + "/" + item.Round) } else { <a href="../TaskLog/?taskId=@item.Id">@(item.CurrentRound + "/" + item.Round)</a> } </td> <td>@item.Status</td> <td>@item.Body</td> <td>@item.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")</td> <td> @if (dto.Description.Contains("存储: Memory")) { @item.LastRunTime.ToString("yyyy-MM-dd HH:mm:ss") } else { <a href="../TaskLog/?taskId=@item.Id">@item.LastRunTime.ToString("yyyy-MM-dd HH:mm:ss")</a> } </td> <td>@item.ErrorTimes</td> </tr> } </tbody> </table> </form> <div id="kkpager"></div> </div> </div> </div> @{ var timestamp = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds; string getClusterText(int index, Datafeed.ResultGetPage.ClusterInfo cluster) { var name = cluster.Name; if (string.IsNullOrWhiteSpace(name)) name = cluster.Id; if (timestamp - cluster.Heartbeat < 10) return $"{name}({cluster.TaskCount})"; if (timestamp - cluster.Heartbeat < 30) return $"<font color=red>{name}({cluster.TaskCount})[可能离线]</font>"; return $"<font color=red>{name}({cluster.TaskCount})[离线]</font>"; } } <script type="text/javascript"> (function () { top.callTask = function(opt, id) { $.ajax({ type: 'GET', url: top.mainViewNav.trans('./callTask'), data: { id: id, opt: opt }, dataType: 'json', success: (rt) => { console.log(rt); setTimeout(top.mainViewNav.reload, 1000); }, }); } top.del_callback = function(rt) { if (rt.code == 0) return top.mainViewNav.goto('./?' + new Date().getTime()); alert(rt.message); }; var qs = _clone(top.mainViewNav.query); var page = cint(qs.page, 1); delete qs.page; $('#kkpager').html(cms2Pager(@dto.Total, page, 20, qs, 'page')); var fqs = _clone(top.mainViewNav.query); delete fqs.page; var fsc = [ { name: '集群', field: 'clusterId', single: 1, text: @Html.Json(dto.Clusters?.Select((a, index) => getClusterText(index, a))), value: @Html.Json(dto.Clusters?.Select(a => a.Id)) }, { name: '状态', field: 'status', single: 1, text: ['运行中','暂停中','已完成'], value: [0,1,2] }, null ]; fsc.pop(); cms2Filter(fsc, fqs); top.mainViewInit(); })(); </script>
2881099/FreeScheduler
1,884
FreeScheduler_Dashboard/Views/TaskLog/List.cshtml
@{ Layout = ""; } <div class="box"> <div class="box-header with-border"> <h3 id="box-title" class="box-title"></h3> </div> <div class="box-body"> <div class="table-responsive"> <form id="form_list" action="./del" method="post"> <input type="hidden" name="__callback" value="del_callback"/> <table id="GridView1" cellspacing="0" rules="all" border="1" style="border-collapse:collapse;" class="table table-bordered table-hover text-nowrap"> <tr> <th scope="col">任务编号</th> <th scope="col" class="text-right">第几轮</th> <th scope="col" class="text-right">耗时</th> <th scope="col" class="text-center">是否成功</th> <th scope="col">异常信息</th> <th scope="col">备注</th> <th scope="col">创建时间</th> </tr> <tbody> @foreach(TaskLog item in ViewBag.items) { <tr> <td>@item.TaskId</td> <td class="text-right">@item.Round</td> <td class="text-right">@(item.ElapsedMilliseconds)ms</td> <td class="text-center">@Html.Raw(item.Success ? "<font color=green>是</font>" : "<font color=red>否</font>")</td> <td>@item.Exception</td> <td>@item.Remark</td> <td>@item.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")</td> </tr> } </tbody> </table> </form> <div id="kkpager"></div> </div> </div> </div> @{ } <script type="text/javascript"> (function () { top.del_callback = function(rt) { if (rt.code == 0) return top.mainViewNav.goto('./?' + new Date().getTime()); alert(rt.message); }; var qs = _clone(top.mainViewNav.query); var page = cint(qs.page, 1); delete qs.page; $('#kkpager').html(cms2Pager(@ViewBag.count, page, 20, qs, 'page')); var fqs = _clone(top.mainViewNav.query); delete fqs.page; var fsc = [ null ]; fsc.pop(); cms2Filter(fsc, fqs); top.mainViewInit(); })(); </script>
2881099/FreeScheduler
9,724
FreeScheduler_Dashboard/wwwroot/FreeScheduler/index.html
<!DOCTYPE html> <html lang="zh-cmn-Hans"> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <title>FreeScheduler</title> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport" /> <link href="./htm/bootstrap/css/bootstrap.min.css" rel="stylesheet" /> <link href="./htm/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" /> <link href="./htm/css/skins/_all-skins.css" rel="stylesheet" /> <link href="./htm/plugins/pace/pace.min.css" rel="stylesheet" /> <link href="./htm/plugins/datepicker/datepicker3.css" rel="stylesheet" /> <link href="./htm/plugins/timepicker/bootstrap-timepicker.min.css" rel="stylesheet" /> <link href="./htm/plugins/select2/select2.min.css" rel="stylesheet" /> <link href="./htm/plugins/treetable/css/jquery.treetable.css" rel="stylesheet" /> <link href="./htm/plugins/treetable/css/jquery.treetable.theme.default.css" rel="stylesheet" /> <link href="./htm/plugins/multiple-select/multiple-select.css" rel="stylesheet" /> <link href="./htm/css/system.css" rel="stylesheet" /> <link href="./htm/css/index.css" rel="stylesheet" /> <script type="text/javascript" src="./htm/js/jQuery-2.1.4.min.js"></script> <script type="text/javascript" src="./htm/bootstrap/js/bootstrap.min.js"></script> <script type="text/javascript" src="./htm/plugins/pace/pace.min.js"></script> <script type="text/javascript" src="./htm/plugins/datepicker/bootstrap-datepicker.js"></script> <script type="text/javascript" src="./htm/plugins/timepicker/bootstrap-timepicker.min.js"></script> <script type="text/javascript" src="./htm/plugins/select2/select2.full.min.js"></script> <script type="text/javascript" src="./htm/plugins/input-mask/jquery.inputmask.js"></script> <script type="text/javascript" src="./htm/plugins/input-mask/jquery.inputmask.date.extensions.js"></script> <script type="text/javascript" src="./htm/plugins/input-mask/jquery.inputmask.extensions.js"></script> <script type="text/javascript" src="./htm/plugins/treetable/jquery.treetable.js"></script> <script type="text/javascript" src="./htm/plugins/multiple-select/multiple-select.js"></script> <script type="text/javascript" src="./htm/js/lib.js"></script> <script type="text/javascript" src="./htm/js/bmw.js"></script> <!--[if lt IE 9]> <script type='text/javascript' src='./htm/plugins/html5shiv/html5shiv.min.js'></script> <script type='text/javascript' src='./htm/plugins/respond/respond.min.js'></script> <![endif]--> </head> <body class="hold-transition skin-blue sidebar-mini"> <div class="wrapper"> <!-- Main Header--> <header class="main-header"> <!-- Logo--><a href="./" class="logo"> <!-- mini logo for sidebar mini 50x50 pixels--><span class="logo-mini"><b>Free</b></span> <!-- logo for regular state and mobile devices--><span class="logo-lg"><b>FreeScheduler</b></span> </a> <!-- Header Navbar--> <nav role="navigation" class="navbar navbar-static-top"> <!-- Sidebar toggle button--><a href="#" data-toggle="offcanvas" role="button" class="sidebar-toggle"><span class="sr-only">Toggle navigation</span></a> <!-- Navbar Right Menu--> <div class="navbar-custom-menu"> </div> </nav> </header> <!-- Left side column. contains the logo and sidebar--> <aside class="main-sidebar"> <!-- sidebar: style can be found in sidebar.less--> <section class="sidebar"> <!-- Sidebar Menu--> <ul class="sidebar-menu"> <!-- Optionally, you can add icons to the links--> <li class="treeview active"> <a href="#"><i class="fa fa-laptop"></i><span>通用管理</span><i class="fa fa-angle-left pull-right"></i></a> <ul class="treeview-menu"> <li><a href="/FreeScheduler/TaskInfo/"><i class="fa fa-sort-amount-desc"></i>任务列表</a></li> <li><a href="/FreeScheduler/TaskLog/"><i class="fa fa-headphones"></i>任务日志</a></li> </ul> </li> <li class="treeview active"> <a href="#"><i class="fa fa-laptop"></i><span>开发文档</span><i class="fa fa-angle-left pull-right"></i></a> <ul class="treeview-menu"> <li><a href="https://freesql.net/guide/freescheduler.html" target="_blank"><i class="fa fa-circle-o"></i>FreeScheduler</a></li> <li><a href="https://freesql.net/" target="_blank"><i class="fa fa-circle-o"></i>FreeSql</a></li> <li><a href="https://freesql.net/guide/freeredis.html" target="_blank"><i class="fa fa-circle-o"></i>FreeRedis</a></li> <li><a href="https://freesql.net/guide/freeim.html" target="_blank"><i class="fa fa-circle-o"></i>FreeIM</a></li> </ul> </li> </ul> <!-- /.sidebar-menu--> </section> <!-- /.sidebar--> </aside> <!-- Content Wrapper. Contains page content--> <div class="content-wrapper"> <!-- Main content--> <section id="right_content" class="content"> <div style="display:none;"> <!-- Your Page Content Here--> Loading... </div> </section> <!-- /.content--> </div> <!-- /.content-wrapper--> </div> <!-- ./wrapper--> <script type="text/javascript" src="./htm/js/system.js"></script> <script type="text/javascript" src="./htm/js/admin.js?v=1"></script> <script type="text/javascript"> if (!location.hash) $('#right_content div:first').show(); // 路由功能 //针对上面的html初始化路由列表 function hash_encode(str) { return url_encode(base64.encode(str)).replace(/%/g, '_'); } function hash_decode(str) { return base64.decode(url_decode(str.replace(/_/g, '%'))); } window.div_left_router = {}; $('li.treeview.active ul li a').each(function (index, ele) { if (ele.target == '_blank') return; var href = $(ele).attr('href'); $(ele).attr('href', '#base64url' + hash_encode(href)); window.div_left_router[href] = $(ele).text(); }); if (!location.hash) $('li.treeview.active ul li a')[0].click(); (function () { function Vipspa() { } Vipspa.prototype.start = function (config) { Vipspa.mainView = $(config.view); startRouter(); window.onhashchange = function () { if (location._is_changed) return location._is_changed = false; startRouter(); }; }; function startRouter() { var hash = location.hash; if (hash === '') return //location.hash = $('li.treeview.active ul li a:first').attr('href');//'#base64url' + hash_encode('/resume_type/'); if (hash.indexOf('#base64url') !== 0) return; var act = hash_decode(hash.substr(10, hash.length - 10)); //加载或者提交form后,显示内容 function ajax_success(refererUrl) { if (refererUrl == location.pathname) { startRouter(); return function(){}; } var hash = '#base64url' + hash_encode(refererUrl); if (location.hash != hash) { location._is_changed = true; location.hash = hash; }'\'' return function (data, status, xhr) { var div; Function.prototype.ajax = $.ajax; top.mainViewNav = { url: refererUrl, trans: function (url) { var act = url; act = act.substr(0, 1) === '/' || act.indexOf('://') !== -1 || act.indexOf('data:') === 0 ? act : join_url(refererUrl, act); return act; }, goto: function (url_or_form, target) { var form = url_or_form; if (typeof form === 'string') { var act = this.trans(form); if (String(target).toLowerCase() === '_blank') return window.open(act); location.hash = '#base64url' + hash_encode(act); } else { if (!window.ajax_form_iframe_max) window.ajax_form_iframe_max = 1; window.ajax_form_iframe_max++; var iframe = $('<iframe name="ajax_form_iframe{0}"></iframe>'.format(window.ajax_form_iframe_max)); Vipspa.mainView.append(iframe); var act = $(form).attr('action') || ''; act = act.substr(0, 1) === '/' || act.indexOf('://') !== -1 ? act : join_url(refererUrl, act); if ($(form).find(':file[name]').length > 0) $(form).attr('enctype', 'multipart/form-data'); $(form).attr('action', act); $(form).attr('target', iframe.attr('name')); iframe.on('load', function () { var doc = this.contentWindow ? this.contentWindow.document : this.document; if (doc.body.innerHTML.length === 0) return; if (doc.body.innerHTML.indexOf('Error:') === 0) return alert(doc.body.innerHTML.substr(6)); //以下 '<script ' + '是防止与本页面相匹配,不要删除 if (doc.body.innerHTML.indexOf('<script ' + 'type="text/javascript">location.href="') === -1) { ajax_success(doc.location.pathname + doc.location.search)(doc.body.innerHTML, 200, null); } }); } }, reload: startRouter, query: qs_parseByUrl(refererUrl) }; top.mainViewInit = function () { if (!div) return setTimeout(top.mainViewInit, 10); admin_init(function (selector) { if (/<[^>]+>/.test(selector)) return $(selector); return div.find(selector); }, top.mainViewNav); }; if (/<body[^>]*>/i.test(data)) data = data.match(/<body[^>]*>(([^<]|<(?!\/body>))*)<\/body>/i)[1]; div = Vipspa.mainView.html(data); }; }; $.ajax({ type: 'GET', url: act, dataType: 'html', success: ajax_success(act), error: function (jqXHR, textStatus, errorThrown) { var data = jqXHR.responseText; if (/<body[^>]*>/i.test(data)) data = data.match(/<body[^>]*>(([^<]|<(?!\/body>))*)<\/body>/i)[1]; Vipspa.mainView.html(data); } }); } window.vipspa = new Vipspa(); })(); $(function () { vipspa.start({ view: '#right_content', }); }); // 页面加载进度条 $(document).ajaxStart(function() { Pace.restart(); }); </script> </body> </html>
2881099/FreeScheduler
10,410
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/js/admin.js
$.ajaxSettings.dataType = 'json'; $.ajaxSettings.error = function(jqXHR, textStatus, errorThrown) { if (jqXHR.status == 501) { alert("您还没有登陆"); location.reload(); } }; // 最后特效,一定要放在页面底部 function tr_mouseover() { $('form tr td').unbind('mouseover').mouseover(function(){$(this).parent().children().css('background-color',function(index,value){if(!this.oldbgcolor)this.oldbgcolor=value;return '#eee';});}); $('form tr td').unbind('mouseout').mouseout(function(){$(this).parent().children().css('background-color',function(index,value){return this.oldbgcolor;})}); } function yieldTreeArray(arr, parent_id, Id, Parent_id) { var root = []; for (var a = 0; a < arr.length; a++) { if (!arr[a]) continue; if (arr[a] && arr[a][Parent_id] == parent_id) { arr[a]._child = yieldTreeArray(arr, arr[a][Id], Id, Parent_id); root.push(arr[a]); } } return root; } function yieldTreeTable(root, tpl) { var html = ''; for (var a = 0; a < root.length; a++) { if (!root[a]) continue; html += bmwjs.render(tpl, root[a]); if (root[a]._child && root[a]._child.length > 0) html += yieldTreeTable(root[a]._child, tpl); } return html; } function yieldTreeSelect(items, textTpl, valueField, left) { var sb = left ? '' : '<select><option value="">------ 请选择 ------</option>'; for (var a = 0; a < items.length; a++) { var l = a === items.length - 1 ? '└' : '├'; var text = (left || '') + l + textTpl; for (var b in items[a]) text = text.replace(new RegExp('\{#' + b + '\}', 'g'), String(items[a][b]).htmlencode()); sb += '<option value="{0}">{1}</option>'.format(items[a][valueField], text); if (items[a]._child && items[a]._child.length) sb += yieldTreeSelect(items[a]._child, textTpl, valueField, (left || '') + (a === items.length - 1 ? ' ' : '│')); } sb += left ? '' : '</select>'; return sb; } function renderTpl(el, data) { el = $(el); var html = bmwjs.render(el.html(), data); el.html(html); } function cms2Pager(count, pageindex, pagesize, qs, pageQueryName) { var maxpage = Math.ceil(count / pagesize);//总页数总数据条数/每页显示数 向上取整 if (pageindex <= 0) pageindex = 1; if (pageindex >= maxpage) pageIndex = maxpage; var data = { pageindex: pageindex, maxpage: maxpage, pagesize: pagesize, count: count, getLink: function (n) { qs[pageQueryName] = n; return '?' + qs_stringify(qs); } }; top.pageJump = function (n) { qs[pageQueryName] = n; top.mainViewNav.goto('?' + qs_stringify(qs)); } var tpl = '<ul class="pagination" style="margin-top: 0;float:left;">\ {%\ var for_start = Math.max(1, pageindex - 5);\ var for_end = Math.min(pageindex + 5, maxpage);\ %}\ <li @if="maxpage > 0 && pageindex > 1"><a href="{#getLink(1)}">首页</a></li>\ <li @if="maxpage > 0 && pageindex > 1"><a href="{#getLink(pageindex - 1)}">上页</a></li>\ <li @if="for_start > 1"><a href="#" onclick="return false;">..</a></li>\ {for a for_start,for_end + 1}\ <li @if="a == pageindex" class="active"><a href="{#getLink(a)}" onclick="return false;">{#a}</a></li>\ <li @else=""><a href="{#getLink(a)}">{#a}</a></li>\ {/for}\ <li @if="for_end < maxpage"><a href="#" onclick="return false;">..</a></li>\ <li @if="pageindex < maxpage"><a href="{#getLink(pageindex + 1)}">下页</a></li>\ <li @if="pageindex < maxpage"><a href="{#getLink(maxpage)}">尾页</a></li>\ <li><span>页数:<input @if="maxpage >= 10" type="number" value="{#pageindex}" onkeyup="if(event.keyCode==13)top.pageJump(this.value);" style="font-size:10px;margin:0;padding:0;width:80px;height:20px;" /><span @else="">{#pageindex}</span>/{#maxpage} 每页:{#pagesize} 总计:{#count}</span></li>\ </ul>'; return bmwjs.render(tpl, data); } function cms2Filter(schema, query_all) { //query_all = qs; //schema = [ // { name: '性别', field: 'sex', single: 1, text: ['男,女'], value: [1,0] }, // { name: '学历', field: 'edu', text: ['博士','硕士','本科','专科','其他'], value: [1,2,3,4,5] }, // { name: '学校类别', field: 'school_type', text: [985,921] }, // { name: '届次', field: 'xzyear', text: [2012,2013,2014,2015,2016] }, // { name: '司龄', field: 'age', text: ['低于1年','1年','2年','3年','4年','5-10年','10年以上'] } //]; for (var a = 0; a < schema.length; a++) { if (!schema[a].value) schema[a].value = schema[a].text; if (schema[a].value == null || schema[a].value.length == 0) continue; var sb = '<div style="line-height:36px;border-bottom:1px solid #ddd;word-wrap:break-word;word-break:break-all;{2}">\ <div style="float:left;width:70px;">{1}</div>\ <div style="margin-left:70px;"><a name="a_{0}_all" field="{0}" href="#" style="padding:3px 6px 3px 6px;background-color:#eee;">全部</a>&nbsp;'.format(schema[a].field, schema[a].name, schema[a].style); for (var b = 0; b < schema[a].value.length; b++) sb += '<a id="a_{0}_id_{1}" name="a_{0}_id" field="{0}" value="{3}" single="{2}" href="#" style="padding:3px 6px 3px 6px;background-color:#eee;">{4}</a>&nbsp;'.format(schema[a].field, b, schema[a].single, schema[a].value[b], schema[a].text[b]); sb += '</div><div style="clear:both;"></div></div>'; $('#form_search div#div_filter').append(sb); var qs_field = query_all[schema[a].field]; if (qs_field) { var sel = qs_field; if (!isArray(sel)) sel = [sel]; $('#form_search #div_filter a[name="a_{0}_id"]'.format(schema[a].field)).each(function (idx, ele) { var value = $(ele).attr('value'); for (var a = 0; a < sel.length; a++) if (value === sel[a]) $(ele).css('color', 'white').css('backgroundColor', '#00a65e'); }); } else $('#form_search #div_filter a[name="a_{0}_all"]'.format(schema[a].field)).css('color', 'white').css('backgroundColor', '#00a65e'); } $('#form_search #div_filter a').click(function () { var ele = $(this); var field = ele.attr('field'); var value = ele.attr('value'); if (!value) delete query_all[field]; //清除条件 else if (ele.attr('single') == '1') query_all[field] = value; else if (!query_all[field]) query_all[field] = value; else { var issel = true; var farr = query_all[field]; if (!isArray(farr)) farr = query_all[field] = [farr]; for (var b = farr.length - 1; b >= 0; b--) if (farr[b] === value) { query_all[field].splice(b, 1); issel = false; } if (issel) query_all[field].push(value); } top.mainViewNav.goto('?' + qs_stringify(query_all)); return false; }); } function fillForm(form, obj) { $('form#form_add input[type="submit"]').val(obj ? '更新' : '添加'); if (!obj || !form) return; var newObj = {}; for (var a in obj) { if (typeof obj[a] == 'object') { for (var b in obj[a]) if (typeof obj[a][b] == 'object') { for (var c in obj[a][b]) newObj[a + '.' + b + '.' + c] = obj[a][b][c]; } else newObj[a + '.' + b] = obj[a][b]; } newObj[a] = obj[a]; } obj = newObj; for (var a in obj) if (form[a]) if (String(form[a].type).toLowerCase() === 'checkbox') form[a].checked = obj[a] === '1'; else if (obj[a] == 0) form[a].value = obj[a]; else form[a].value = obj[a] || ''; } function admin_init($, nav) { window.nav = nav; var div_left_router = window.div_left_router; var pathname = nav.url.split('?')[0]; $(".select2").select2(); $('[data-mask]').inputmask(); var submit = $('form#form_add input[type="submit"]'); $('form#form_add').submit(function (e) { if (submit.val() == '更新') if (!confirm('确认要更新数据吗?')) { e.stopImmediatePropagation(); return false; } }); $('form#form_add input[type="button"][value="取消"]').attr('onclick', '').unbind().click(function () { nav.goto('./'); }); $('table tr').each(function (i, el) { var td = $(el).find('td') if (td.length === 2) td[0].style.width = '20%'; }); //设置页面title for (var a in div_left_router) { var tmp1 = pathname; var title = div_left_router[a]; var ele_href = a; if (!ele_href) continue; tmp1 = tmp1.replace(/\/(del|edit|add)/i, function ($0, $1, $2) { if ($1 === 'edit' || $1 === 'add') title = title + ' - ' + submit.val(); return '/'; }); if (ele_href.indexOf(tmp1) != -1) { document.title2 = document.title2 || document.title; document.title = title + ' - ' + document.title2; $('#box-title:first').html(title + ' <!--font color="#ccc" style="font-size:6px">({0})</font-->'.format(nav.url)); break; } } $('#btn_delete_sel').click(function () { if (confirm('操作不可逆,确认要删除选择项吗?')) { $('form#form_list').submit(); } return false; }); //处理multi_status,多选字段 var multi_status_count = 0; $('input[multi_status]').each(function (index, el) { el = $(el); var status = el.attr('multi_status').split(','); var val = el.val(); if (isNaN(parseInt(val, 10))) el.val(val = 0); for (var a = 0; a < status.length; a++) { var chkid = 'multi_status_checkbox_' + multi_status_count++; var chk = $('<input type="checkbox" id="' + chkid + '"' + ((val & Math.pow(2, a)) == Math.pow(2, a) ? ' checked' : '') + ' onclick=""/><label for="' + chkid + '">' + status[a] + '</label>'); el.before(chk); (function (a) { $('#' + chkid).click(function () { el.val(val = parseInt(val, 10) + (this.checked ? 1 : -1) * Math.pow(2, a)); }); })(a); } }); //处理百度编辑器 //$('textarea').each(function (i, el) { // if (el.style.width === '100%') { // new baidu.editor.ui.Editor({ // scaleEnabled: true // }).render(el); // } //}); //处理table中长文本显示问题 $('form#form_list td').each(function (index, ele) { var html = ele.innerHTML; //if (!/<[^>]+>/gi.test(html)) { // if (html.getLength() > 36) $(ele).html('').append($('<div></div>').attr('title', html).html(html.left(36) + '...')); //} else $(ele).find('a').each(function(index, ele) { // var html = ele.innerHTML; // if (html.getLength() > 36) $(ele).html(html.left(36) + '...').attr('title', html); //}); }); $('img').each(function (idx, ele) { ele = $(ele); var src = nav.trans(ele.attr('src')); ele.attr('src', src); }); $('a').click(function () { var href = $(this).attr('href'); if (!href || href.substr(0, 1) === '#') return false; var target = $(this).attr('target'); if (target != "_blank") { nav.goto(href, target); return false; } }); $('form').submit(function () { if (this.method.toLowerCase() == 'post') { nav.goto(this); return true; } var act = $(this).attr('action') || ''; var qs = qs_parseByUrl(act); qs = qs_stringify(qs) + '&' + url_decode($(this).serialize()); qs = qs_parse(qs); qs = qs_stringify(qs); nav.goto(act.split('?', 2)[0] + '?' + qs); return false; }); tr_mouseover(); }
2881099/FreeScheduler
15,973
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/js/lib.js
if (typeof $ === 'undefined') $ = jQuery; $.ajaxSettings.dataType = 'json'; function isArray(obj) { return Object.prototype.toString.call(obj) === '[object Array]'; } function request(name, defaultValue) { return qs_parse()[name] || defaultValue; } function cint(str, defaultValue) { str = parseInt(str, 10); return isNaN(str) ? defaultValue || 0 : str; } function _clone(obj) { var ret = {}; if (typeof obj === 'undefined' || obj === null) return ret; for (var a in obj) { if (isArray(obj[a])) { ret[a] = []; for (var b = 0; b < obj[a].length; b++) ret[a].push(obj[a][b]); continue; } ret[a] = obj[a]; } return ret; } String.prototype.trim = function () { return this.ltrim().rtrim(); } String.prototype.ltrim = function () { return this.replace(/^\s+(.*)/g, '$1'); } String.prototype.rtrim = function () { return this.replace(/([^ ]*)\s+$/g, '$1'); } //中文按2位算 String.prototype.getLength = function () { return this.replace(/([\u0391-\uFFE5])/ig, '11').length; } String.prototype.left = function (len, endstr) { if (len > this.getLength()) return this; var ret = this.replace(/([\u0391-\uFFE5])/ig, '$1\0') .substr(0, len).replace(/([\u0391-\uFFE5])\0/ig, '$1'); if (endstr) ret = ret.concat(endstr); return ret; } String.prototype.format = function () { var val = this.toString(); for (var a = 0 ; a < arguments.length ; a++) val = val.replace(new RegExp("\\{" + a + "\\}", "g"), arguments[a]); return val; } var __padleftright = function (str, len, padstr, isleft) { str = str || ' '; padstr = padstr || ''; var ret = []; for (var a = 0; a < len - str.length; a++) ret.push(padstr); if (isleft) ret.unshift(this) else ret.push(this); return ret.join(''); } // 'a'.padleft(3, '0') => '00a' String.prototype.padleft = function (len, padstr) { return __padleftright(this, len, padstr, 1); }; // 'a'.padright(3, '0') => 'a00' String.prototype.padright = function (len, padstr) { return __padleftright(this, len, padstr, 0); }; Function.prototype.toString2 = function () { var str = this.toString(); str = str.substr(str.indexOf('/*') + 2, str.length); str = str.substr(0, str.lastIndexOf('*/')); return str; }; Number.prototype.round = function (r) { r = typeof (r) == 'undefined' ? 1 : r; var rv = String(this); var io = rv.indexOf('.'); var ri = io == -1 ? '' : rv.substr(io + 1, r); var le = io == -1 ? (rv + '.') : rv.substr(0, io + 1 + r); for (var a = ri.length ; a < r ; a++) le += '0'; return le; }; function getObjectURL(file) { var url = null; if (window.createObjectURL != undefined) { // basic url = window.createObjectURL(file); } else if (window.URL != undefined) { // mozilla(firefox) url = window.URL.createObjectURL(file); } else if (window.webkitURL != undefined) { // webkit or chrome url = window.webkitURL.createObjectURL(file); } return url; } var qs_parse_cache = {}; function qs_parse(str) { str = str || location.search; if (str.charAt(0) === '?') str = str.substr(1, str.length); if (qs_parse_cache[str]) return qs_parse_cache[str]; var qs = {}; var y = str.split('&'); for (var a = 0; a < y.length; a++) { var x = y[a].split('=', 2); if (x[0] === '') continue; var x0 = url_decode(x[0]); if (!qs[x0]) qs[x0] = ''; qs[x0] += url_decode(x[1] || '') + '\r\n'; } //转换数组,去重 for (var a in qs) { qs[a] = qs[a].substr(0, qs[a].length - 2); if (qs[a].indexOf('\r\n') === -1) continue; var t1 = qs[a].split('\r\n'); var t2 = {}; qs[a] = []; for (var b = 0; b < t1.length; b++) { if (t2[t1[b]]) continue; t2[t1[b]] = true; qs[a].push(t1[b]); } } return qs; } function qs_parseByUrl(url) { url = url || location.href; url = url.split('?', 2); if (url.length === 1) url.push(''); return qs_parse(url[1]); } function qs_stringify(query) { var ret = []; for (var a in query) { var z = url_encode(a); if (z === '') continue; if (isArray(query[a]) == false) { ret.push(z + '=' + url_encode(query[a])); continue; } for (var b = 0; b < query[a].length; b++) ret.push(z + '=' + url_encode(query[a][b])); } return ret.join('&'); } function join_url(url1, url2) { var ds = []; if (url2 === '') ds = url1.split('/'); else if (url2.substr(0, 1) === '?') { ds = url1.split('?', 2)[0].split('/'); ds[ds.length - 1] += url2; } else { ds = url1.split('?', 2)[0].split('/'); ds.pop(); ds = ds.concat(url2.split('/')); } var ret = []; var nd = 0; while (true) { var d = ds.pop(); if (d == null) break; if (d === '.') continue; if (d === '..') { nd++; continue; } if (nd > 0) { nd--; continue; } ret.unshift(d); } return ret.join('/').replace(/\/\//g, '/'); } var mapSeries = function (items, fn, callback) { var rs = []; var func = function () { var item = items.pop(); if (item) return fn(item, function (err, r) { if (err) return callback(err, rs); rs.push(r); return func.call(null); }); else return callback(null, rs); }; func.call(null); }; var url_encode = function (str) { return encodeURIComponent(str) .replace(/ /gi, '+') .replace(/~/gi, '%7e') .replace(/'/gi, '%26%2339%3b'); }; var url_decode = function (str) { str = String(str).replace(/%26%2339%3b/gi, '\''); return decodeURIComponent(str) .replace(/\+/gi, ' ') .replace(/%7e/gi, '~'); }; String.prototype.htmlencode = function () { return this .replace(/&/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/ /g, '&nbsp;') .replace(/"/g, '&quot;'); }; String.prototype.htmldecode = function () { return this .replace(/&quot;/gi, '"') .replace(/&lt;/gi, '<') .replace(/&gt;/gi, '>') .replace(/&nbsp;/gi, ' ') .replace(/&/g, '&amp;'); }; /** * UTF16和UTF8转换对照表 * U+00000000 – U+0000007F 0xxxxxxx * U+00000080 – U+000007FF 110xxxxx 10xxxxxx * U+00000800 – U+0000FFFF 1110xxxx 10xxxxxx 10xxxxxx * U+00010000 – U+001FFFFF 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx * U+00200000 – U+03FFFFFF 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx * U+04000000 – U+7FFFFFFF 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */ var base64 = { // 转码表 table: [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' ], UTF16ToUTF8: function (str) { var res = [], len = str.length; for (var i = 0; i < len; i++) { var code = str.charCodeAt(i); if (code > 0x0000 && code <= 0x007F) { // 单字节,这里并不考虑0x0000,因为它是空字节 // U+00000000 – U+0000007F 0xxxxxxx res.push(str.charAt(i)); } else if (code >= 0x0080 && code <= 0x07FF) { // 双字节 // U+00000080 – U+000007FF 110xxxxx 10xxxxxx // 110xxxxx var byte11 = 0xC0 | ((code >> 6) & 0x1F); // 10xxxxxx var byte21 = 0x80 | (code & 0x3F); res.push( String.fromCharCode(byte11), String.fromCharCode(byte21) ); } else if (code >= 0x0800 && code <= 0xFFFF) { // 三字节 // U+00000800 – U+0000FFFF 1110xxxx 10xxxxxx 10xxxxxx // 1110xxxx var byte1 = 0xE0 | ((code >> 12) & 0x0F); // 10xxxxxx var byte2 = 0x80 | ((code >> 6) & 0x3F); // 10xxxxxx var byte3 = 0x80 | (code & 0x3F); res.push( String.fromCharCode(byte1), String.fromCharCode(byte2), String.fromCharCode(byte3) ); } else if (code >= 0x00010000 && code <= 0x001FFFFF) { // 四字节 // U+00010000 – U+001FFFFF 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx } else if (code >= 0x00200000 && code <= 0x03FFFFFF) { // 五字节 // U+00200000 – U+03FFFFFF 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx } else /** if (code >= 0x04000000 && code <= 0x7FFFFFFF)*/ { // 六字节 // U+04000000 – U+7FFFFFFF 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx } } return res.join(''); }, UTF8ToUTF16: function (str) { var res = [], len = str.length; var i = 0; for (var i = 0; i < len; i++) { var code = str.charCodeAt(i); // 对第一个字节进行判断 if (((code >> 7) & 0xFF) == 0x0) { // 单字节 // 0xxxxxxx res.push(str.charAt(i)); } else if (((code >> 5) & 0xFF) == 0x6) { // 双字节 // 110xxxxx 10xxxxxx var code2 = str.charCodeAt(++i); var byte1 = (code & 0x1F) << 6; var byte2 = code2 & 0x3F; var utf16 = byte1 | byte2; res.push(String.fromCharCode(utf16)); } else if (((code >> 4) & 0xFF) == 0xE) { // 三字节 // 1110xxxx 10xxxxxx 10xxxxxx var code22 = str.charCodeAt(++i); var code33 = str.charCodeAt(++i); var byte12 = (code << 4) | ((code22 >> 2) & 0x0F); var byte22 = ((code22 & 0x03) << 6) | (code33 & 0x3F); utf16 = ((byte12 & 0x00FF) << 8) | byte22 res.push(String.fromCharCode(utf16)); } else if (((code >> 3) & 0xFF) == 0x1E) { // 四字节 // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx } else if (((code >> 2) & 0xFF) == 0x3E) { // 五字节 // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx } else /** if (((code >> 1) & 0xFF) == 0x7E)*/ { // 六字节 // 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx } } return res.join(''); }, encode: function (str) { if (!str) { return ''; } var utf8 = this.UTF16ToUTF8(str); // 转成UTF8 var i = 0; // 遍历索引 var len = utf8.length; var res = []; while (i < len) { var c1 = utf8.charCodeAt(i++) & 0xFF; res.push(this.table[c1 >> 2]); // 需要补2个= if (i == len) { res.push(this.table[(c1 & 0x3) << 4]); res.push('=='); break; } var c2 = utf8.charCodeAt(i++); // 需要补1个= if (i == len) { res.push(this.table[((c1 & 0x3) << 4) | ((c2 >> 4) & 0x0F)]); res.push(this.table[(c2 & 0x0F) << 2]); res.push('='); break; } var c3 = utf8.charCodeAt(i++); res.push(this.table[((c1 & 0x3) << 4) | ((c2 >> 4) & 0x0F)]); res.push(this.table[((c2 & 0x0F) << 2) | ((c3 & 0xC0) >> 6)]); res.push(this.table[c3 & 0x3F]); } return res.join(''); }, decode: function (str) { if (!str) { return ''; } var len = str.length; var i = 0; var res = []; while (i < len) { var code1 = this.table.indexOf(str.charAt(i++)); var code2 = this.table.indexOf(str.charAt(i++)); var code3 = this.table.indexOf(str.charAt(i++)); var code4 = this.table.indexOf(str.charAt(i++)); var c1 = (code1 << 2) | (code2 >> 4); var c2 = ((code2 & 0xF) << 4) | (code3 >> 2); var c3 = ((code3 & 0x3) << 6) | code4; res.push(String.fromCharCode(c1)); if (code3 != 64) { res.push(String.fromCharCode(c2)); } if (code4 != 64) { res.push(String.fromCharCode(c3)); } } return this.UTF8ToUTF16(res.join('')); } }; var ndialog = { alert: function (msg) { clearTimeout(ndialog.alert.interval); var args = [].slice.call(arguments, 1); var closeTime; var callback; var url; for (var a = 0; a < args.length; a++) { switch (typeof args[a]) { case 'number': closeTime = args[a]; break; case 'function': callback = args[a]; break; case 'string': url = args[a]; break; } } closeTime = closeTime || 3; var dg = dialog('ndialog-alert', 'Notice', msg); dg.onclose = function () { if (callback) callback(); if (url) location.href = url; }; var func = function () { dg.subject.innerHTML = 'closing...&nbsp;' + closeTime + '&nbsp;sec'; if (closeTime-- <= 0) return dg.close(); ndialog.alert.interval = setTimeout(func, 1000); }; func(); return dg; } }; function extractobj(obj) { var parms = Array.prototype.slice.call(arguments, 1); parms.push('span'); for (var a = 0; a < parms.length; a++) { var ts = obj.getElementsByTagName(parms[a]); for (var b = 0; b < ts.length; b++) if (ts[b].getAttribute('extract')) obj[ts[b].getAttribute('extract')] = ts[b]; } } function dialog(id, subject, content) { var dg = document.getElementById(id); if (!dg) { dg = document.createElement('div'); dg.id = id; dg.className = 'dialog_normal'; dg.innerHTML = (function () {/* <style type="text/css"> #dialog2_mask_id{z-index:1000000;width:100%;position:absolute;top:0px;left:0px;background:#aaa;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=40);-moz-opacity:0.40;opacity:0.40;} .dialog_normal {position:absolute;z-index:2000000;background:#fff;} .dialog_normal div.dialog_normal_table {font-size:14px;margin-bottom:0px;border:2px solid #bbb;} .dialog_normal div.dialog_normal_table dl.lr {font-weight:bold;height:24px;line-height:24px;padding:4px 0px 0px 6px;} .dialog_normal div.dialog_normal_table dl.lr dt {float:left;color:black;font-weight:bold;margin:0px;padding:0px;} .dialog_normal div.dialog_normal_table dl.lr dd {float:right;margin:0px;padding:0px;} #ndialog-alert {width:430px;} #ndialog-alert div.dialog_normal_content {padding:50px 24px 50px 24px;font-size:16px;line-height:24px;} </style> <div class="dialog_normal_table"> <dl class="lr" style="cursor:pointer;"> <dt extract="subject"></dt> <dd><span style="text-align:center;background:#fff;padding:0px 3px 0px 3px;margin-right:6px;border:1px solid #ccc;cursor:pointer;color:black;">х</span></dd> </dl> <div class="dialog_normal_content" extract="content"></div> <div class="dialog_normal_footer" extract="footer"> </div> </div> */}).toString2(); extractobj(dg, 'dt', 'div'); document.getElementById('yxq-div').appendChild(dg); } dg.subject.innerHTML = subject || '&nbsp;'; dg.content.innerHTML = content || '<div style="padding:30px;text-align:center;"><img src="/images/yxq/ajax-loader-tr.gif"/></div>'; dg.style.display = ''; //dg.style.top = (document.body.clientHeight - dg.offsetHeight) / 2 + 'px'; //dg.style.left = (document.body.offsetWidth - dg.offsetWidth - document.body.scrollLeft) / 2 + 'px'; var top = (document.body.scrollTop || document.documentElement.scrollTop) + (document.documentElement.clientHeight - dg.offsetHeight) / 2 - 100; var left = (document.body.scrollLeft || document.documentElement.scrollLeft) + (document.documentElement.clientWidth - dg.offsetWidth) / 2; dg.style.top = top + 'px'; dg.style.left = left + 'px'; //dg.subject.parentNode.style.display = 'none'; dg.close = dg.subject.onclick = dg.subject.parentNode.onclick = function () { dg.style.display = 'none'; if (dg.onclose) dg.onclose(); return false; }; return dg; } function dialog2(id, subject, content) { var mask_id = 'dialog2_mask_id'; var mask = document.getElementById(mask_id); if (!mask) { mask = document.createElement('div'); mask.id = mask_id; document.getElementById('yxq-div').appendChild(mask); } mask.style.height = document.body.offsetHeight + 'px'; var dg = dialog(id, subject, content); dg.style.display = mask.style.display = ''; function setpos() { if (dg.style.display != '') return; var top = (document.body.scrollTop || document.documentElement.scrollTop) + (document.documentElement.clientHeight - dg.offsetHeight) / 2 - 100; var left = (document.body.scrollLeft || document.documentElement.scrollLeft) + (document.documentElement.clientWidth - dg.offsetWidth) / 2; if (Math.abs(parseInt(dg.style.top.replace('px', ''), 10) - top) > 100) dg.style.top = top + 'px'; if (Math.abs(parseInt(dg.style.left.replace('px', ''), 10) - left) > 100) dg.style.left = left + 'px'; setTimeout(setpos, 100); } setpos(); var bak__ss = document.getElementsByTagName('select'); var bak__selects = []; for (var a = 0; a < bak__ss.length; a++) { bak__selects.push(bak__ss[a].style.visibility); bak__ss[a].style.visibility = 'hidden'; } dg.close = mask.onclick = dg.subject.onclick = dg.subject.parentNode.onclick = function () { for (var a = 0; a < bak__ss.length; a++) { bak__ss[a].style.visibility = bak__selects[a]; } dg.style.display = mask.style.display = 'none'; if (dg.onclose) dg.onclose(); return false; }; return dg; }
2881099/FreeScheduler
84,345
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/js/jQuery-2.1.4.min.js
/*! jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */ !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)+1>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b="length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function qa(){}qa.prototype=d.filters=d.pseudos,d.setFilters=new qa,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function ra(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+K.uid++}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){ return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=L.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=l.createDocumentFragment(),b=a.appendChild(l.createElement("div")),c=l.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||l,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=W.test(e)?this.mouseHooks:V.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=l),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?Z:$):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=Z,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=Z,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=Z,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=L.access(d,b);e||d.addEventListener(a,c,!0),L.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=L.access(d,b)-1;e?L.access(d,b,e):(d.removeEventListener(a,c,!0),L.remove(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=$;else if(!d)return this;return 1===e&&(f=d,d=function(a){return n().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=$),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ba=/<([\w:]+)/,ca=/<|&#?\w+;/,da=/<(?:script|style|link)/i,ea=/checked\s*(?:[^=]|=\s*.checked.)/i,fa=/^$|\/(?:java|ecma)script/i,ga=/^true\/(.*)/,ha=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ia={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ia.optgroup=ia.option,ia.tbody=ia.tfoot=ia.colgroup=ia.caption=ia.thead,ia.th=ia.td;function ja(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function ka(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function la(a){var b=ga.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function ma(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function na(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function oa(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pa(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=oa(h),f=oa(a),d=0,e=f.length;e>d;d++)pa(f[d],g[d]);if(b)if(c)for(f=f||oa(a),g=g||oa(h),d=0,e=f.length;e>d;d++)na(f[d],g[d]);else na(a,h);return g=oa(h,"script"),g.length>0&&ma(g,!i&&oa(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(ca.test(e)){f=f||k.appendChild(b.createElement("div")),g=(ba.exec(e)||["",""])[1].toLowerCase(),h=ia[g]||ia._default,f.innerHTML=h[1]+e.replace(aa,"<$1></$2>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=oa(k.appendChild(e),"script"),i&&ma(f),c)){j=0;while(e=f[j++])fa.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(oa(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&ma(oa(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(oa(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!da.test(a)&&!ia[(ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(aa,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(oa(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(oa(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&ea.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(oa(c,"script"),ka),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,oa(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,la),j=0;g>j;j++)h=f[j],fa.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(ha,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qa,ra={};function sa(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function ta(a){var b=l,c=ra[a];return c||(c=sa(a,b),"none"!==c&&c||(qa=(qa||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=qa[0].contentDocument,b.write(),b.close(),c=sa(a,b),qa.detach()),ra[a]=c),c}var ua=/^margin/,va=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wa=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)};function xa(a,b,c){var d,e,f,g,h=a.style;return c=c||wa(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),va.test(g)&&ua.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function ya(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d=l.documentElement,e=l.createElement("div"),f=l.createElement("div");if(f.style){f.style.backgroundClip="content-box",f.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===f.style.backgroundClip,e.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",e.appendChild(f);function g(){f.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",f.innerHTML="",d.appendChild(e);var g=a.getComputedStyle(f,null);b="1%"!==g.top,c="4px"===g.width,d.removeChild(e)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return g(),b},boxSizingReliable:function(){return null==c&&g(),c},reliableMarginRight:function(){var b,c=f.appendChild(l.createElement("div"));return c.style.cssText=f.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",f.style.width="1px",d.appendChild(e),b=!parseFloat(a.getComputedStyle(c,null).marginRight),d.removeChild(e),f.removeChild(c),b}})}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var za=/^(none|table(?!-c[ea]).+)/,Aa=new RegExp("^("+Q+")(.*)$","i"),Ba=new RegExp("^([+-])=("+Q+")","i"),Ca={position:"absolute",visibility:"hidden",display:"block"},Da={letterSpacing:"0",fontWeight:"400"},Ea=["Webkit","O","Moz","ms"];function Fa(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Ea.length;while(e--)if(b=Ea[e]+c,b in a)return b;return d}function Ga(a,b,c){var d=Aa.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Ha(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+R[f]+"Width",!0,e))):(g+=n.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ia(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wa(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xa(a,b,f),(0>e||null==e)&&(e=a.style[b]),va.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Ha(a,b,c||(g?"border":"content"),d,f)+"px"}function Ja(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",ta(d.nodeName)))):(e=S(d),"none"===c&&e||L.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xa(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Fa(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Ba.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Fa(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xa(a,b,d)),"normal"===e&&b in Da&&(e=Da[b]),""===c||c?(f=parseFloat(e),c===!0||n.isNumeric(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?za.test(n.css(a,"display"))&&0===a.offsetWidth?n.swap(a,Ca,function(){return Ia(a,b,d)}):Ia(a,b,d):void 0},set:function(a,c,d){var e=d&&wa(a);return Ga(a,c,d?Ha(a,b,d,"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),n.cssHooks.marginRight=ya(k.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},xa,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ua.test(a)||(n.cssHooks[a+b].set=Ga)}),n.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=wa(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Ja(this,!0)},hide:function(){return Ja(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?n(this).show():n(this).hide()})}});function Ka(a,b,c,d,e){return new Ka.prototype.init(a,b,c,d,e)}n.Tween=Ka,Ka.prototype={constructor:Ka,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Ka.propHooks[this.prop];return a&&a.get?a.get(this):Ka.propHooks._default.get(this)},run:function(a){var b,c=Ka.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ka.propHooks._default.set(this),this}},Ka.prototype.init.prototype=Ka.prototype,Ka.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Ka.propHooks.scrollTop=Ka.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=Ka.prototype.init,n.fx.step={};var La,Ma,Na=/^(?:toggle|show|hide)$/,Oa=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pa=/queueHooks$/,Qa=[Va],Ra={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Oa.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&Oa.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sa(){return setTimeout(function(){La=void 0}),La=n.now()}function Ta(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ua(a,b,c){for(var d,e=(Ra[b]||[]).concat(Ra["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Va(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&S(a),q=L.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?L.get(a,"olddisplay")||ta(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Na.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?ta(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=L.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;L.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ua(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function Wa(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function Xa(a,b,c){var d,e,f=0,g=Qa.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=La||Sa(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:La||Sa(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wa(k,j.opts.specialEasing);g>f;f++)if(d=Qa[f].call(j,a,k,j.opts))return d;return n.map(k,Ua,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(Xa,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Ra[c]=Ra[c]||[],Ra[c].unshift(b)},prefilter:function(a,b){b?Qa.unshift(a):Qa.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(S).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=Xa(this,n.extend({},a),f);(e||L.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pa.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=L.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Ta(b,!0),a,d,e)}}),n.each({slideDown:Ta("show"),slideUp:Ta("hide"),slideToggle:Ta("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(La=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),La=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Ma||(Ma=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(Ma),Ma=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=l.createElement("input"),b=l.createElement("select"),c=b.appendChild(l.createElement("option"));a.type="checkbox",k.checkOn=""!==a.value,k.optSelected=c.selected,b.disabled=!0,k.optDisabled=!c.disabled,a=l.createElement("input"),a.value="t",a.type="radio",k.radioValue="t"===a.value}();var Ya,Za,$a=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return J(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?Za:Ya)), void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Za={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$a[b]||n.find.attr;$a[b]=function(a,b,d){var e,f;return d||(f=$a[b],$a[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$a[b]=f),e}});var _a=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||_a.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ab=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ab," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ab," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ab," ").indexOf(b)>=0)return!0;return!1}});var bb=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(d.value,f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var cb=n.now(),db=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+a),b};var eb=/#.*$/,fb=/([?&])_=[^&]*/,gb=/^(.*?):[ \t]*([^\r\n]*)$/gm,hb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,ib=/^(?:GET|HEAD)$/,jb=/^\/\//,kb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,lb={},mb={},nb="*/".concat("*"),ob=a.location.href,pb=kb.exec(ob.toLowerCase())||[];function qb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function rb(a,b,c,d){var e={},f=a===mb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function sb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function tb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function ub(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ob,type:"GET",isLocal:hb.test(pb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":nb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?sb(sb(a,n.ajaxSettings),b):sb(n.ajaxSettings,a)},ajaxPrefilter:qb(lb),ajaxTransport:qb(mb),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=gb.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||ob)+"").replace(eb,"").replace(jb,pb[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=kb.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===pb[1]&&h[2]===pb[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(pb[3]||("http:"===pb[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),rb(lb,k,b,v),2===t)return v;i=n.event&&k.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!ib.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(db.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=fb.test(d)?d.replace(fb,"$1_="+cb++):d+(db.test(d)?"&":"?")+"_="+cb++)),k.ifModified&&(n.lastModified[d]&&v.setRequestHeader("If-Modified-Since",n.lastModified[d]),n.etag[d]&&v.setRequestHeader("If-None-Match",n.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+nb+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=rb(mb,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=tb(k,v,f)),u=ub(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(n.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var vb=/%20/g,wb=/\[\]$/,xb=/\r?\n/g,yb=/^(?:submit|button|image|reset|file)$/i,zb=/^(?:input|select|textarea|keygen)/i;function Ab(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||wb.test(a)?d(a,e):Ab(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Ab(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Ab(c,a[c],b,e);return d.join("&").replace(vb,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&zb.test(this.nodeName)&&!yb.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(xb,"\r\n")}}):{name:b.name,value:c.replace(xb,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Bb=0,Cb={},Db={0:200,1223:204},Eb=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Cb)Cb[a]()}),k.cors=!!Eb&&"withCredentials"in Eb,k.ajax=Eb=!!Eb,n.ajaxTransport(function(a){var b;return k.cors||Eb&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Bb;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Cb[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Db[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Cb[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=n("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),l.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Fb=[],Gb=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Fb.pop()||n.expando+"_"+cb++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Gb.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Gb.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Gb,"$1"+e):b.jsonp!==!1&&(b.url+=(db.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Fb.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||l;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var Hb=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Hb)return Hb.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var Ib=a.document.documentElement;function Jb(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Jb(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Ib;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Ib})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;n.fn[b]=function(e){return J(this,function(b,e,f){var g=Jb(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=ya(k.pixelPosition,function(a,c){return c?(c=xa(a,b),va.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return J(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Kb=a.jQuery,Lb=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Lb),b&&a.jQuery===n&&(a.jQuery=Kb),n},typeof b===U&&(a.jQuery=a.$=n),n});
2881099/FreeScheduler
9,243
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/js/system.js
function _init(){"use strict";$.AdminLTE.layout={activate:function(){var a=this;a.fix(),a.fixSidebar(),$(window,".wrapper").resize(function(){a.fix(),a.fixSidebar()})},fix:function(){var a=$(".main-header").outerHeight()+$(".main-footer").outerHeight(),b=$(window).height(),c=$(".sidebar").height();if($("body").hasClass("fixed"))$(".content-wrapper, .right-side").css("min-height",b-$(".main-footer").outerHeight());else{var d;b>=c?($(".content-wrapper, .right-side").css("min-height",b-a),d=b-a):($(".content-wrapper, .right-side").css("min-height",c),d=c);var e=$($.AdminLTE.options.controlSidebarOptions.selector);"undefined"!=typeof e&&e.height()>d&&$(".content-wrapper, .right-side").css("min-height",e.height())}},fixSidebar:function(){return $("body").hasClass("fixed")?("undefined"==typeof $.fn.slimScroll&&window.console&&window.console.error("Error: the fixed layout requires the slimscroll plugin!"),void($.AdminLTE.options.sidebarSlimScroll&&"undefined"!=typeof $.fn.slimScroll&&($(".sidebar").slimScroll({destroy:!0}).height("auto"),$(".sidebar").slimscroll({height:$(window).height()-$(".main-header").height()+"px",color:"rgba(0,0,0,0.2)",size:"3px"})))):void("undefined"!=typeof $.fn.slimScroll&&$(".sidebar").slimScroll({destroy:!0}).height("auto"))}},$.AdminLTE.pushMenu={activate:function(a){var b=$.AdminLTE.options.screenSizes;$(document).on("click",a,function(a){a.preventDefault(),$(window).width()>b.sm-1?$("body").hasClass("sidebar-collapse")?$("body").removeClass("sidebar-collapse").trigger("expanded.pushMenu"):$("body").addClass("sidebar-collapse").trigger("collapsed.pushMenu"):$("body").hasClass("sidebar-open")?$("body").removeClass("sidebar-open").removeClass("sidebar-collapse").trigger("collapsed.pushMenu"):$("body").addClass("sidebar-open").trigger("expanded.pushMenu")}),$(".content-wrapper").click(function(){$(window).width()<=b.sm-1&&$("body").hasClass("sidebar-open")&&$("body").removeClass("sidebar-open")}),($.AdminLTE.options.sidebarExpandOnHover||$("body").hasClass("fixed")&&$("body").hasClass("sidebar-mini"))&&this.expandOnHover()},expandOnHover:function(){var a=this,b=$.AdminLTE.options.screenSizes.sm-1;$(".main-sidebar").hover(function(){$("body").hasClass("sidebar-mini")&&$("body").hasClass("sidebar-collapse")&&$(window).width()>b&&a.expand()},function(){$("body").hasClass("sidebar-mini")&&$("body").hasClass("sidebar-expanded-on-hover")&&$(window).width()>b&&a.collapse()})},expand:function(){$("body").removeClass("sidebar-collapse").addClass("sidebar-expanded-on-hover")},collapse:function(){$("body").hasClass("sidebar-expanded-on-hover")&&$("body").removeClass("sidebar-expanded-on-hover").addClass("sidebar-collapse")}},$.AdminLTE.tree=function(a){var b=this,c=$.AdminLTE.options.animationSpeed;$(a).on("click","li a",function(a){var d=$(this),e=d.next();if(e.is(".treeview-menu")&&e.is(":visible"))e.slideUp(c,function(){e.removeClass("menu-open")}),e.parent("li").removeClass("active");else if(e.is(".treeview-menu")&&!e.is(":visible")){var f=d.parents("ul").first(),g=f.find("ul:visible").slideUp(c);g.removeClass("menu-open");var h=d.parent("li");e.slideDown(c,function(){e.addClass("menu-open"),f.find("li.active").removeClass("active"),h.addClass("active"),b.layout.fix()})}e.is(".treeview-menu")&&a.preventDefault()})},$.AdminLTE.controlSidebar={activate:function(){var a=this,b=$.AdminLTE.options.controlSidebarOptions,c=$(b.selector),d=$(b.toggleBtnSelector);d.on("click",function(d){d.preventDefault(),c.hasClass("control-sidebar-open")||$("body").hasClass("control-sidebar-open")?a.close(c,b.slide):a.open(c,b.slide)});var e=$(".control-sidebar-bg");a._fix(e),$("body").hasClass("fixed")?a._fixForFixed(c):$(".content-wrapper, .right-side").height()<c.height()&&a._fixForContent(c)},open:function(a,b){b?a.addClass("control-sidebar-open"):$("body").addClass("control-sidebar-open")},close:function(a,b){b?a.removeClass("control-sidebar-open"):$("body").removeClass("control-sidebar-open")},_fix:function(a){var b=this;$("body").hasClass("layout-boxed")?(a.css("position","absolute"),a.height($(".wrapper").height()),$(window).resize(function(){b._fix(a)})):a.css({position:"fixed",height:"auto"})},_fixForFixed:function(a){a.css({position:"fixed","max-height":"100%",overflow:"auto","padding-bottom":"50px"})},_fixForContent:function(a){$(".content-wrapper, .right-side").css("min-height",a.height())}},$.AdminLTE.boxWidget={selectors:$.AdminLTE.options.boxWidgetOptions.boxWidgetSelectors,icons:$.AdminLTE.options.boxWidgetOptions.boxWidgetIcons,animationSpeed:$.AdminLTE.options.animationSpeed,activate:function(a){var b=this;a||(a=document),$(a).on("click",b.selectors.collapse,function(a){a.preventDefault(),b.collapse($(this))}),$(a).on("click",b.selectors.remove,function(a){a.preventDefault(),b.remove($(this))})},collapse:function(a){var b=this,c=a.parents(".box").first(),d=c.find("> .box-body, > .box-footer, > form >.box-body, > form > .box-footer");c.hasClass("collapsed-box")?(a.children(":first").removeClass(b.icons.open).addClass(b.icons.collapse),d.slideDown(b.animationSpeed,function(){c.removeClass("collapsed-box")})):(a.children(":first").removeClass(b.icons.collapse).addClass(b.icons.open),d.slideUp(b.animationSpeed,function(){c.addClass("collapsed-box")}))},remove:function(a){var b=a.parents(".box").first();b.slideUp(this.animationSpeed)}}}if("undefined"==typeof jQuery)throw new Error("AdminLTE requires jQuery");$.AdminLTE={},$.AdminLTE.options={navbarMenuSlimscroll:!0,navbarMenuSlimscrollWidth:"3px",navbarMenuHeight:"200px",animationSpeed:500,sidebarToggleSelector:"[data-toggle='offcanvas']",sidebarPushMenu:!0,sidebarSlimScroll:!0,sidebarExpandOnHover:!1,enableBoxRefresh:!0,enableBSToppltip:!0,BSTooltipSelector:"[data-toggle='tooltip']",enableFastclick:!0,enableControlSidebar:!0,controlSidebarOptions:{toggleBtnSelector:"[data-toggle='control-sidebar']",selector:".control-sidebar",slide:!0},enableBoxWidget:!0,boxWidgetOptions:{boxWidgetIcons:{collapse:"fa-minus",open:"fa-plus",remove:"fa-times"},boxWidgetSelectors:{remove:'[data-widget="remove"]',collapse:'[data-widget="collapse"]'}},directChat:{enable:!0,contactToggleSelector:'[data-widget="chat-pane-toggle"]'},colors:{lightBlue:"#3c8dbc",red:"#f56954",green:"#00a65a",aqua:"#00c0ef",yellow:"#f39c12",blue:"#0073b7",navy:"#001F3F",teal:"#39CCCC",olive:"#3D9970",lime:"#01FF70",orange:"#FF851B",fuchsia:"#F012BE",purple:"#8E24AA",maroon:"#D81B60",black:"#222222",gray:"#d2d6de"},screenSizes:{xs:480,sm:768,md:992,lg:1200}},$(function(){"use strict";$("body").removeClass("hold-transition"),"undefined"!=typeof AdminLTEOptions&&$.extend(!0,$.AdminLTE.options,AdminLTEOptions);var a=$.AdminLTE.options;_init(),$.AdminLTE.layout.activate(),$.AdminLTE.tree(".sidebar"),a.enableControlSidebar&&$.AdminLTE.controlSidebar.activate(),a.navbarMenuSlimscroll&&"undefined"!=typeof $.fn.slimscroll&&$(".navbar .menu").slimscroll({height:a.navbarMenuHeight,alwaysVisible:!1,size:a.navbarMenuSlimscrollWidth}).css("width","100%"),a.sidebarPushMenu&&$.AdminLTE.pushMenu.activate(a.sidebarToggleSelector),a.enableBSToppltip&&$("body").tooltip({selector:a.BSTooltipSelector}),a.enableBoxWidget&&$.AdminLTE.boxWidget.activate(),a.enableFastclick&&"undefined"!=typeof FastClick&&FastClick.attach(document.body),a.directChat.enable&&$(document).on("click",a.directChat.contactToggleSelector,function(){var a=$(this).parents(".direct-chat").first();a.toggleClass("direct-chat-contacts-open")}),$('.btn-group[data-toggle="btn-toggle"]').each(function(){var a=$(this);$(this).find(".btn").on("click",function(b){a.find(".btn.active").removeClass("active"),$(this).addClass("active"),b.preventDefault()})})}),function(a){"use strict";a.fn.boxRefresh=function(b){function c(a){a.append(f),e.onLoadStart.call(a)}function d(a){a.find(f).remove(),e.onLoadDone.call(a)}var e=a.extend({trigger:".refresh-btn",source:"",onLoadStart:function(a){return a},onLoadDone:function(a){return a}},b),f=a('<div class="overlay"><div class="fa fa-refresh fa-spin"></div></div>');return this.each(function(){if(""===e.source)return void(window.console&&window.console.log("Please specify a source first - boxRefresh()"));var b=a(this),f=b.find(e.trigger).first();f.on("click",function(a){a.preventDefault(),c(b),b.find(".box-body").load(e.source,function(){d(b)})})})}}(jQuery),function(a){"use strict";a.fn.activateBox=function(){a.AdminLTE.boxWidget.activate(this)},a.fn.toggleBox=function(){var b=a(a.AdminLTE.boxWidget.selectors.collapse,this);a.AdminLTE.boxWidget.collapse(b)},a.fn.removeBox=function(){var b=a(a.AdminLTE.boxWidget.selectors.remove,this);a.AdminLTE.boxWidget.remove(b)}}(jQuery),function(a){"use strict";a.fn.todolist=function(b){var c=a.extend({onCheck:function(a){return a},onUncheck:function(a){return a}},b);return this.each(function(){"undefined"!=typeof a.fn.iCheck?(a("input",this).on("ifChecked",function(){var b=a(this).parents("li").first();b.toggleClass("done"),c.onCheck.call(b)}),a("input",this).on("ifUnchecked",function(){var b=a(this).parents("li").first();b.toggleClass("done"),c.onUncheck.call(b)})):a("input",this).on("change",function(){var b=a(this).parents("li").first();b.toggleClass("done"),a("input",b).is(":checked")?c.onCheck.call(b):c.onUncheck.call(b)})})}}(jQuery);
2881099/FreeScheduler
20,111
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/js/bmw.js
var bmwjs = typeof exports === 'undefined' ? (exports = {}) : exports; (function() { var fs = typeof require === 'function' ? require('fs') : null; var path = typeof require === 'function' ? require('path') : null; if (typeof JSON === 'undefined') JSON = { stringify: function(str) { return '"' + String(str).replace(/"/g, '\\"').replace(/\r/g, '\\r').replace(/\n/g, '\\n') + '"'; } }; var compiles = {}; function getContextArg(context) { var argkeys = []; var argvalues = []; var argkey = ''; for (var a in context) argkeys.push(a); argkeys = argkeys.sort(); var argkeys_len = argkeys.length; for (var b = 0; b < argkeys_len; b++) { argvalues.push(context[argkeys[b]]); if (b > 0) argkey += ', '; argkey += argkeys[b]; } return { argkeys: argkeys, argvalues: argvalues, argkey: argkey }; } function include(view, context) { var carg = getContextArg(context); function func_exec(isnew) { var cv = compiles[view]; if (isnew || typeof cv.exec[carg.argkey] !== 'function') { try { cv.exec[carg.argkey] = Function.apply(context, ['$BMW__dirname', '$BMW__lib'].concat(carg.argkeys) .concat([cv.exec['$BMW__handle']])); } catch (e1) { cv.exec[carg.argkey] = function(dirname, lib) { return '编译失败,请检查 ' + view + '\r\n' + (e1.message || JSON.stringify(e1)); }; } } if (isnew === 2) return; try { var ret = cv.exec[carg.argkey].apply(context, [cv.dirname, lib].concat(carg.argvalues)); return ret; } catch (e1) { console.log(e1); return '运行错误,' + view + '\r\n' + (e1.message || JSON.stringify(e1)); } } if (compiles[view]) { var cv = compiles[view]; if (cv.exec['$BMW__handle_ok']) { var ret = func_exec(0); //检查内容是否修改,10秒检查一次 var timeout = new Date().getTime() - cv.chktime; if (isNaN(timeout) || timeout > 10000) { cv.chktime = new Date().getTime(); fs.stat(view, function(err, r) { if (!r) { cv.exec[carg.argkey] = function(dirname, lib) { return '文件不存在,或者无权限访问 ' + view; }; return; } var mtime = r.mtime.getTime(); if (cv.mtime !== mtime) { delete cv.exec; cv.exec = {}; cv.mtime = mtime; cv.chktime = new Date().getTime(); cv.exec[carg.argkey] = function(dirname, lib) { return '正在编译... ' + view; }; fs.readFile(view, 'utf-8', function(err, content) { if (err) return console.log('文件不存在,或者无权限访问 ' + view); var r = compile2(content); //fs.writeFile(view + '.js', r, { encoding: 'utf-8' }); cv.exec['$BMW__handle_ok'] = 1; cv.exec['$BMW__handle'] = r; func_exec(2); }); } }); } return ret; } } var cv2 = compiles[view] = { dirname: path.dirname(view), exec: {} }; var content = ''; try { content = fs.readFileSync(view, 'utf-8'); } catch (e1) { content = '文件不存在,或者无权限访问 ' + view; } var r = compile2(content); //fs.writeFile(view + '.js', r, { encoding: 'utf-8' }); cv2.exec['$BMW__handle_ok'] = 1; cv2.exec['$BMW__handle'] = r; return func_exec(1); }; exports.renderFile = function(view, context) { //view = path.join(view); 请在调用 renderFile 之前格式化好 view return include(view, context).toString(); }; exports.render = function(text, context) { var carg = getContextArg(context); var source = compile2(text); if (typeof __dirname === 'undefined') __dirname = 'render'; return Function.apply(context, ['$BMW__dirname', '$BMW__lib'].concat(carg.argkeys) .concat(source)).apply(context, [__dirname, lib].concat(carg.argvalues)).toString(); }; var compile2 = exports.compile2 = function(content) { var sb = ['var $BMW__this = this;\n\ var $BMW__sb = \'\';\n\ var $BMW__blocks = { toString : function() { return $BMW__sb; }, set__sb : function(sb) { $BMW__sb = sb; } };\n\ var $BMW__blocks_list = [];\n\ var $BMW__forc = null;\n\ function $BMW__exp(a) { return a===0?a:(a||\'\'); };\n\ function print(a) { $BMW__sb += $BMW__exp(a); };\n\ if (typeof $BMW__importAs === \'undefined\') $BMW__importAs = {};', '', '', '$BMW__sb += \'']; var fori = []; var includes = 0; var extend = ''; var codeTree = []; var bmw_tmpid = 0; var error = null; var throwError = function(msg) { error = 'return \'' + msg + '\';'; } var codeTreeEnd = function(tag) { var ret = ''; var pop = []; for (var a = codeTree.length - 1; a >= 0; a--) { var isbreak = false; switch (codeTree[a]) { case 'import': case 'include': //ret += '});'; pop.push(1); break; case tag: pop.unshift(2); ret = '\';' + ret; isbreak = true; break; default: if (!isbreak && tag !== 'undefined') pop = []; isbreak = true; } if (isbreak) break; } if (pop.length === 0 && tag !== 'undefined') throwError('语法错误,{' + tag + '} ' + ' {/' + tag + '} 并没配对'); while (pop.pop()) codeTree.pop(); return ret; }; //{miss}...{/miss}块内容将不被解析 var tmp_content_arr = reg_split(content, /\{\/?miss\}/g); if (tmp_content_arr.length > 1) { sb.push('\'; var $BMW__MISS = []; '); var miss_len = 0; for (var a = 1; a < tmp_content_arr.length; a += 2) { sb.push('$BMW__MISS.push(' + JSON.stringify(tmp_content_arr[a]) + ');'); tmp_content_arr[a] = '{#$BMW__MISS[' + miss_len++ + ']}'; } sb.push('$BMW__sb += \''); content = tmp_content_arr.join(''); } //扩展语法如 <div @if="表达式"></div> content = htmlSyntax(content, 3); //<div @if="表达式" @for="index 1,100"></div> //处理 {% %} 块js代码 var rep_jsstr = function(str) { return str.replace(/\\/g, '\\\\') .replace(/'/g, '\\\'') .replace(/\r/g, '\\r') .replace(/\n/g, '\\n'); }; tmp_content_arr = reg_split(content, /(\{%|%\})/g); if (tmp_content_arr.length === 1) { content = rep_jsstr(content) .replace(/\{%/g, '{$BMW__CODE}') .replace(/%\}/g, '{/$BMW__CODE}'); } else { tmp_content_arr[0] = rep_jsstr(tmp_content_arr[0]); for (var a = 1; a < tmp_content_arr.length; a += 4) { tmp_content_arr[a] = '{$BMW__CODE}'; tmp_content_arr[a + 2] = '{/$BMW__CODE}'; tmp_content_arr[a + 3] = rep_jsstr(tmp_content_arr[a + 3]); } content = tmp_content_arr.join(''); } var cmd_reg = /\{(\$BMW__CODE|\/\$BMW__CODE|import\s+|module\s+|extends\s+|block\s+|include\s+|for\s+|if\s+|#|\/for|elseif|else|\/if|\/block|\/module)([^\}]*)\}/g; sb.push(content.replace(cmd_reg, function($0, $1, $2) { if (error) return $0; $1 = trim($1, ' ', '\t'); $2 = $2.replace(/\\'/g, '\''); switch ($1) { case '$BMW__CODE': //{% print('这个块内可以编写js代码'); %} codeTree.push('$BMW__CODE'); return '\';\n'; case '/$BMW__CODE': if (codeTree[codeTree.length - 1] !== '$BMW__CODE') { throwError('编译出错,{% 与 %} 并没配对'); return $0; } codeTree.pop(); return ';\n\ $BMW__sb += \''; case 'include': //{include ../inc/header.html} includes++; codeTree.push('include'); return '\' + $BMW__include.call(null, ' + JSON.stringify($2) + ', null) + \''; case 'import': //{import ../inc/module.html as mymodule} var retimport = ''; $2.replace(/^([^\s]+)\s+as\s+([\w_]+)$/i, function($0, $1, $2) { retimport = '\';\n\ var ' + $2 + ' = {};\n\ (function() { var r = $BMW__include.call(null, ' + JSON.stringify($1) + ', ' + $2 + '); if (typeof r === \'string\') $BMW__sb += r; }).call(null);\n\ $BMW__sb += \''; includes++; codeTree.push('import'); }); if (retimport.length > 0) return retimport; return $0; case 'module': var rettemplate = ''; $2.replace(/^([\w_]+)(\s+([\w_,]+))?$/i, function($0, $1, $2, $3) { rettemplate = '\';\n\ $BMW__importAs.' + $1 + ' = function(' + $3 + ') {\n\ var $BMW__sb;\n\ var print = function(a) { $BMW__sb += $BMW__exp(a); };\n\ $BMW__sb = \''; codeTree.push('module'); }); if (rettemplate.length > 0) return rettemplate; return $0; case '/module': var endmodule = codeTreeEnd('module'); if (endmodule.length === 0) return $0; return endmodule + '\n\ return $BMW__sb;\n\ };\n\ $BMW__sb += \''; case 'extends': //{extends ../inc/layout.html} if (extend) return $0; extend = $2; return ''; case 'block': codeTree.push('block'); return '\';\n\ $BMW__blocks_list.push($BMW__blocks[' + JSON.stringify(trim($2, ' ', '\t')) + '] = [$BMW__sb.length, 0]);\n\ $BMW__sb += \''; case '/block': var endblock = codeTreeEnd('block'); if (endblock.length === 0) return $0; return endblock + '\n\ var $BMW__tmp' + ++bmw_tmpid + ' = $BMW__blocks_list.pop();\n\ $BMW__tmp' + bmw_tmpid + '[1] = $BMW__sb.length - $BMW__tmp' + bmw_tmpid + '[0];\n\ $BMW__sb += \''; case '#': //{#user.username} if ($2.charAt(0) === '#') //{##a} 容错输出 return '\' + (function(){var ret;try{ret=' + $2.substr(1) + ';}catch(e1){}return $BMW__exp(ret);}).call(null) + \''; return '\' + (' + $2 + ') + \''; case 'for': var retfor = '\';'; if (fori.length === 0) { retfor += '\n\ $BMW__forc = {};'; } var test = false; //{for item,index in array} //{for item,index in [1,2,3,4,item]} $2.replace(/^([\w_]+)\s*,?\s*([\w_]+)?\s+in\s+(.+)/i, function($0, $1, $2, $3) { $1 = trim($1, ' ', '\t'); $2 = trim($2, ' ', '\t'); retfor += '\n\ var $BMW__tmp' + ++bmw_tmpid + ' = ' + $3 + ';\n\ var $BMW__tmp' + ++bmw_tmpid + ' = $BMW__tmp' + (bmw_tmpid - 1) + '.length;\n\ for (var $BMW__tmp' + ++bmw_tmpid + ' = 0; $BMW__tmp' + bmw_tmpid + ' < $BMW__tmp' + (bmw_tmpid - 1) + '; $BMW__tmp' + bmw_tmpid + '++) {\n\ var ' + $1 + ' = $BMW__forc.' + $1 + ' = $BMW__tmp' + (bmw_tmpid - 2) + '[$BMW__tmp' + bmw_tmpid + '];'; if ($2) { retfor += '\n\ var ' + $2 + ' = $BMW__forc.' + $2 + ' = $BMW__tmp' + bmw_tmpid + ';'; } retfor += '\n\ $BMW__sb += \''; test = true; codeTree.push('for'); fori.push('Array.forEach'); return $0; }); if (test) return retfor; //{for key,item,index on jsonObject} $2.replace(/^([\w_]+)\s*,?\s*([\w_]+)?,?\s*([\w_]+)?\s+on\s+(.+)/i, function($0, $1, $2, $3, $4) { $1 = trim($1, ' ', '\t'); $2 = trim($2, ' ', '\t'); $3 = trim($3, ' ', '\t'); if ($3) retfor += '\n\ var ' + $3 + ' = -1;'; retfor += '\n\ var $BMW__tmp' + ++bmw_tmpid + ' = ' + $4 + ';\n\ for (var ' + $1 + ' in $BMW__tmp' + bmw_tmpid + ') {\n\ $BMW__forc.' + $1 + ' = ' + $1 + ';'; if ($2) retfor += '\n\ var ' + $2 + ' = $BMW__forc.' + $2 + ' = $BMW__tmp' + bmw_tmpid + '[' + $1 + '];'; if ($3) retfor += '\n\ $BMW__forc.' + $3 + ' = ++' + $3 + ';'; retfor += '\n\ $BMW__sb += \''; test = true; codeTree.push('for'); fori.push('JSON.forin'); return $0; }); if (test) return retfor; //{for a forstart,forend} 支持模板变量,保证forstart表达式中没有逗号 $2.replace(/^([\w_]+)\s+([^,]+)\s*,\s*(.+)/i, function($0, $1, $2, $3) { $1 = trim($1, ' ', '\t'); retfor += '\n\ var $BMW__tmp' + ++bmw_tmpid + ' = ' + $3 + ';\n\ var $BMW__tmp' + ++bmw_tmpid + ' = ' + $2 + ';\n\ while ($BMW__tmp' + bmw_tmpid + ' < $BMW__tmp' + (bmw_tmpid - 1) + ') {\n\ var ' + $1 + ' = $BMW__forc.' + $1 + ' = $BMW__tmp' + bmw_tmpid + '++;\n\ $BMW__sb += \''; test = true; codeTree.push('for'); fori.push('for.a2b'); return $0; }); if (test) return retfor; return $0; case '/for': var endfor = codeTreeEnd('for'); if (endfor.length === 0) return $0; fori.pop(); return endfor + '\n\ }' + //(fori.pop() === 'Array.forEach' ? ');' : '') + (fori.length <= 0 ? '\n$BMW__forc = null;' : '') + '\n\ $BMW__sb += \''; case 'if': //{if user.id === 0 || user.isadmin === true && user.point > 100} //(function(){var test=false;try{test=' + $2 + ';}catch(e1){};return test;}).call(null) codeTree.push('if'); return '\';\n\ if (' + $2 + ') {\n\ $BMW__sb += \''; case 'elseif': //{elseif user.id === 0 || user.isadmin === true && user.point > 100} (function() { var test = false; try { test = ' + $2 + '; } catch (e1) { }; return test; }).call(null) var endelseif = codeTreeEnd('if'); if (endelseif.length === 0) return $0; codeTree.push('if'); return endelseif + '\n\ } else if (' + $2 + ') {\n\ $BMW__sb += \''; case 'else': var endelse = codeTreeEnd('if'); if (endelse.length === 0) return $0; codeTree.push('if'); return endelse + '\n\ } else {\n\ $BMW__sb += \''; case '/if': var endif = codeTreeEnd('if'); if (endif.length === 0) return $0; return endif + '\n\ }\n\ $BMW__sb += \''; } return $0; })); sb.push('\';'); if (extend) { sb.push('\n\ var r = $BMW__lib.include($BMW__lib.path.join($BMW__dirname, ' + JSON.stringify(extend) + '), $BMW__this);\n\ if (!r) return \'\';\n\ if (typeof r === \'string\') return r;\n\ var rstr = r.toString();\n\ var rstr_changed = false;\n\ for (var a in $BMW__blocks)\n\ if ($BMW__blocks[a].length === 2 && typeof $BMW__blocks[a][0] === \'number\' && typeof $BMW__blocks[a][1] === \'number\') {\n\ var sb2 = $BMW__sb.substr($BMW__blocks[a][0], $BMW__blocks[a][1]);\n\ if (r[a] && r[a].length === 2 && typeof r[a][0] === \'number\' && typeof r[a][1] === \'number\') {\n\ for (var b in r)\n\ if (r[b].length === 2 && typeof r[a][0] === \'number\' && r[b][0] > r[a][0])\n\ r[b][0] = r[b][0] - r[a][1] + sb2.length;\n\ rstr = rstr.substr(0, r[a][0]) + sb2 + rstr.substr(r[a][0] + r[a][1]);\n\ r[a][1] = sb2.length;\n\ rstr_changed = true;\n\ }\n\ }\n\ if (rstr_changed) r.set__sb(rstr);\n\ return r;'); } else { sb.push('\n\ return $BMW__blocks;'); } for (var z = 0; z < codeTree.length; z++) { if (codeTree[z] !== 'import' && codeTree[z] !== 'include') { throwError('编译出错,{' + codeTree[z] + '} 没有结束标记 {/' + codeTree[z] + '}'); return false; } } //var endundefined = codeTreeEnd('undefined'); //sb.push(endundefined); if (includes > 0) { sb[1] = '\n\ var $BMW__include = function(file, $BMW__importAs) {\n\ var context_tmp = { };\n\ for (var a in $BMW__this) context_tmp[a] = $BMW__this[a];\n\ if (typeof $BMW__forc === \'object\') for (var a in $BMW__forc) context_tmp[a] = $BMW__forc[a];\n\ if ($BMW__importAs) context_tmp.$BMW__importAs = $BMW__importAs;\n\ var view = $BMW__lib.path.join($BMW__dirname, file);\n\ return $BMW__lib.include(view, context_tmp);\n\ };'; } return error || sb.join('') .replace(/\s*\$BMW__sb\s*\+=\s*'';\s*/g, ''); //.replace(/\\/g, '\\\\'); }; var htmlSyntax = function(content, num) { while (num-- > 0) { var arr = reg_split(content, /<(\w+)\s+@(if|for|else)\s*="([^"]*)"/gi); if (arr.length === 1) break; for (var a = 1; a < arr.length; a += 4) { var tag = '<' + arr[a]; var end = '</' + arr[a] + '>'; var fc = 1; for (var b = a; fc > 0 && b < arr.length; b += 4) { if (b > a && arr[a].toLowerCase() === arr[b].toLowerCase()) fc++; var bpos = 0; while (true) { var fa = arr[b + 3].indexOf(tag, bpos); var fb = arr[b + 3].indexOf(end, bpos); if (b === a) { var z = arr[b + 3].indexOf("/>"); if ((fb === -1 || z < fb) && z !== -1) { var y = arr[b + 3].substr(0, z + 2); if (!/<\/?\w+[^>]*>/.test(y)) fb = z - end.length + 2; } } if (fa === -1 && fb === -1) break; if (fa !== -1 && (fa < fb || fb == -1)) { fc++; bpos = fa + tag.length; continue; } if (fb !== -1) fc--; if (fc <= 0) { var a1 = arr[a + 1]; var end3 = '{/' + a1 + '}'; if (a1.toLowerCase() === 'else') { if (String(arr[a - 4 + 3]).replace(/\s+/g, '').slice(-5).toLowerCase() === '{/if}') { var idx = arr[a - 4 + 3].lastIndexOf('{/if}'); arr[a - 4 + 3] = arr[a - 4 + 3].substr(0, idx) + arr[a - 4 + 3].substr(idx + 5); //如果 @else="有条件内容",则变换成 elseif 条件内容 if (arr[a + 2].replace(/\s+/g, '').length > 0) a1 = 'elseif'; end3 = '{/if}'; } else { arr[a] = '指令 @' + arr[a + 1] + '="' + arr[a + 2] + '" 没紧接着 if/else 指令之后,无效. <' + arr[a]; arr[a + 1] = arr[a + 2] = ''; } } if (arr[a + 1].length > 0) { if (arr[a + 2].replace(/\s+/g, '').length > 0 || a1.toLowerCase() === 'else') { arr[b + 3] = arr[b + 3].substr(0, fb + end.length) + end3 + arr[b + 3].substr(fb + end.length); arr[a] = '{' + a1 + ' ' + arr[a + 2] + '}<' + arr[a]; arr[a + 1] = arr[a + 2] = ''; } else { arr[a] = '<' + arr[a]; arr[a + 1] = arr[a + 2] = ''; } } break; } bpos = fb + end.length; } } if (fc > 0) { arr[a] = '不严谨的html格式,请检查 ' + arr[a] + ' 的结束标签, @' + arr[a + 1] + '="' + arr[a + 2] + '" 指令无效. <' + arr[a]; arr[a + 1] = arr[a + 2] = ''; } } if (arr.length > 0) content = arr.join(''); } return content; }; var ltrim = function() { var args = [].slice.call(arguments); var str = args[0] || ''; args.shift(); var reg = new RegExp('^(' + args.join('|') + ')', 'gi'); return str.replace(reg, ''); }; var rtrim = function() { var args = [].slice.call(arguments); var str = args[0] || ''; args.shift(); var reg = new RegExp('(' + args.join('|') + ')$', 'gi'); return str.replace(reg, ''); }; var trim = function() { arguments[0] = ltrim.apply(this, arguments); return rtrim.apply(this, arguments) }; var reg_split = function(str, reg) { if (fs) return str.split(reg); //服务端的话直接使用 split //解决 ie6 8 和其他浏览器的 split 使用方法不兼容 var ret = []; var exec = null; var idx = 0; while (exec = reg.exec(str)) { var idx2 = idx; idx = str.indexOf(exec[0], idx2); ret.push(str.substring(idx2, idx)); for (var a = 1; a < exec.length; a++) ret.push(exec[a]); idx += exec[0].length; } if (ret.length > 0) ret.push(str.substr(idx)); return ret.length ? ret : [str]; }; var lib = { path: path, JSON: JSON, include: include }; })();
2881099/FreeScheduler
88,468
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/css/system.css
/*! * AdminLTE v2.3.1 * Author: Almsaeed Studio * Website: Almsaeed Studio <http://almsaeedstudio.com> * License: Open source - MIT * Please visit http://opensource.org/licenses/MIT for more information !*/html,body{min-height:100%}.layout-boxed html,.layout-boxed body{height:100%}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:'Source Sans Pro','Helvetica Neue',Helvetica,Arial,sans-serif;font-weight:400;overflow-x:hidden;overflow-y:auto}.wrapper{min-height:100%;position:relative;overflow:hidden}.wrapper:before,.wrapper:after{content:" ";display:table}.wrapper:after{clear:both}.layout-boxed .wrapper{max-width:1250px;margin:0 auto;min-height:100%;box-shadow:0 0 8px rgba(0,0,0,.5);position:relative}.layout-boxed{background:url(../img/boxed-bg.jpg) repeat fixed}.content-wrapper,.right-side,.main-footer{-webkit-transition:-webkit-transform .3s ease-in-out,margin .3s ease-in-out;-moz-transition:-moz-transform .3s ease-in-out,margin .3s ease-in-out;-o-transition:-o-transform .3s ease-in-out,margin .3s ease-in-out;transition:transform .3s ease-in-out,margin .3s ease-in-out;margin-left:230px;z-index:820}.layout-top-nav .content-wrapper,.layout-top-nav .right-side,.layout-top-nav .main-footer{margin-left:0}@media (max-width:767px){.content-wrapper,.right-side,.main-footer{margin-left:0}}@media (min-width:768px){.sidebar-collapse .content-wrapper,.sidebar-collapse .right-side,.sidebar-collapse .main-footer{margin-left:0}}@media (max-width:767px){.sidebar-open .content-wrapper,.sidebar-open .right-side,.sidebar-open .main-footer{-webkit-transform:translate(230px,0);-ms-transform:translate(230px,0);-o-transform:translate(230px,0);transform:translate(230px,0)}}.content-wrapper,.right-side{min-height:100%;background-color:#ecf0f5;z-index:800}.main-footer{background:#fff;padding:15px;color:#444;border-top:1px solid #d2d6de}.fixed .main-header,.fixed .main-sidebar,.fixed .left-side{position:fixed}.fixed .main-header{top:0;right:0;left:0}.fixed .content-wrapper,.fixed .right-side{padding-top:50px}@media (max-width:767px){.fixed .content-wrapper,.fixed .right-side{padding-top:100px}}.fixed.layout-boxed .wrapper{max-width:100%}body.hold-transition .content-wrapper,body.hold-transition .right-side,body.hold-transition .main-footer,body.hold-transition .main-sidebar,body.hold-transition .left-side,body.hold-transition .main-header>.navbar,body.hold-transition .main-header .logo{-webkit-transition:none;-o-transition:none;transition:none}.content{min-height:250px;padding:15px;margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-family:'Source Sans Pro',sans-serif}a{color:#3c8dbc}a:hover,a:active,a:focus{outline:0;text-decoration:none;color:#72afd2}.page-header{margin:10px 0 20px;font-size:22px}.page-header>small{color:#666;display:block;margin-top:5px}.main-header{position:relative;max-height:100px;z-index:1030}.main-header>.navbar{-webkit-transition:margin-left .3s ease-in-out;-o-transition:margin-left .3s ease-in-out;transition:margin-left .3s ease-in-out;margin-bottom:0;margin-left:230px;border:none;min-height:50px;border-radius:0}.layout-top-nav .main-header>.navbar{margin-left:0}.main-header #navbar-search-input.form-control{background:rgba(255,255,255,.2);border-color:transparent}.main-header #navbar-search-input.form-control:focus,.main-header #navbar-search-input.form-control:active{border-color:rgba(0,0,0,.1);background:rgba(255,255,255,.9)}.main-header #navbar-search-input.form-control::-moz-placeholder{color:#ccc;opacity:1}.main-header #navbar-search-input.form-control:-ms-input-placeholder{color:#ccc}.main-header #navbar-search-input.form-control::-webkit-input-placeholder{color:#ccc}.main-header .navbar-custom-menu,.main-header .navbar-right{float:right}@media (max-width:991px){.main-header .navbar-custom-menu a,.main-header .navbar-right a{color:inherit;background:0 0}}@media (max-width:767px){.main-header .navbar-right{float:none}.navbar-collapse .main-header .navbar-right{margin:7.5px -15px}.main-header .navbar-right>li{color:inherit;border:0}}.main-header .sidebar-toggle{float:left;background-color:transparent;background-image:none;padding:15px;font-family:fontAwesome}.main-header .sidebar-toggle:before{content:"\f0c9"}.main-header .sidebar-toggle:hover{color:#fff}.main-header .sidebar-toggle:focus,.main-header .sidebar-toggle:active{background:0 0}.main-header .sidebar-toggle .icon-bar{display:none}.main-header .navbar .nav>li.user>a>.fa,.main-header .navbar .nav>li.user>a>.glyphicon,.main-header .navbar .nav>li.user>a>.ion{margin-right:5px}.main-header .navbar .nav>li>a>.label{position:absolute;top:9px;right:7px;text-align:center;font-size:9px;padding:2px 3px;line-height:.9}.main-header .logo{-webkit-transition:width .3s ease-in-out;-o-transition:width .3s ease-in-out;transition:width .3s ease-in-out;display:block;float:left;height:50px;font-size:20px;line-height:50px;text-align:center;width:230px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;padding:0 15px;font-weight:300;overflow:hidden}.main-header .logo .logo-lg{display:block}.main-header .logo .logo-mini{display:none}.main-header .navbar-brand{color:#fff}.content-header{position:relative;padding:15px 15px 0}.content-header>h1{margin:0;font-size:24px}.content-header>h1>small{font-size:15px;display:inline-block;padding-left:4px;font-weight:300}.content-header>.breadcrumb{float:right;background:0 0;margin-top:0;margin-bottom:0;font-size:12px;padding:7px 5px;position:absolute;top:15px;right:10px;border-radius:2px}.content-header>.breadcrumb>li>a{color:#444;text-decoration:none;display:inline-block}.content-header>.breadcrumb>li>a>.fa,.content-header>.breadcrumb>li>a>.glyphicon,.content-header>.breadcrumb>li>a>.ion{margin-right:5px}.content-header>.breadcrumb>li+li:before{content:'>\00a0'}@media (max-width:991px){.content-header>.breadcrumb{position:relative;margin-top:5px;top:0;right:0;float:none;background:#d2d6de;padding-left:10px}.content-header>.breadcrumb li:before{color:#97a0b3}}.navbar-toggle{color:#fff;border:0;margin:0;padding:15px}@media (max-width:991px){.navbar-custom-menu .navbar-nav>li{float:left}.navbar-custom-menu .navbar-nav{margin:0;float:left}.navbar-custom-menu .navbar-nav>li>a{padding-top:15px;padding-bottom:15px;line-height:20px}}@media (max-width:767px){.main-header{position:relative}.main-header .logo,.main-header .navbar{width:100%;float:none}.main-header .navbar{margin:0}.main-header .navbar-custom-menu{float:right}}@media (max-width:991px){.navbar-collapse.pull-left{float:none!important}.navbar-collapse.pull-left+.navbar-custom-menu{display:block;position:absolute;top:0;right:40px}}.main-sidebar,.left-side{position:absolute;top:0;left:0;padding-top:50px;min-height:100%;width:230px;z-index:810;-webkit-transition:-webkit-transform .3s ease-in-out,width .3s ease-in-out;-moz-transition:-moz-transform .3s ease-in-out,width .3s ease-in-out;-o-transition:-o-transform .3s ease-in-out,width .3s ease-in-out;transition:transform .3s ease-in-out,width .3s ease-in-out}@media (max-width:767px){.main-sidebar,.left-side{padding-top:100px}}@media (max-width:767px){.main-sidebar,.left-side{-webkit-transform:translate(-230px,0);-ms-transform:translate(-230px,0);-o-transform:translate(-230px,0);transform:translate(-230px,0)}}@media (min-width:768px){.sidebar-collapse .main-sidebar,.sidebar-collapse .left-side{-webkit-transform:translate(-230px,0);-ms-transform:translate(-230px,0);-o-transform:translate(-230px,0);transform:translate(-230px,0)}}@media (max-width:767px){.sidebar-open .main-sidebar,.sidebar-open .left-side{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}}.sidebar{padding-bottom:10px}.sidebar-form input:focus{border-color:transparent}.user-panel{position:relative;width:100%;padding:10px;overflow:hidden}.user-panel:before,.user-panel:after{content:" ";display:table}.user-panel:after{clear:both}.user-panel>.image>img{width:100%;max-width:45px;height:auto}.user-panel>.info{padding:5px 5px 5px 15px;line-height:1;position:absolute;left:55px}.user-panel>.info>p{font-weight:600;margin-bottom:9px}.user-panel>.info>a{text-decoration:none;padding-right:5px;margin-top:3px;font-size:11px}.user-panel>.info>a>.fa,.user-panel>.info>a>.ion,.user-panel>.info>a>.glyphicon{margin-right:3px}.sidebar-menu{list-style:none;margin:0;padding:0}.sidebar-menu>li{position:relative;margin:0;padding:0}.sidebar-menu>li>a{padding:12px 5px 12px 15px;display:block}.sidebar-menu>li>a>.fa,.sidebar-menu>li>a>.glyphicon,.sidebar-menu>li>a>.ion{width:20px}.sidebar-menu>li .label,.sidebar-menu>li .badge{margin-top:3px;margin-right:5px}.sidebar-menu li.header{padding:10px 25px 10px 15px;font-size:12px}.sidebar-menu li>a>.fa-angle-left{width:auto;height:auto;padding:0;margin-right:10px;margin-top:3px}.sidebar-menu li.active>a>.fa-angle-left{-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);-o-transform:rotate(-90deg);transform:rotate(-90deg)}.sidebar-menu li.active>.treeview-menu{display:block}.sidebar-menu .treeview-menu{display:none;list-style:none;padding:0;margin:0;padding-left:5px}.sidebar-menu .treeview-menu .treeview-menu{padding-left:20px}.sidebar-menu .treeview-menu>li{margin:0}.sidebar-menu .treeview-menu>li>a{padding:5px 5px 5px 15px;display:block;font-size:14px}.sidebar-menu .treeview-menu>li>a>.fa,.sidebar-menu .treeview-menu>li>a>.glyphicon,.sidebar-menu .treeview-menu>li>a>.ion{width:20px}.sidebar-menu .treeview-menu>li>a>.fa-angle-left,.sidebar-menu .treeview-menu>li>a>.fa-angle-down{width:auto}@media (min-width:768px){.sidebar-mini.sidebar-collapse .content-wrapper,.sidebar-mini.sidebar-collapse .right-side,.sidebar-mini.sidebar-collapse .main-footer{margin-left:50px!important;z-index:840}.sidebar-mini.sidebar-collapse .main-sidebar{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0);width:50px!important;z-index:850}.sidebar-mini.sidebar-collapse .sidebar-menu>li{position:relative}.sidebar-mini.sidebar-collapse .sidebar-menu>li>a{margin-right:0}.sidebar-mini.sidebar-collapse .sidebar-menu>li>a>span{border-top-right-radius:4px}.sidebar-mini.sidebar-collapse .sidebar-menu>li:not(.treeview)>a>span{border-bottom-right-radius:4px}.sidebar-mini.sidebar-collapse .sidebar-menu>li>.treeview-menu{padding-top:5px;padding-bottom:5px;border-bottom-right-radius:4px}.sidebar-mini.sidebar-collapse .sidebar-menu>li:hover>a>span:not(.pull-right),.sidebar-mini.sidebar-collapse .sidebar-menu>li:hover>.treeview-menu{display:block!important;position:absolute;width:180px;left:50px}.sidebar-mini.sidebar-collapse .sidebar-menu>li:hover>a>span{top:0;margin-left:-3px;padding:12px 5px 12px 20px;background-color:inherit}.sidebar-mini.sidebar-collapse .sidebar-menu>li:hover>.treeview-menu{top:44px;margin-left:0}.sidebar-mini.sidebar-collapse .main-sidebar .user-panel>.info,.sidebar-mini.sidebar-collapse .sidebar-form,.sidebar-mini.sidebar-collapse .sidebar-menu>li>a>span,.sidebar-mini.sidebar-collapse .sidebar-menu>li>.treeview-menu,.sidebar-mini.sidebar-collapse .sidebar-menu>li>a>.pull-right,.sidebar-mini.sidebar-collapse .sidebar-menu li.header{display:none!important;-webkit-transform:translateZ(0)}.sidebar-mini.sidebar-collapse .main-header .logo{width:50px}.sidebar-mini.sidebar-collapse .main-header .logo>.logo-mini{display:block;margin-left:-15px;margin-right:-15px;font-size:18px}.sidebar-mini.sidebar-collapse .main-header .logo>.logo-lg{display:none}.sidebar-mini.sidebar-collapse .main-header .navbar{margin-left:50px}}.sidebar-menu,.main-sidebar .user-panel,.sidebar-menu>li.header{white-space:nowrap;overflow:hidden}.sidebar-menu:hover{overflow:visible}.sidebar-form,.sidebar-menu>li.header{overflow:hidden;text-overflow:clip}.sidebar-menu li>a{position:relative}.sidebar-menu li>a>.pull-right{position:absolute;top:50%;right:10px;margin-top:-7px}.control-sidebar-bg{position:fixed;z-index:1000;bottom:0}.control-sidebar-bg,.control-sidebar{top:0;right:-230px;width:230px;-webkit-transition:right .3s ease-in-out;-o-transition:right .3s ease-in-out;transition:right .3s ease-in-out}.control-sidebar{position:absolute;padding-top:50px;z-index:1010}@media (max-width:768px){.control-sidebar{padding-top:100px}}.control-sidebar>.tab-content{padding:10px 15px}.control-sidebar.control-sidebar-open,.control-sidebar.control-sidebar-open+.control-sidebar-bg{right:0}.control-sidebar-open .control-sidebar-bg,.control-sidebar-open .control-sidebar{right:0}@media (min-width:768px){.control-sidebar-open .content-wrapper,.control-sidebar-open .right-side,.control-sidebar-open .main-footer{margin-right:230px}}.nav-tabs.control-sidebar-tabs>li:first-of-type>a,.nav-tabs.control-sidebar-tabs>li:first-of-type>a:hover,.nav-tabs.control-sidebar-tabs>li:first-of-type>a:focus{border-left-width:0}.nav-tabs.control-sidebar-tabs>li>a{border-radius:0}.nav-tabs.control-sidebar-tabs>li>a,.nav-tabs.control-sidebar-tabs>li>a:hover{border-top:none;border-right:none;border-left:1px solid transparent;border-bottom:1px solid transparent}.nav-tabs.control-sidebar-tabs>li>a .icon{font-size:16px}.nav-tabs.control-sidebar-tabs>li.active>a,.nav-tabs.control-sidebar-tabs>li.active>a:hover,.nav-tabs.control-sidebar-tabs>li.active>a:focus,.nav-tabs.control-sidebar-tabs>li.active>a:active{border-top:none;border-right:none;border-bottom:none}@media (max-width:768px){.nav-tabs.control-sidebar-tabs{display:table}.nav-tabs.control-sidebar-tabs>li{display:table-cell}}.control-sidebar-heading{font-weight:400;font-size:16px;padding:10px 0;margin-bottom:10px}.control-sidebar-subheading{display:block;font-weight:400;font-size:14px}.control-sidebar-menu{list-style:none;padding:0;margin:0 -15px}.control-sidebar-menu>li>a{display:block;padding:10px 15px}.control-sidebar-menu>li>a:before,.control-sidebar-menu>li>a:after{content:" ";display:table}.control-sidebar-menu>li>a:after{clear:both}.control-sidebar-menu>li>a>.control-sidebar-subheading{margin-top:0}.control-sidebar-menu .menu-icon{float:left;width:35px;height:35px;border-radius:50%;text-align:center;line-height:35px}.control-sidebar-menu .menu-info{margin-left:45px;margin-top:3px}.control-sidebar-menu .menu-info>.control-sidebar-subheading{margin:0}.control-sidebar-menu .menu-info>p{margin:0;font-size:11px}.control-sidebar-menu .progress{margin:0}.control-sidebar-dark{color:#b8c7ce}.control-sidebar-dark,.control-sidebar-dark+.control-sidebar-bg{background:#222d32}.control-sidebar-dark .nav-tabs.control-sidebar-tabs{border-bottom:#1c2529}.control-sidebar-dark .nav-tabs.control-sidebar-tabs>li>a{background:#181f23;color:#b8c7ce}.control-sidebar-dark .nav-tabs.control-sidebar-tabs>li>a,.control-sidebar-dark .nav-tabs.control-sidebar-tabs>li>a:hover,.control-sidebar-dark .nav-tabs.control-sidebar-tabs>li>a:focus{border-left-color:#141a1d;border-bottom-color:#141a1d}.control-sidebar-dark .nav-tabs.control-sidebar-tabs>li>a:hover,.control-sidebar-dark .nav-tabs.control-sidebar-tabs>li>a:focus,.control-sidebar-dark .nav-tabs.control-sidebar-tabs>li>a:active{background:#1c2529}.control-sidebar-dark .nav-tabs.control-sidebar-tabs>li>a:hover{color:#fff}.control-sidebar-dark .nav-tabs.control-sidebar-tabs>li.active>a,.control-sidebar-dark .nav-tabs.control-sidebar-tabs>li.active>a:hover,.control-sidebar-dark .nav-tabs.control-sidebar-tabs>li.active>a:focus,.control-sidebar-dark .nav-tabs.control-sidebar-tabs>li.active>a:active{background:#222d32;color:#fff}.control-sidebar-dark .control-sidebar-heading,.control-sidebar-dark .control-sidebar-subheading{color:#fff}.control-sidebar-dark .control-sidebar-menu>li>a:hover{background:#1e282c}.control-sidebar-dark .control-sidebar-menu>li>a .menu-info>p{color:#b8c7ce}.control-sidebar-light{color:#5e5e5e}.control-sidebar-light,.control-sidebar-light+.control-sidebar-bg{background:#f9fafc;border-left:1px solid #d2d6de}.control-sidebar-light .nav-tabs.control-sidebar-tabs{border-bottom:#d2d6de}.control-sidebar-light .nav-tabs.control-sidebar-tabs>li>a{background:#e8ecf4;color:#444}.control-sidebar-light .nav-tabs.control-sidebar-tabs>li>a,.control-sidebar-light .nav-tabs.control-sidebar-tabs>li>a:hover,.control-sidebar-light .nav-tabs.control-sidebar-tabs>li>a:focus{border-left-color:#d2d6de;border-bottom-color:#d2d6de}.control-sidebar-light .nav-tabs.control-sidebar-tabs>li>a:hover,.control-sidebar-light .nav-tabs.control-sidebar-tabs>li>a:focus,.control-sidebar-light .nav-tabs.control-sidebar-tabs>li>a:active{background:#eff1f7}.control-sidebar-light .nav-tabs.control-sidebar-tabs>li.active>a,.control-sidebar-light .nav-tabs.control-sidebar-tabs>li.active>a:hover,.control-sidebar-light .nav-tabs.control-sidebar-tabs>li.active>a:focus,.control-sidebar-light .nav-tabs.control-sidebar-tabs>li.active>a:active{background:#f9fafc;color:#111}.control-sidebar-light .control-sidebar-heading,.control-sidebar-light .control-sidebar-subheading{color:#111}.control-sidebar-light .control-sidebar-menu{margin-left:-14px}.control-sidebar-light .control-sidebar-menu>li>a:hover{background:#f4f4f5}.control-sidebar-light .control-sidebar-menu>li>a .menu-info>p{color:#5e5e5e}.dropdown-menu{box-shadow:none;border-color:#eee}.dropdown-menu>li>a{color:#777}.dropdown-menu>li>a>.glyphicon,.dropdown-menu>li>a>.fa,.dropdown-menu>li>a>.ion{margin-right:10px}.dropdown-menu>li>a:hover{background-color:#e1e3e9;color:#333}.dropdown-menu>.divider{background-color:#eee}.navbar-nav>.notifications-menu>.dropdown-menu,.navbar-nav>.messages-menu>.dropdown-menu,.navbar-nav>.tasks-menu>.dropdown-menu{width:280px;padding:0;margin:0;top:100%}.navbar-nav>.notifications-menu>.dropdown-menu>li,.navbar-nav>.messages-menu>.dropdown-menu>li,.navbar-nav>.tasks-menu>.dropdown-menu>li{position:relative}.navbar-nav>.notifications-menu>.dropdown-menu>li.header,.navbar-nav>.messages-menu>.dropdown-menu>li.header,.navbar-nav>.tasks-menu>.dropdown-menu>li.header{border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0;background-color:#fff;padding:7px 10px;border-bottom:1px solid #f4f4f4;color:#444;font-size:14px}.navbar-nav>.notifications-menu>.dropdown-menu>li.footer>a,.navbar-nav>.messages-menu>.dropdown-menu>li.footer>a,.navbar-nav>.tasks-menu>.dropdown-menu>li.footer>a{border-top-left-radius:0;border-top-right-radius:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px;font-size:12px;background-color:#fff;padding:7px 10px;border-bottom:1px solid #eee;color:#444!important;text-align:center}@media (max-width:991px){.navbar-nav>.notifications-menu>.dropdown-menu>li.footer>a,.navbar-nav>.messages-menu>.dropdown-menu>li.footer>a,.navbar-nav>.tasks-menu>.dropdown-menu>li.footer>a{background:#fff!important;color:#444!important}}.navbar-nav>.notifications-menu>.dropdown-menu>li.footer>a:hover,.navbar-nav>.messages-menu>.dropdown-menu>li.footer>a:hover,.navbar-nav>.tasks-menu>.dropdown-menu>li.footer>a:hover{text-decoration:none;font-weight:400}.navbar-nav>.notifications-menu>.dropdown-menu>li .menu,.navbar-nav>.messages-menu>.dropdown-menu>li .menu,.navbar-nav>.tasks-menu>.dropdown-menu>li .menu{max-height:200px;margin:0;padding:0;list-style:none;overflow-x:hidden}.navbar-nav>.notifications-menu>.dropdown-menu>li .menu>li>a,.navbar-nav>.messages-menu>.dropdown-menu>li .menu>li>a,.navbar-nav>.tasks-menu>.dropdown-menu>li .menu>li>a{display:block;white-space:nowrap;border-bottom:1px solid #f4f4f4}.navbar-nav>.notifications-menu>.dropdown-menu>li .menu>li>a:hover,.navbar-nav>.messages-menu>.dropdown-menu>li .menu>li>a:hover,.navbar-nav>.tasks-menu>.dropdown-menu>li .menu>li>a:hover{background:#f4f4f4;text-decoration:none}.navbar-nav>.notifications-menu>.dropdown-menu>li .menu>li>a{color:#444;overflow:hidden;text-overflow:ellipsis;padding:10px}.navbar-nav>.notifications-menu>.dropdown-menu>li .menu>li>a>.glyphicon,.navbar-nav>.notifications-menu>.dropdown-menu>li .menu>li>a>.fa,.navbar-nav>.notifications-menu>.dropdown-menu>li .menu>li>a>.ion{width:20px}.navbar-nav>.messages-menu>.dropdown-menu>li .menu>li>a{margin:0;padding:10px}.navbar-nav>.messages-menu>.dropdown-menu>li .menu>li>a>div>img{margin:auto 10px auto auto;width:40px;height:40px}.navbar-nav>.messages-menu>.dropdown-menu>li .menu>li>a>h4{padding:0;margin:0 0 0 45px;color:#444;font-size:15px;position:relative}.navbar-nav>.messages-menu>.dropdown-menu>li .menu>li>a>h4>small{color:#999;font-size:10px;position:absolute;top:0;right:0}.navbar-nav>.messages-menu>.dropdown-menu>li .menu>li>a>p{margin:0 0 0 45px;font-size:12px;color:#888}.navbar-nav>.messages-menu>.dropdown-menu>li .menu>li>a:before,.navbar-nav>.messages-menu>.dropdown-menu>li .menu>li>a:after{content:" ";display:table}.navbar-nav>.messages-menu>.dropdown-menu>li .menu>li>a:after{clear:both}.navbar-nav>.tasks-menu>.dropdown-menu>li .menu>li>a{padding:10px}.navbar-nav>.tasks-menu>.dropdown-menu>li .menu>li>a>h3{font-size:14px;padding:0;margin:0 0 10px;color:#666}.navbar-nav>.tasks-menu>.dropdown-menu>li .menu>li>a>.progress{padding:0;margin:0}.navbar-nav>.user-menu>.dropdown-menu{border-top-right-radius:0;border-top-left-radius:0;padding:1px 0 0;border-top-width:0;width:280px}.navbar-nav>.user-menu>.dropdown-menu,.navbar-nav>.user-menu>.dropdown-menu>.user-body{border-bottom-right-radius:4px;border-bottom-left-radius:4px}.navbar-nav>.user-menu>.dropdown-menu>li.user-header{height:175px;padding:10px;text-align:center}.navbar-nav>.user-menu>.dropdown-menu>li.user-header>img{z-index:5;height:90px;width:90px;border:3px solid;border-color:transparent;border-color:rgba(255,255,255,.2)}.navbar-nav>.user-menu>.dropdown-menu>li.user-header>p{z-index:5;color:#fff;color:rgba(255,255,255,.8);font-size:17px;margin-top:10px}.navbar-nav>.user-menu>.dropdown-menu>li.user-header>p>small{display:block;font-size:12px}.navbar-nav>.user-menu>.dropdown-menu>.user-body{padding:15px;border-bottom:1px solid #f4f4f4;border-top:1px solid #ddd}.navbar-nav>.user-menu>.dropdown-menu>.user-body:before,.navbar-nav>.user-menu>.dropdown-menu>.user-body:after{content:" ";display:table}.navbar-nav>.user-menu>.dropdown-menu>.user-body:after{clear:both}.navbar-nav>.user-menu>.dropdown-menu>.user-body a{color:#444!important}@media (max-width:991px){.navbar-nav>.user-menu>.dropdown-menu>.user-body a{background:#fff!important;color:#444!important}}.navbar-nav>.user-menu>.dropdown-menu>.user-footer{background-color:#f9f9f9;padding:10px}.navbar-nav>.user-menu>.dropdown-menu>.user-footer:before,.navbar-nav>.user-menu>.dropdown-menu>.user-footer:after{content:" ";display:table}.navbar-nav>.user-menu>.dropdown-menu>.user-footer:after{clear:both}.navbar-nav>.user-menu>.dropdown-menu>.user-footer .btn-default{color:#666}@media (max-width:991px){.navbar-nav>.user-menu>.dropdown-menu>.user-footer .btn-default:hover{background-color:#f9f9f9}}.navbar-nav>.user-menu .user-image{float:left;width:25px;height:25px;border-radius:50%;margin-right:10px;margin-top:-2px}@media (max-width:767px){.navbar-nav>.user-menu .user-image{float:none;margin-right:0;margin-top:-8px;line-height:10px}}.open:not(.dropup)>.animated-dropdown-menu{backface-visibility:visible!important;-webkit-animation:flipInX .7s both;-o-animation:flipInX .7s both;animation:flipInX .7s both}@keyframes flipInX{0%{transform:perspective(400px) rotate3d(1,0,0,90deg);transition-timing-function:ease-in;opacity:0}40%{transform:perspective(400px) rotate3d(1,0,0,-20deg);transition-timing-function:ease-in}60%{transform:perspective(400px) rotate3d(1,0,0,10deg);opacity:1}80%{transform:perspective(400px) rotate3d(1,0,0,-5deg)}100%{transform:perspective(400px)}}@-webkit-keyframes flipInX{0%{-webkit-transform:perspective(400px) rotate3d(1,0,0,90deg);-webkit-transition-timing-function:ease-in;opacity:0}40%{-webkit-transform:perspective(400px) rotate3d(1,0,0,-20deg);-webkit-transition-timing-function:ease-in}60%{-webkit-transform:perspective(400px) rotate3d(1,0,0,10deg);opacity:1}80%{-webkit-transform:perspective(400px) rotate3d(1,0,0,-5deg)}100%{-webkit-transform:perspective(400px)}}.navbar-custom-menu>.navbar-nav>li{position:relative}.navbar-custom-menu>.navbar-nav>li>.dropdown-menu{position:absolute;right:0;left:auto}@media (max-width:991px){.navbar-custom-menu>.navbar-nav{float:right}.navbar-custom-menu>.navbar-nav>li{position:static}.navbar-custom-menu>.navbar-nav>li>.dropdown-menu{position:absolute;right:5%;left:auto;border:1px solid #ddd;background:#fff}}.form-control{border-radius:0;box-shadow:none;border-color:#d2d6de}.form-control:focus{border-color:#3c8dbc;box-shadow:none}.form-control::-moz-placeholder,.form-control:-ms-input-placeholder,.form-control::-webkit-input-placeholder{color:#bbb;opacity:1}.form-control:not(select){-webkit-appearance:none;-moz-appearance:none;appearance:none}.form-group.has-success label{color:#00a65a}.form-group.has-success .form-control{border-color:#00a65a;box-shadow:none}.form-group.has-warning label{color:#f39c12}.form-group.has-warning .form-control{border-color:#f39c12;box-shadow:none}.form-group.has-error label{color:#dd4b39}.form-group.has-error .form-control{border-color:#dd4b39;box-shadow:none}.input-group .input-group-addon{border-radius:0;border-color:#d2d6de;background-color:#fff}.btn-group-vertical .btn.btn-flat:first-of-type,.btn-group-vertical .btn.btn-flat:last-of-type{border-radius:0}.icheck>label{padding-left:0}.form-control-feedback.fa{line-height:34px}.input-lg+.form-control-feedback.fa,.input-group-lg+.form-control-feedback.fa,.form-group-lg .form-control+.form-control-feedback.fa{line-height:46px}.input-sm+.form-control-feedback.fa,.input-group-sm+.form-control-feedback.fa,.form-group-sm .form-control+.form-control-feedback.fa{line-height:30px}.progress,.progress>.progress-bar{-webkit-box-shadow:none;box-shadow:none}.progress,.progress>.progress-bar,.progress .progress-bar,.progress>.progress-bar .progress-bar{border-radius:1px}.progress.sm,.progress-sm{height:10px}.progress.sm,.progress-sm,.progress.sm .progress-bar,.progress-sm .progress-bar{border-radius:1px}.progress.xs,.progress-xs{height:7px}.progress.xs,.progress-xs,.progress.xs .progress-bar,.progress-xs .progress-bar{border-radius:1px}.progress.xxs,.progress-xxs{height:3px}.progress.xxs,.progress-xxs,.progress.xxs .progress-bar,.progress-xxs .progress-bar{border-radius:1px}.progress.vertical{position:relative;width:30px;height:200px;display:inline-block;margin-right:10px}.progress.vertical>.progress-bar{width:100%;position:absolute;bottom:0}.progress.vertical.sm,.progress.vertical.progress-sm{width:20px}.progress.vertical.xs,.progress.vertical.progress-xs{width:10px}.progress.vertical.xxs,.progress.vertical.progress-xxs{width:3px}.progress-group .progress-text{font-weight:600}.progress-group .progress-number{float:right}.table tr>td .progress{margin:0}.progress-bar-light-blue,.progress-bar-primary{background-color:#3c8dbc}.progress-striped .progress-bar-light-blue,.progress-striped .progress-bar-primary{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15)25%,transparent 25%,transparent 50%,rgba(255,255,255,.15)50%,rgba(255,255,255,.15)75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15)25%,transparent 25%,transparent 50%,rgba(255,255,255,.15)50%,rgba(255,255,255,.15)75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15)25%,transparent 25%,transparent 50%,rgba(255,255,255,.15)50%,rgba(255,255,255,.15)75%,transparent 75%,transparent)}.progress-bar-green,.progress-bar-success{background-color:#00a65a}.progress-striped .progress-bar-green,.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15)25%,transparent 25%,transparent 50%,rgba(255,255,255,.15)50%,rgba(255,255,255,.15)75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15)25%,transparent 25%,transparent 50%,rgba(255,255,255,.15)50%,rgba(255,255,255,.15)75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15)25%,transparent 25%,transparent 50%,rgba(255,255,255,.15)50%,rgba(255,255,255,.15)75%,transparent 75%,transparent)}.progress-bar-aqua,.progress-bar-info{background-color:#00c0ef}.progress-striped .progress-bar-aqua,.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15)25%,transparent 25%,transparent 50%,rgba(255,255,255,.15)50%,rgba(255,255,255,.15)75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15)25%,transparent 25%,transparent 50%,rgba(255,255,255,.15)50%,rgba(255,255,255,.15)75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15)25%,transparent 25%,transparent 50%,rgba(255,255,255,.15)50%,rgba(255,255,255,.15)75%,transparent 75%,transparent)}.progress-bar-yellow,.progress-bar-warning{background-color:#f39c12}.progress-striped .progress-bar-yellow,.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15)25%,transparent 25%,transparent 50%,rgba(255,255,255,.15)50%,rgba(255,255,255,.15)75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15)25%,transparent 25%,transparent 50%,rgba(255,255,255,.15)50%,rgba(255,255,255,.15)75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15)25%,transparent 25%,transparent 50%,rgba(255,255,255,.15)50%,rgba(255,255,255,.15)75%,transparent 75%,transparent)}.progress-bar-red,.progress-bar-danger{background-color:#dd4b39}.progress-striped .progress-bar-red,.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15)25%,transparent 25%,transparent 50%,rgba(255,255,255,.15)50%,rgba(255,255,255,.15)75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15)25%,transparent 25%,transparent 50%,rgba(255,255,255,.15)50%,rgba(255,255,255,.15)75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15)25%,transparent 25%,transparent 50%,rgba(255,255,255,.15)50%,rgba(255,255,255,.15)75%,transparent 75%,transparent)}.small-box{border-radius:2px;position:relative;display:block;margin-bottom:20px;box-shadow:0 1px 1px rgba(0,0,0,.1)}.small-box>.inner{padding:10px}.small-box>.small-box-footer{position:relative;text-align:center;padding:3px 0;color:#fff;color:rgba(255,255,255,.8);display:block;z-index:10;background:rgba(0,0,0,.1);text-decoration:none}.small-box>.small-box-footer:hover{color:#fff;background:rgba(0,0,0,.15)}.small-box h3{font-size:38px;font-weight:700;margin:0 0 10px;white-space:nowrap;padding:0}.small-box p{font-size:15px}.small-box p>small{display:block;color:#f9f9f9;font-size:13px;margin-top:5px}.small-box h3,.small-box p{z-index:5px}.small-box .icon{-webkit-transition:all .3s linear;-o-transition:all .3s linear;transition:all .3s linear;position:absolute;top:-10px;right:10px;z-index:0;font-size:90px;color:rgba(0,0,0,.15)}.small-box:hover{text-decoration:none;color:#f9f9f9}.small-box:hover .icon{font-size:95px}@media (max-width:767px){.small-box{text-align:center}.small-box .icon{display:none}.small-box p{font-size:12px}}.box{position:relative;border-radius:3px;background:#fff;border-top:3px solid #d2d6de;margin-bottom:20px;width:100%;box-shadow:0 1px 1px rgba(0,0,0,.1)}.box.box-primary{border-top-color:#3c8dbc}.box.box-info{border-top-color:#00c0ef}.box.box-danger{border-top-color:#dd4b39}.box.box-warning{border-top-color:#f39c12}.box.box-success{border-top-color:#00a65a}.box.box-default{border-top-color:#d2d6de}.box.collapsed-box .box-body,.box.collapsed-box .box-footer{display:none}.box .nav-stacked>li{border-bottom:1px solid #f4f4f4;margin:0}.box .nav-stacked>li:last-of-type{border-bottom:none}.box.height-control .box-body{max-height:300px;overflow:auto}.box .border-right{border-right:1px solid #f4f4f4}.box .border-left{border-left:1px solid #f4f4f4}.box.box-solid{border-top:0}.box.box-solid>.box-header .btn.btn-default{background:0 0}.box.box-solid>.box-header .btn:hover,.box.box-solid>.box-header a:hover{background:rgba(0,0,0,.1)}.box.box-solid.box-default{border:1px solid #d2d6de}.box.box-solid.box-default>.box-header{color:#444;background:#d2d6de;background-color:#d2d6de}.box.box-solid.box-default>.box-header a,.box.box-solid.box-default>.box-header .btn{color:#444}.box.box-solid.box-primary{border:1px solid #3c8dbc}.box.box-solid.box-primary>.box-header{color:#fff;background:#3c8dbc;background-color:#3c8dbc}.box.box-solid.box-primary>.box-header a,.box.box-solid.box-primary>.box-header .btn{color:#fff}.box.box-solid.box-info{border:1px solid #00c0ef}.box.box-solid.box-info>.box-header{color:#fff;background:#00c0ef;background-color:#00c0ef}.box.box-solid.box-info>.box-header a,.box.box-solid.box-info>.box-header .btn{color:#fff}.box.box-solid.box-danger{border:1px solid #dd4b39}.box.box-solid.box-danger>.box-header{color:#fff;background:#dd4b39;background-color:#dd4b39}.box.box-solid.box-danger>.box-header a,.box.box-solid.box-danger>.box-header .btn{color:#fff}.box.box-solid.box-warning{border:1px solid #f39c12}.box.box-solid.box-warning>.box-header{color:#fff;background:#f39c12;background-color:#f39c12}.box.box-solid.box-warning>.box-header a,.box.box-solid.box-warning>.box-header .btn{color:#fff}.box.box-solid.box-success{border:1px solid #00a65a}.box.box-solid.box-success>.box-header{color:#fff;background:#00a65a;background-color:#00a65a}.box.box-solid.box-success>.box-header a,.box.box-solid.box-success>.box-header .btn{color:#fff}.box.box-solid>.box-header>.box-tools .btn{border:0;box-shadow:none}.box.box-solid[class*=bg]>.box-header{color:#fff}.box .box-group>.box{margin-bottom:5px}.box .knob-label{text-align:center;color:#333;font-weight:100;font-size:12px;margin-bottom:.3em}.box>.overlay,.overlay-wrapper>.overlay,.box>.loading-img,.overlay-wrapper>.loading-img{position:absolute;top:0;left:0;width:100%;height:100%}.box .overlay,.overlay-wrapper .overlay{z-index:50;background:rgba(255,255,255,.7);border-radius:3px}.box .overlay>.fa,.overlay-wrapper .overlay>.fa{position:absolute;top:50%;left:50%;margin-left:-15px;margin-top:-15px;color:#000;font-size:30px}.box .overlay.dark,.overlay-wrapper .overlay.dark{background:rgba(0,0,0,.5)}.box-header:before,.box-body:before,.box-footer:before,.box-header:after,.box-body:after,.box-footer:after{content:" ";display:table}.box-header:after,.box-body:after,.box-footer:after{clear:both}.box-header{color:#444;display:block;padding:10px;position:relative}.box-header.with-border{border-bottom:1px solid #f4f4f4}.collapsed-box .box-header.with-border{border-bottom:none}.box-header>.fa,.box-header>.glyphicon,.box-header>.ion,.box-header .box-title{display:inline-block;font-size:18px;margin:0;line-height:1}.box-header>.fa,.box-header>.glyphicon,.box-header>.ion{margin-right:5px}.box-header>.box-tools{position:absolute;right:10px;top:5px}.box-header>.box-tools [data-toggle=tooltip]{position:relative}.box-header>.box-tools.pull-right .dropdown-menu{right:0;left:auto}.btn-box-tool{padding:5px;font-size:12px;background:0 0;color:#97a0b3}.open .btn-box-tool,.btn-box-tool:hover{color:#606c84}.btn-box-tool.btn:active{box-shadow:none}.box-body{border-top-left-radius:0;border-top-right-radius:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px;padding:10px}.no-header .box-body{border-top-right-radius:3px;border-top-left-radius:3px}.box-body>.table{margin-bottom:0}.box-body .fc{margin-top:5px}.box-body .full-width-chart{margin:-19px}.box-body.no-padding .full-width-chart{margin:-9px}.box-body .box-pane{border-top-left-radius:0;border-top-right-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:3px}.box-body .box-pane-right{border-top-left-radius:0;border-top-right-radius:0;border-bottom-right-radius:3px;border-bottom-left-radius:0}.box-footer{border-top-left-radius:0;border-top-right-radius:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px;border-top:1px solid #f4f4f4;padding:10px;background-color:#fff}.chart-legend{margin:10px 0}@media (max-width:991px){.chart-legend>li{float:left;margin-right:10px}}.box-comments{background:#f7f7f7}.box-comments .box-comment{padding:8px 0;border-bottom:1px solid #eee}.box-comments .box-comment:before,.box-comments .box-comment:after{content:" ";display:table}.box-comments .box-comment:after{clear:both}.box-comments .box-comment:last-of-type{border-bottom:0}.box-comments .box-comment:first-of-type{padding-top:0}.box-comments .box-comment img{float:left}.box-comments .comment-text{margin-left:40px;color:#555}.box-comments .username{color:#444;display:block;font-weight:600}.box-comments .text-muted{font-weight:400;font-size:12px}.todo-list{margin:0;padding:0;list-style:none;overflow:auto}.todo-list>li{border-radius:2px;padding:10px;background:#f4f4f4;margin-bottom:2px;border-left:2px solid #e6e7e8;color:#444}.todo-list>li:last-of-type{margin-bottom:0}.todo-list>li>input[type=checkbox]{margin:0 10px 0 5px}.todo-list>li .text{display:inline-block;margin-left:5px;font-weight:600}.todo-list>li .label{margin-left:10px;font-size:9px}.todo-list>li .tools{display:none;float:right;color:#dd4b39}.todo-list>li .tools>.fa,.todo-list>li .tools>.glyphicon,.todo-list>li .tools>.ion{margin-right:5px;cursor:pointer}.todo-list>li:hover .tools{display:inline-block}.todo-list>li.done{color:#999}.todo-list>li.done .text{text-decoration:line-through;font-weight:500}.todo-list>li.done .label{background:#d2d6de!important}.todo-list .danger{border-left-color:#dd4b39}.todo-list .warning{border-left-color:#f39c12}.todo-list .info{border-left-color:#00c0ef}.todo-list .success{border-left-color:#00a65a}.todo-list .primary{border-left-color:#3c8dbc}.todo-list .handle{display:inline-block;cursor:move;margin:0 5px}.chat{padding:5px 20px 5px 10px}.chat .item{margin-bottom:10px}.chat .item:before,.chat .item:after{content:" ";display:table}.chat .item:after{clear:both}.chat .item>img{width:40px;height:40px;border:2px solid transparent;border-radius:50%}.chat .item>.online{border:2px solid #00a65a}.chat .item>.offline{border:2px solid #dd4b39}.chat .item>.message{margin-left:55px;margin-top:-40px}.chat .item>.message>.name{display:block;font-weight:600}.chat .item>.attachment{border-radius:3px;background:#f4f4f4;margin-left:65px;margin-right:15px;padding:10px}.chat .item>.attachment>h4{margin:0 0 5px;font-weight:600;font-size:14px}.chat .item>.attachment>p,.chat .item>.attachment>.filename{font-weight:600;font-size:13px;font-style:italic;margin:0}.chat .item>.attachment:before,.chat .item>.attachment:after{content:" ";display:table}.chat .item>.attachment:after{clear:both}.box-input{max-width:200px}.modal .panel-body{color:#444}.info-box{display:block;min-height:90px;background:#fff;width:100%;box-shadow:0 1px 1px rgba(0,0,0,.1);border-radius:2px;margin-bottom:15px}.info-box small{font-size:14px}.info-box .progress{background:rgba(0,0,0,.2);margin:5px -10px 5px -10px;height:2px}.info-box .progress,.info-box .progress .progress-bar{border-radius:0}.info-box .progress .progress-bar{background:#fff}.info-box-icon{border-top-left-radius:2px;border-top-right-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:2px;display:block;float:left;height:90px;width:90px;text-align:center;font-size:45px;line-height:90px;background:rgba(0,0,0,.2)}.info-box-icon>img{max-width:100%}.info-box-content{padding:5px 10px;margin-left:90px}.info-box-number{display:block;font-weight:700;font-size:18px}.progress-description,.info-box-text{display:block;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.info-box-text{text-transform:uppercase}.info-box-more{display:block}.progress-description{margin:0}.timeline{position:relative;margin:0 0 30px;padding:0;list-style:none}.timeline:before{content:'';position:absolute;top:0;bottom:0;width:4px;background:#ddd;left:31px;margin:0;border-radius:2px}.timeline>li{position:relative;margin-right:10px;margin-bottom:15px}.timeline>li:before,.timeline>li:after{content:" ";display:table}.timeline>li:after{clear:both}.timeline>li>.timeline-item{-webkit-box-shadow:0 1px 1px rgba(0,0,0,.1);box-shadow:0 1px 1px rgba(0,0,0,.1);border-radius:3px;margin-top:0;background:#fff;color:#444;margin-left:60px;margin-right:15px;padding:0;position:relative}.timeline>li>.timeline-item>.time{color:#999;float:right;padding:10px;font-size:12px}.timeline>li>.timeline-item>.timeline-header{margin:0;color:#555;border-bottom:1px solid #f4f4f4;padding:10px;font-size:16px;line-height:1.1}.timeline>li>.timeline-item>.timeline-header>a{font-weight:600}.timeline>li>.timeline-item>.timeline-body,.timeline>li>.timeline-item>.timeline-footer{padding:10px}.timeline>li>.fa,.timeline>li>.glyphicon,.timeline>li>.ion{width:30px;height:30px;font-size:15px;line-height:30px;position:absolute;color:#666;background:#d2d6de;border-radius:50%;text-align:center;left:18px;top:0}.timeline>.time-label>span{font-weight:600;padding:5px;display:inline-block;background-color:#fff;border-radius:4px}.timeline-inverse>li>.timeline-item{background:#f0f0f0;border:1px solid #ddd;-webkit-box-shadow:none;box-shadow:none}.timeline-inverse>li>.timeline-item>.timeline-header{border-bottom-color:#ddd}.btn{border-radius:3px;-webkit-box-shadow:none;box-shadow:none;border:1px solid transparent}.btn.uppercase{text-transform:uppercase}.btn.btn-flat{border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;border-width:1px}.btn:active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);-moz-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn:focus{outline:0}.btn.btn-file{position:relative;overflow:hidden}.btn.btn-file>input[type=file]{position:absolute;top:0;right:0;min-width:100%;min-height:100%;font-size:100px;text-align:right;opacity:0;filter:alpha(opacity=0);outline:0;background:#fff;cursor:inherit;display:block}.btn-default{background-color:#f4f4f4;color:#444;border-color:#ddd}.btn-default:hover,.btn-default:active,.btn-default.hover{background-color:#e7e7e7}.btn-primary{background-color:#3c8dbc;border-color:#367fa9}.btn-primary:hover,.btn-primary:active,.btn-primary.hover{background-color:#367fa9}.btn-success{background-color:#00a65a;border-color:#008d4c}.btn-success:hover,.btn-success:active,.btn-success.hover{background-color:#008d4c}.btn-info{background-color:#00c0ef;border-color:#00acd6}.btn-info:hover,.btn-info:active,.btn-info.hover{background-color:#00acd6}.btn-danger{background-color:#dd4b39;border-color:#d73925}.btn-danger:hover,.btn-danger:active,.btn-danger.hover{background-color:#d73925}.btn-warning{background-color:#f39c12;border-color:#e08e0b}.btn-warning:hover,.btn-warning:active,.btn-warning.hover{background-color:#e08e0b}.btn-outline{border:1px solid #fff;background:0 0;color:#fff}.btn-outline:hover,.btn-outline:focus,.btn-outline:active{color:rgba(255,255,255,.7);border-color:rgba(255,255,255,.7)}.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn[class*=bg-]:hover{-webkit-box-shadow:inset 0 0 100px rgba(0,0,0,.2);box-shadow:inset 0 0 100px rgba(0,0,0,.2)}.btn-app{border-radius:3px;position:relative;padding:15px 5px;margin:0 0 10px 10px;min-width:80px;height:60px;text-align:center;color:#666;border:1px solid #ddd;background-color:#f4f4f4;font-size:12px}.btn-app>.fa,.btn-app>.glyphicon,.btn-app>.ion{font-size:20px;display:block}.btn-app:hover{background:#f4f4f4;color:#444;border-color:#aaa}.btn-app:active,.btn-app:focus{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);-moz-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-app>.badge{position:absolute;top:-3px;right:-10px;font-size:10px;font-weight:400}.callout{border-radius:3px;margin:0 0 20px;padding:15px 30px 15px 15px;border-left:5px solid #eee}.callout a{color:#fff;text-decoration:underline}.callout a:hover{color:#eee}.callout h4{margin-top:0;font-weight:600}.callout p:last-child{margin-bottom:0}.callout code,.callout .highlight{background-color:#fff}.callout.callout-danger{border-color:#c23321}.callout.callout-warning{border-color:#c87f0a}.callout.callout-info{border-color:#0097bc}.callout.callout-success{border-color:#00733e}.alert{border-radius:3px}.alert h4{font-weight:600}.alert .icon{margin-right:10px}.alert .close{color:#000;opacity:.2;filter:alpha(opacity=20)}.alert .close:hover{opacity:.5;filter:alpha(opacity=50)}.alert a{color:#fff;text-decoration:underline}.alert-success{border-color:#008d4c}.alert-danger,.alert-error{border-color:#d73925}.alert-warning{border-color:#e08e0b}.alert-info{border-color:#00acd6}.nav>li>a:hover,.nav>li>a:active,.nav>li>a:focus{color:#444;background:#f7f7f7}.nav-pills>li>a{border-radius:0;border-top:3px solid transparent;color:#444}.nav-pills>li>a>.fa,.nav-pills>li>a>.glyphicon,.nav-pills>li>a>.ion{margin-right:5px}.nav-pills>li.active>a,.nav-pills>li.active>a:hover,.nav-pills>li.active>a:focus{border-top-color:#3c8dbc}.nav-pills>li.active>a{font-weight:600}.nav-stacked>li>a{border-radius:0;border-top:0;border-left:3px solid transparent;color:#444}.nav-stacked>li.active>a,.nav-stacked>li.active>a:hover{background:0 0;color:#444;border-top:0;border-left-color:#3c8dbc}.nav-stacked>li.header{border-bottom:1px solid #ddd;color:#777;margin-bottom:10px;padding:5px 10px;text-transform:uppercase}.nav-tabs-custom{margin-bottom:20px;background:#fff;box-shadow:0 1px 1px rgba(0,0,0,.1);border-radius:3px}.nav-tabs-custom>.nav-tabs{margin:0;border-bottom-color:#f4f4f4;border-top-right-radius:3px;border-top-left-radius:3px}.nav-tabs-custom>.nav-tabs>li{border-top:3px solid transparent;margin-bottom:-2px;margin-right:5px}.nav-tabs-custom>.nav-tabs>li>a{color:#444;border-radius:0}.nav-tabs-custom>.nav-tabs>li>a.text-muted{color:#999}.nav-tabs-custom>.nav-tabs>li>a,.nav-tabs-custom>.nav-tabs>li>a:hover{background:0 0;margin:0}.nav-tabs-custom>.nav-tabs>li>a:hover{color:#999}.nav-tabs-custom>.nav-tabs>li:not(.active)>a:hover,.nav-tabs-custom>.nav-tabs>li:not(.active)>a:focus,.nav-tabs-custom>.nav-tabs>li:not(.active)>a:active{border-color:transparent}.nav-tabs-custom>.nav-tabs>li.active{border-top-color:#3c8dbc}.nav-tabs-custom>.nav-tabs>li.active>a,.nav-tabs-custom>.nav-tabs>li.active:hover>a{background-color:#fff;color:#444}.nav-tabs-custom>.nav-tabs>li.active>a{border-top-color:transparent;border-left-color:#f4f4f4;border-right-color:#f4f4f4}.nav-tabs-custom>.nav-tabs>li:first-of-type{margin-left:0}.nav-tabs-custom>.nav-tabs>li:first-of-type.active>a{border-left-color:transparent}.nav-tabs-custom>.nav-tabs.pull-right{float:none!important}.nav-tabs-custom>.nav-tabs.pull-right>li{float:right}.nav-tabs-custom>.nav-tabs.pull-right>li:first-of-type{margin-right:0}.nav-tabs-custom>.nav-tabs.pull-right>li:first-of-type>a{border-left-width:1px}.nav-tabs-custom>.nav-tabs.pull-right>li:first-of-type.active>a{border-left-color:#f4f4f4;border-right-color:transparent}.nav-tabs-custom>.nav-tabs>li.header{line-height:35px;padding:0 10px;font-size:20px;color:#444}.nav-tabs-custom>.nav-tabs>li.header>.fa,.nav-tabs-custom>.nav-tabs>li.header>.glyphicon,.nav-tabs-custom>.nav-tabs>li.header>.ion{margin-right:5px}.nav-tabs-custom>.tab-content{background:#fff;padding:10px;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.nav-tabs-custom .dropdown.open>a:active,.nav-tabs-custom .dropdown.open>a:focus{background:0 0;color:#999}.nav-tabs-custom.tab-primary>.nav-tabs>li.active{border-top-color:#3c8dbc}.nav-tabs-custom.tab-info>.nav-tabs>li.active{border-top-color:#00c0ef}.nav-tabs-custom.tab-danger>.nav-tabs>li.active{border-top-color:#dd4b39}.nav-tabs-custom.tab-warning>.nav-tabs>li.active{border-top-color:#f39c12}.nav-tabs-custom.tab-success>.nav-tabs>li.active{border-top-color:#00a65a}.nav-tabs-custom.tab-default>.nav-tabs>li.active{border-top-color:#d2d6de}.pagination>li>a{background:#fafafa;color:#666}.pagination.pagination-flat>li>a{border-radius:0!important}.products-list{list-style:none;margin:0;padding:0}.products-list>.item{border-radius:3px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.1);box-shadow:0 1px 1px rgba(0,0,0,.1);padding:10px 0;background:#fff}.products-list>.item:before,.products-list>.item:after{content:" ";display:table}.products-list>.item:after{clear:both}.products-list .product-img{float:left}.products-list .product-img img{width:50px;height:50px}.products-list .product-info{margin-left:60px}.products-list .product-title{font-weight:600}.products-list .product-description{display:block;color:#999;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.product-list-in-box>.item{-webkit-box-shadow:none;box-shadow:none;border-radius:0;border-bottom:1px solid #f4f4f4}.product-list-in-box>.item:last-of-type{border-bottom-width:0}.table>thead>tr>th,.table>tbody>tr>th,.table>tfoot>tr>th,.table>thead>tr>td,.table>tbody>tr>td,.table>tfoot>tr>td{border-top:1px solid #f4f4f4}.table>thead>tr>th{border-bottom:2px solid #f4f4f4}.table tr td .progress{margin-top:5px}.table-bordered{border:1px solid #f4f4f4}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #f4f4f4}.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px}.table.no-border,.table.no-border td,.table.no-border th{border:0}table.text-center,table.text-center td,table.text-center th{text-align:center}.table.align th{text-align:left}.table.align td{text-align:right}.label-default{background-color:#d2d6de;color:#444}.direct-chat .box-body{border-bottom-right-radius:0;border-bottom-left-radius:0;position:relative;overflow-x:hidden;padding:0}.direct-chat.chat-pane-open .direct-chat-contacts{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}.direct-chat-messages{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0);padding:10px;height:250px;overflow:auto}.direct-chat-msg,.direct-chat-text{display:block}.direct-chat-msg{margin-bottom:10px}.direct-chat-msg:before,.direct-chat-msg:after{content:" ";display:table}.direct-chat-msg:after{clear:both}.direct-chat-messages,.direct-chat-contacts{-webkit-transition:-webkit-transform .5s ease-in-out;-moz-transition:-moz-transform .5s ease-in-out;-o-transition:-o-transform .5s ease-in-out;transition:transform .5s ease-in-out}.direct-chat-text{border-radius:5px;position:relative;padding:5px 10px;background:#d2d6de;border:1px solid #d2d6de;margin:5px 0 0 50px;color:#444}.direct-chat-text:after,.direct-chat-text:before{position:absolute;right:100%;top:15px;border:solid transparent;border-right-color:#d2d6de;content:' ';height:0;width:0;pointer-events:none}.direct-chat-text:after{border-width:5px;margin-top:-5px}.direct-chat-text:before{border-width:6px;margin-top:-6px}.right .direct-chat-text{margin-right:50px;margin-left:0}.right .direct-chat-text:after,.right .direct-chat-text:before{right:auto;left:100%;border-right-color:transparent;border-left-color:#d2d6de}.direct-chat-img{border-radius:50%;float:left;width:40px;height:40px}.right .direct-chat-img{float:right}.direct-chat-info{display:block;margin-bottom:2px;font-size:12px}.direct-chat-name{font-weight:600}.direct-chat-timestamp{color:#999}.direct-chat-contacts-open .direct-chat-contacts{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}.direct-chat-contacts{-webkit-transform:translate(101%,0);-ms-transform:translate(101%,0);-o-transform:translate(101%,0);transform:translate(101%,0);position:absolute;top:0;bottom:0;height:250px;width:100%;background:#222d32;color:#fff;overflow:auto}.contacts-list>li{border-bottom:1px solid rgba(0,0,0,.2);padding:10px;margin:0}.contacts-list>li:before,.contacts-list>li:after{content:" ";display:table}.contacts-list>li:after{clear:both}.contacts-list>li:last-of-type{border-bottom:none}.contacts-list-img{border-radius:50%;width:40px;float:left}.contacts-list-info{margin-left:45px;color:#fff}.contacts-list-name,.contacts-list-status{display:block}.contacts-list-name{font-weight:600}.contacts-list-status{font-size:12px}.contacts-list-date{color:#aaa;font-weight:400}.contacts-list-msg{color:#999}.direct-chat-danger .right>.direct-chat-text{background:#dd4b39;border-color:#dd4b39;color:#fff}.direct-chat-danger .right>.direct-chat-text:after,.direct-chat-danger .right>.direct-chat-text:before{border-left-color:#dd4b39}.direct-chat-primary .right>.direct-chat-text{background:#3c8dbc;border-color:#3c8dbc;color:#fff}.direct-chat-primary .right>.direct-chat-text:after,.direct-chat-primary .right>.direct-chat-text:before{border-left-color:#3c8dbc}.direct-chat-warning .right>.direct-chat-text{background:#f39c12;border-color:#f39c12;color:#fff}.direct-chat-warning .right>.direct-chat-text:after,.direct-chat-warning .right>.direct-chat-text:before{border-left-color:#f39c12}.direct-chat-info .right>.direct-chat-text{background:#00c0ef;border-color:#00c0ef;color:#fff}.direct-chat-info .right>.direct-chat-text:after,.direct-chat-info .right>.direct-chat-text:before{border-left-color:#00c0ef}.direct-chat-success .right>.direct-chat-text{background:#00a65a;border-color:#00a65a;color:#fff}.direct-chat-success .right>.direct-chat-text:after,.direct-chat-success .right>.direct-chat-text:before{border-left-color:#00a65a}.users-list>li{width:25%;float:left;padding:10px;text-align:center}.users-list>li img{border-radius:50%;max-width:100%;height:auto}.users-list>li>a:hover,.users-list>li>a:hover .users-list-name{color:#999}.users-list-name,.users-list-date{display:block}.users-list-name{font-weight:600;color:#444;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.users-list-date{color:#999;font-size:12px}.carousel-control.left,.carousel-control.right{background-image:none}.carousel-control>.fa{font-size:40px;position:absolute;top:50%;z-index:5;display:inline-block;margin-top:-20px}.modal{background:rgba(0,0,0,.3)}.modal-content{border-radius:0;-webkit-box-shadow:0 2px 3px rgba(0,0,0,.125);box-shadow:0 2px 3px rgba(0,0,0,.125);border:0}@media (min-width:768px){.modal-content{-webkit-box-shadow:0 2px 3px rgba(0,0,0,.125);box-shadow:0 2px 3px rgba(0,0,0,.125)}}.modal-header{border-bottom-color:#f4f4f4}.modal-footer{border-top-color:#f4f4f4}.modal-primary .modal-header,.modal-primary .modal-footer{border-color:#307095}.modal-warning .modal-header,.modal-warning .modal-footer{border-color:#c87f0a}.modal-info .modal-header,.modal-info .modal-footer{border-color:#0097bc}.modal-success .modal-header,.modal-success .modal-footer{border-color:#00733e}.modal-danger .modal-header,.modal-danger .modal-footer{border-color:#c23321}.box-widget{border:none;position:relative}.widget-user .widget-user-header{padding:20px;height:120px;border-top-right-radius:3px;border-top-left-radius:3px}.widget-user .widget-user-username{margin-top:0;margin-bottom:5px;font-size:25px;font-weight:300;text-shadow:0 1px 1px rgba(0,0,0,.2)}.widget-user .widget-user-desc{margin-top:0}.widget-user .widget-user-image{position:absolute;top:65px;left:50%;margin-left:-45px}.widget-user .widget-user-image>img{width:90px;height:auto;border:3px solid #fff}.widget-user .box-footer{padding-top:30px}.widget-user-2 .widget-user-header{padding:20px;border-top-right-radius:3px;border-top-left-radius:3px}.widget-user-2 .widget-user-username{margin-top:5px;margin-bottom:5px;font-size:25px;font-weight:300}.widget-user-2 .widget-user-desc{margin-top:0}.widget-user-2 .widget-user-username,.widget-user-2 .widget-user-desc{margin-left:75px}.widget-user-2 .widget-user-image>img{width:65px;height:auto;float:left}.mailbox-messages>.table{margin:0}.mailbox-controls{padding:5px}.mailbox-controls.with-border{border-bottom:1px solid #f4f4f4}.mailbox-read-info{border-bottom:1px solid #f4f4f4;padding:10px}.mailbox-read-info h3{font-size:20px;margin:0}.mailbox-read-info h5{margin:0;padding:5px 0 0}.mailbox-read-time{color:#999;font-size:13px}.mailbox-read-message{padding:10px}.mailbox-attachments li{float:left;width:200px;border:1px solid #eee;margin-bottom:10px;margin-right:10px}.mailbox-attachment-name{font-weight:700;color:#666}.mailbox-attachment-icon,.mailbox-attachment-info,.mailbox-attachment-size{display:block}.mailbox-attachment-info{padding:10px;background:#f4f4f4}.mailbox-attachment-size{color:#999;font-size:12px}.mailbox-attachment-icon{text-align:center;font-size:65px;color:#666;padding:20px 10px}.mailbox-attachment-icon.has-img{padding:0}.mailbox-attachment-icon.has-img>img{max-width:100%;height:auto}.lockscreen{background:#d2d6de}.lockscreen-logo{font-size:35px;text-align:center;margin-bottom:25px;font-weight:300}.lockscreen-logo a{color:#444}.lockscreen-wrapper{max-width:400px;margin:0 auto;margin-top:10%}.lockscreen .lockscreen-name{text-align:center;font-weight:600}.lockscreen-item{border-radius:4px;padding:0;background:#fff;position:relative;margin:10px auto 30px;width:290px}.lockscreen-image{border-radius:50%;position:absolute;left:-10px;top:-25px;background:#fff;padding:5px;z-index:10}.lockscreen-image>img{border-radius:50%;width:70px;height:70px}.lockscreen-credentials{margin-left:70px}.lockscreen-credentials .form-control{border:0}.lockscreen-credentials .btn{background-color:#fff;border:0;padding:0 10px}.lockscreen-footer{margin-top:10px}.login-logo,.register-logo{font-size:35px;text-align:center;margin-bottom:25px;font-weight:300}.login-logo a,.register-logo a{color:#444}.login-page,.register-page{background:#d2d6de}.login-box,.register-box{width:360px;margin:7% auto}@media (max-width:768px){.login-box,.register-box{width:90%;margin-top:20px}}.login-box-body,.register-box-body{background:#fff;padding:20px;border-top:0;color:#666}.login-box-body .form-control-feedback,.register-box-body .form-control-feedback{color:#777}.login-box-msg,.register-box-msg{margin:0;text-align:center;padding:0 20px 20px}.social-auth-links{margin:10px 0}.error-page{width:600px;margin:20px auto 0}@media (max-width:991px){.error-page{width:100%}}.error-page>.headline{float:left;font-size:100px;font-weight:300}@media (max-width:991px){.error-page>.headline{float:none;text-align:center}}.error-page>.error-content{margin-left:190px;display:block}@media (max-width:991px){.error-page>.error-content{margin-left:0}}.error-page>.error-content>h3{font-weight:300;font-size:25px}@media (max-width:991px){.error-page>.error-content>h3{text-align:center}}.invoice{position:relative;background:#fff;border:1px solid #f4f4f4;padding:20px;margin:10px 25px}.invoice-title{margin-top:0}.profile-user-img{margin:0 auto;width:100px;padding:3px;border:3px solid #d2d6de}.profile-username{font-size:21px;margin-top:5px}.post{border-bottom:1px solid #d2d6de;margin-bottom:15px;padding-bottom:15px;color:#666}.post:last-of-type{border-bottom:0;margin-bottom:0;padding-bottom:0}.post .user-block{margin-bottom:15px}.btn-social{position:relative;padding-left:44px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.btn-social>:first-child{position:absolute;left:0;top:0;bottom:0;width:32px;line-height:34px;font-size:1.6em;text-align:center;border-right:1px solid rgba(0,0,0,.2)}.btn-social.btn-lg{padding-left:61px}.btn-social.btn-lg>:first-child{line-height:45px;width:45px;font-size:1.8em}.btn-social.btn-sm{padding-left:38px}.btn-social.btn-sm>:first-child{line-height:28px;width:28px;font-size:1.4em}.btn-social.btn-xs{padding-left:30px}.btn-social.btn-xs>:first-child{line-height:20px;width:20px;font-size:1.2em}.btn-social-icon{position:relative;padding-left:44px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;height:34px;width:34px;padding:0}.btn-social-icon>:first-child{position:absolute;left:0;top:0;bottom:0;width:32px;line-height:34px;font-size:1.6em;text-align:center;border-right:1px solid rgba(0,0,0,.2)}.btn-social-icon.btn-lg{padding-left:61px}.btn-social-icon.btn-lg>:first-child{line-height:45px;width:45px;font-size:1.8em}.btn-social-icon.btn-sm{padding-left:38px}.btn-social-icon.btn-sm>:first-child{line-height:28px;width:28px;font-size:1.4em}.btn-social-icon.btn-xs{padding-left:30px}.btn-social-icon.btn-xs>:first-child{line-height:20px;width:20px;font-size:1.2em}.btn-social-icon>:first-child{border:none;text-align:center;width:100%}.btn-social-icon.btn-lg{height:45px;width:45px;padding-left:0;padding-right:0}.btn-social-icon.btn-sm{height:30px;width:30px;padding-left:0;padding-right:0}.btn-social-icon.btn-xs{height:22px;width:22px;padding-left:0;padding-right:0}.btn-adn{color:#fff;background-color:#d87a68;border-color:rgba(0,0,0,.2)}.btn-adn:focus,.btn-adn.focus{color:#fff;background-color:#ce563f;border-color:rgba(0,0,0,.2)}.btn-adn:hover{color:#fff;background-color:#ce563f;border-color:rgba(0,0,0,.2)}.btn-adn:active,.btn-adn.active,.open>.dropdown-toggle.btn-adn{color:#fff;background-color:#ce563f;border-color:rgba(0,0,0,.2)}.btn-adn:active,.btn-adn.active,.open>.dropdown-toggle.btn-adn{background-image:none}.btn-adn .badge{color:#d87a68;background-color:#fff}.btn-bitbucket{color:#fff;background-color:#205081;border-color:rgba(0,0,0,.2)}.btn-bitbucket:focus,.btn-bitbucket.focus{color:#fff;background-color:#163758;border-color:rgba(0,0,0,.2)}.btn-bitbucket:hover{color:#fff;background-color:#163758;border-color:rgba(0,0,0,.2)}.btn-bitbucket:active,.btn-bitbucket.active,.open>.dropdown-toggle.btn-bitbucket{color:#fff;background-color:#163758;border-color:rgba(0,0,0,.2)}.btn-bitbucket:active,.btn-bitbucket.active,.open>.dropdown-toggle.btn-bitbucket{background-image:none}.btn-bitbucket .badge{color:#205081;background-color:#fff}.btn-dropbox{color:#fff;background-color:#1087dd;border-color:rgba(0,0,0,.2)}.btn-dropbox:focus,.btn-dropbox.focus{color:#fff;background-color:#0d6aad;border-color:rgba(0,0,0,.2)}.btn-dropbox:hover{color:#fff;background-color:#0d6aad;border-color:rgba(0,0,0,.2)}.btn-dropbox:active,.btn-dropbox.active,.open>.dropdown-toggle.btn-dropbox{color:#fff;background-color:#0d6aad;border-color:rgba(0,0,0,.2)}.btn-dropbox:active,.btn-dropbox.active,.open>.dropdown-toggle.btn-dropbox{background-image:none}.btn-dropbox .badge{color:#1087dd;background-color:#fff}.btn-facebook{color:#fff;background-color:#3b5998;border-color:rgba(0,0,0,.2)}.btn-facebook:focus,.btn-facebook.focus{color:#fff;background-color:#2d4373;border-color:rgba(0,0,0,.2)}.btn-facebook:hover{color:#fff;background-color:#2d4373;border-color:rgba(0,0,0,.2)}.btn-facebook:active,.btn-facebook.active,.open>.dropdown-toggle.btn-facebook{color:#fff;background-color:#2d4373;border-color:rgba(0,0,0,.2)}.btn-facebook:active,.btn-facebook.active,.open>.dropdown-toggle.btn-facebook{background-image:none}.btn-facebook .badge{color:#3b5998;background-color:#fff}.btn-flickr{color:#fff;background-color:#ff0084;border-color:rgba(0,0,0,.2)}.btn-flickr:focus,.btn-flickr.focus{color:#fff;background-color:#cc006a;border-color:rgba(0,0,0,.2)}.btn-flickr:hover{color:#fff;background-color:#cc006a;border-color:rgba(0,0,0,.2)}.btn-flickr:active,.btn-flickr.active,.open>.dropdown-toggle.btn-flickr{color:#fff;background-color:#cc006a;border-color:rgba(0,0,0,.2)}.btn-flickr:active,.btn-flickr.active,.open>.dropdown-toggle.btn-flickr{background-image:none}.btn-flickr .badge{color:#ff0084;background-color:#fff}.btn-foursquare{color:#fff;background-color:#f94877;border-color:rgba(0,0,0,.2)}.btn-foursquare:focus,.btn-foursquare.focus{color:#fff;background-color:#f71752;border-color:rgba(0,0,0,.2)}.btn-foursquare:hover{color:#fff;background-color:#f71752;border-color:rgba(0,0,0,.2)}.btn-foursquare:active,.btn-foursquare.active,.open>.dropdown-toggle.btn-foursquare{color:#fff;background-color:#f71752;border-color:rgba(0,0,0,.2)}.btn-foursquare:active,.btn-foursquare.active,.open>.dropdown-toggle.btn-foursquare{background-image:none}.btn-foursquare .badge{color:#f94877;background-color:#fff}.btn-github{color:#fff;background-color:#444;border-color:rgba(0,0,0,.2)}.btn-github:focus,.btn-github.focus{color:#fff;background-color:#2b2b2b;border-color:rgba(0,0,0,.2)}.btn-github:hover{color:#fff;background-color:#2b2b2b;border-color:rgba(0,0,0,.2)}.btn-github:active,.btn-github.active,.open>.dropdown-toggle.btn-github{color:#fff;background-color:#2b2b2b;border-color:rgba(0,0,0,.2)}.btn-github:active,.btn-github.active,.open>.dropdown-toggle.btn-github{background-image:none}.btn-github .badge{color:#444;background-color:#fff}.btn-google{color:#fff;background-color:#dd4b39;border-color:rgba(0,0,0,.2)}.btn-google:focus,.btn-google.focus{color:#fff;background-color:#c23321;border-color:rgba(0,0,0,.2)}.btn-google:hover{color:#fff;background-color:#c23321;border-color:rgba(0,0,0,.2)}.btn-google:active,.btn-google.active,.open>.dropdown-toggle.btn-google{color:#fff;background-color:#c23321;border-color:rgba(0,0,0,.2)}.btn-google:active,.btn-google.active,.open>.dropdown-toggle.btn-google{background-image:none}.btn-google .badge{color:#dd4b39;background-color:#fff}.btn-instagram{color:#fff;background-color:#3f729b;border-color:rgba(0,0,0,.2)}.btn-instagram:focus,.btn-instagram.focus{color:#fff;background-color:#305777;border-color:rgba(0,0,0,.2)}.btn-instagram:hover{color:#fff;background-color:#305777;border-color:rgba(0,0,0,.2)}.btn-instagram:active,.btn-instagram.active,.open>.dropdown-toggle.btn-instagram{color:#fff;background-color:#305777;border-color:rgba(0,0,0,.2)}.btn-instagram:active,.btn-instagram.active,.open>.dropdown-toggle.btn-instagram{background-image:none}.btn-instagram .badge{color:#3f729b;background-color:#fff}.btn-linkedin{color:#fff;background-color:#007bb6;border-color:rgba(0,0,0,.2)}.btn-linkedin:focus,.btn-linkedin.focus{color:#fff;background-color:#005983;border-color:rgba(0,0,0,.2)}.btn-linkedin:hover{color:#fff;background-color:#005983;border-color:rgba(0,0,0,.2)}.btn-linkedin:active,.btn-linkedin.active,.open>.dropdown-toggle.btn-linkedin{color:#fff;background-color:#005983;border-color:rgba(0,0,0,.2)}.btn-linkedin:active,.btn-linkedin.active,.open>.dropdown-toggle.btn-linkedin{background-image:none}.btn-linkedin .badge{color:#007bb6;background-color:#fff}.btn-microsoft{color:#fff;background-color:#2672ec;border-color:rgba(0,0,0,.2)}.btn-microsoft:focus,.btn-microsoft.focus{color:#fff;background-color:#125acd;border-color:rgba(0,0,0,.2)}.btn-microsoft:hover{color:#fff;background-color:#125acd;border-color:rgba(0,0,0,.2)}.btn-microsoft:active,.btn-microsoft.active,.open>.dropdown-toggle.btn-microsoft{color:#fff;background-color:#125acd;border-color:rgba(0,0,0,.2)}.btn-microsoft:active,.btn-microsoft.active,.open>.dropdown-toggle.btn-microsoft{background-image:none}.btn-microsoft .badge{color:#2672ec;background-color:#fff}.btn-openid{color:#fff;background-color:#f7931e;border-color:rgba(0,0,0,.2)}.btn-openid:focus,.btn-openid.focus{color:#fff;background-color:#da7908;border-color:rgba(0,0,0,.2)}.btn-openid:hover{color:#fff;background-color:#da7908;border-color:rgba(0,0,0,.2)}.btn-openid:active,.btn-openid.active,.open>.dropdown-toggle.btn-openid{color:#fff;background-color:#da7908;border-color:rgba(0,0,0,.2)}.btn-openid:active,.btn-openid.active,.open>.dropdown-toggle.btn-openid{background-image:none}.btn-openid .badge{color:#f7931e;background-color:#fff}.btn-pinterest{color:#fff;background-color:#cb2027;border-color:rgba(0,0,0,.2)}.btn-pinterest:focus,.btn-pinterest.focus{color:#fff;background-color:#9f191f;border-color:rgba(0,0,0,.2)}.btn-pinterest:hover{color:#fff;background-color:#9f191f;border-color:rgba(0,0,0,.2)}.btn-pinterest:active,.btn-pinterest.active,.open>.dropdown-toggle.btn-pinterest{color:#fff;background-color:#9f191f;border-color:rgba(0,0,0,.2)}.btn-pinterest:active,.btn-pinterest.active,.open>.dropdown-toggle.btn-pinterest{background-image:none}.btn-pinterest .badge{color:#cb2027;background-color:#fff}.btn-reddit{color:#000;background-color:#eff7ff;border-color:rgba(0,0,0,.2)}.btn-reddit:focus,.btn-reddit.focus{color:#000;background-color:#bcddff;border-color:rgba(0,0,0,.2)}.btn-reddit:hover{color:#000;background-color:#bcddff;border-color:rgba(0,0,0,.2)}.btn-reddit:active,.btn-reddit.active,.open>.dropdown-toggle.btn-reddit{color:#000;background-color:#bcddff;border-color:rgba(0,0,0,.2)}.btn-reddit:active,.btn-reddit.active,.open>.dropdown-toggle.btn-reddit{background-image:none}.btn-reddit .badge{color:#eff7ff;background-color:#000}.btn-soundcloud{color:#fff;background-color:#f50;border-color:rgba(0,0,0,.2)}.btn-soundcloud:focus,.btn-soundcloud.focus{color:#fff;background-color:#c40;border-color:rgba(0,0,0,.2)}.btn-soundcloud:hover{color:#fff;background-color:#c40;border-color:rgba(0,0,0,.2)}.btn-soundcloud:active,.btn-soundcloud.active,.open>.dropdown-toggle.btn-soundcloud{color:#fff;background-color:#c40;border-color:rgba(0,0,0,.2)}.btn-soundcloud:active,.btn-soundcloud.active,.open>.dropdown-toggle.btn-soundcloud{background-image:none}.btn-soundcloud .badge{color:#f50;background-color:#fff}.btn-tumblr{color:#fff;background-color:#2c4762;border-color:rgba(0,0,0,.2)}.btn-tumblr:focus,.btn-tumblr.focus{color:#fff;background-color:#1c2d3f;border-color:rgba(0,0,0,.2)}.btn-tumblr:hover{color:#fff;background-color:#1c2d3f;border-color:rgba(0,0,0,.2)}.btn-tumblr:active,.btn-tumblr.active,.open>.dropdown-toggle.btn-tumblr{color:#fff;background-color:#1c2d3f;border-color:rgba(0,0,0,.2)}.btn-tumblr:active,.btn-tumblr.active,.open>.dropdown-toggle.btn-tumblr{background-image:none}.btn-tumblr .badge{color:#2c4762;background-color:#fff}.btn-twitter{color:#fff;background-color:#55acee;border-color:rgba(0,0,0,.2)}.btn-twitter:focus,.btn-twitter.focus{color:#fff;background-color:#2795e9;border-color:rgba(0,0,0,.2)}.btn-twitter:hover{color:#fff;background-color:#2795e9;border-color:rgba(0,0,0,.2)}.btn-twitter:active,.btn-twitter.active,.open>.dropdown-toggle.btn-twitter{color:#fff;background-color:#2795e9;border-color:rgba(0,0,0,.2)}.btn-twitter:active,.btn-twitter.active,.open>.dropdown-toggle.btn-twitter{background-image:none}.btn-twitter .badge{color:#55acee;background-color:#fff}.btn-vimeo{color:#fff;background-color:#1ab7ea;border-color:rgba(0,0,0,.2)}.btn-vimeo:focus,.btn-vimeo.focus{color:#fff;background-color:#1295bf;border-color:rgba(0,0,0,.2)}.btn-vimeo:hover{color:#fff;background-color:#1295bf;border-color:rgba(0,0,0,.2)}.btn-vimeo:active,.btn-vimeo.active,.open>.dropdown-toggle.btn-vimeo{color:#fff;background-color:#1295bf;border-color:rgba(0,0,0,.2)}.btn-vimeo:active,.btn-vimeo.active,.open>.dropdown-toggle.btn-vimeo{background-image:none}.btn-vimeo .badge{color:#1ab7ea;background-color:#fff}.btn-vk{color:#fff;background-color:#587ea3;border-color:rgba(0,0,0,.2)}.btn-vk:focus,.btn-vk.focus{color:#fff;background-color:#466482;border-color:rgba(0,0,0,.2)}.btn-vk:hover{color:#fff;background-color:#466482;border-color:rgba(0,0,0,.2)}.btn-vk:active,.btn-vk.active,.open>.dropdown-toggle.btn-vk{color:#fff;background-color:#466482;border-color:rgba(0,0,0,.2)}.btn-vk:active,.btn-vk.active,.open>.dropdown-toggle.btn-vk{background-image:none}.btn-vk .badge{color:#587ea3;background-color:#fff}.btn-yahoo{color:#fff;background-color:#720e9e;border-color:rgba(0,0,0,.2)}.btn-yahoo:focus,.btn-yahoo.focus{color:#fff;background-color:#500a6f;border-color:rgba(0,0,0,.2)}.btn-yahoo:hover{color:#fff;background-color:#500a6f;border-color:rgba(0,0,0,.2)}.btn-yahoo:active,.btn-yahoo.active,.open>.dropdown-toggle.btn-yahoo{color:#fff;background-color:#500a6f;border-color:rgba(0,0,0,.2)}.btn-yahoo:active,.btn-yahoo.active,.open>.dropdown-toggle.btn-yahoo{background-image:none}.btn-yahoo .badge{color:#720e9e;background-color:#fff}.fc-button{background:#f4f4f4;background-image:none;color:#444;border-color:#ddd;border-bottom-color:#ddd}.fc-button:hover,.fc-button:active,.fc-button.hover{background-color:#e9e9e9}.fc-header-title h2{font-size:15px;line-height:1.6em;color:#666;margin-left:10px}.fc-header-right{padding-right:10px}.fc-header-left{padding-left:10px}.fc-widget-header{background:#fafafa}.fc-grid{width:100%;border:0}.fc-widget-header:first-of-type,.fc-widget-content:first-of-type{border-left:0;border-right:0}.fc-widget-header:last-of-type,.fc-widget-content:last-of-type{border-right:0}.fc-toolbar{padding:10px;margin:0}.fc-day-number{font-size:20px;font-weight:300;padding-right:10px}.fc-color-picker{list-style:none;margin:0;padding:0}.fc-color-picker>li{float:left;font-size:30px;margin-right:5px;line-height:30px}.fc-color-picker>li .fa{-webkit-transition:-webkit-transform linear .3s;-moz-transition:-moz-transform linear .3s;-o-transition:-o-transform linear .3s;transition:transform linear .3s}.fc-color-picker>li .fa:hover{-webkit-transform:rotate(30deg);-ms-transform:rotate(30deg);-o-transform:rotate(30deg);transform:rotate(30deg)}#add-new-event{-webkit-transition:all linear .3s;-o-transition:all linear .3s;transition:all linear .3s}.external-event{padding:5px 10px;font-weight:700;margin-bottom:4px;box-shadow:0 1px 1px rgba(0,0,0,.1);text-shadow:0 1px 1px rgba(0,0,0,.1);border-radius:3px;cursor:move}.external-event:hover{box-shadow:inset 0 0 90px rgba(0,0,0,.2)}.select2-container--default.select2-container--focus,.select2-selection.select2-container--focus,.select2-container--default:focus,.select2-selection:focus,.select2-container--default:active,.select2-selection:active{outline:0}.select2-container--default .select2-selection--single,.select2-selection .select2-selection--single{border:1px solid #d2d6de;border-radius:0;padding:6px 12px;height:34px}.select2-container--default.select2-container--open{border-color:#3c8dbc}.select2-dropdown{border:1px solid #d2d6de;border-radius:0}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#3c8dbc;color:#fff}.select2-results__option{padding:6px 12px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{padding-left:0;padding-right:0;height:auto;margin-top:-4px}.select2-container[dir=rtl] .select2-selection--single .select2-selection__rendered{padding-right:6px;padding-left:20px}.select2-container--default .select2-selection--single .select2-selection__arrow{height:28px;right:3px}.select2-container--default .select2-selection--single .select2-selection__arrow b{margin-top:0}.select2-dropdown .select2-search__field,.select2-search--inline .select2-search__field{border:1px solid #d2d6de}.select2-dropdown .select2-search__field:focus,.select2-search--inline .select2-search__field:focus{outline:0;border:1px solid #3c8dbc}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option[aria-selected=true],.select2-container--default .select2-results__option[aria-selected=true]:hover{color:#444}.select2-container--default .select2-selection--multiple{border:1px solid #d2d6de;border-radius:0}.select2-container--default .select2-selection--multiple:focus{border-color:#3c8dbc}.select2-container--default.select2-container--focus .select2-selection--multiple{border-color:#d2d6de}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#3c8dbc;border-color:#367fa9;padding:1px 10px;color:#fff}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{margin-right:5px;color:rgba(255,255,255,.7)}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#fff}.select2-container .select2-selection--single .select2-selection__rendered{padding-right:10px}.pad{padding:10px}.margin{margin:10px}.margin-bottom{margin-bottom:20px}.margin-bottom-none{margin-bottom:0}.margin-r-5{margin-right:5px}.inline{display:inline}.description-block{display:block;margin:10px 0;text-align:center}.description-block.margin-bottom{margin-bottom:25px}.description-block>.description-header{margin:0;padding:0;font-weight:600;font-size:16px}.description-block>.description-text{text-transform:uppercase}.bg-red,.bg-yellow,.bg-aqua,.bg-blue,.bg-light-blue,.bg-green,.bg-navy,.bg-teal,.bg-olive,.bg-lime,.bg-orange,.bg-fuchsia,.bg-purple,.bg-maroon,.bg-black,.bg-red-active,.bg-yellow-active,.bg-aqua-active,.bg-blue-active,.bg-light-blue-active,.bg-green-active,.bg-navy-active,.bg-teal-active,.bg-olive-active,.bg-lime-active,.bg-orange-active,.bg-fuchsia-active,.bg-purple-active,.bg-maroon-active,.bg-black-active,.callout.callout-danger,.callout.callout-warning,.callout.callout-info,.callout.callout-success,.alert-success,.alert-danger,.alert-error,.alert-warning,.alert-info,.label-danger,.label-info,.label-warning,.label-primary,.label-success,.modal-primary .modal-body,.modal-primary .modal-header,.modal-primary .modal-footer,.modal-warning .modal-body,.modal-warning .modal-header,.modal-warning .modal-footer,.modal-info .modal-body,.modal-info .modal-header,.modal-info .modal-footer,.modal-success .modal-body,.modal-success .modal-header,.modal-success .modal-footer,.modal-danger .modal-body,.modal-danger .modal-header,.modal-danger .modal-footer{color:#fff!important}.bg-gray{color:#000;background-color:#d2d6de!important}.bg-gray-light{background-color:#f7f7f7}.bg-black{background-color:#111!important}.bg-red,.callout.callout-danger,.alert-danger,.alert-error,.label-danger,.modal-danger .modal-body{background-color:#dd4b39!important}.bg-yellow,.callout.callout-warning,.alert-warning,.label-warning,.modal-warning .modal-body{background-color:#f39c12!important}.bg-aqua,.callout.callout-info,.alert-info,.label-info,.modal-info .modal-body{background-color:#00c0ef!important}.bg-blue{background-color:#0073b7!important}.bg-light-blue,.label-primary,.modal-primary .modal-body{background-color:#3c8dbc!important}.bg-green,.callout.callout-success,.alert-success,.label-success,.modal-success .modal-body{background-color:#00a65a!important}.bg-navy{background-color:#001f3f!important}.bg-teal{background-color:#39cccc!important}.bg-olive{background-color:#3d9970!important}.bg-lime{background-color:#01ff70!important}.bg-orange{background-color:#ff851b!important}.bg-fuchsia{background-color:#f012be!important}.bg-purple{background-color:#605ca8!important}.bg-maroon{background-color:#d81b60!important}.bg-gray-active{color:#000;background-color:#b5bbc8!important}.bg-black-active{background-color:#000!important}.bg-red-active,.modal-danger .modal-header,.modal-danger .modal-footer{background-color:#d33724!important}.bg-yellow-active,.modal-warning .modal-header,.modal-warning .modal-footer{background-color:#db8b0b!important}.bg-aqua-active,.modal-info .modal-header,.modal-info .modal-footer{background-color:#00a7d0!important}.bg-blue-active{background-color:#005384!important}.bg-light-blue-active,.modal-primary .modal-header,.modal-primary .modal-footer{background-color:#357ca5!important}.bg-green-active,.modal-success .modal-header,.modal-success .modal-footer{background-color:#008d4c!important}.bg-navy-active{background-color:#001a35!important}.bg-teal-active{background-color:#30bbbb!important}.bg-olive-active{background-color:#368763!important}.bg-lime-active{background-color:#00e765!important}.bg-orange-active{background-color:#ff7701!important}.bg-fuchsia-active{background-color:#db0ead!important}.bg-purple-active{background-color:#555299!important}.bg-maroon-active{background-color:#ca195a!important}[class^=bg-].disabled{opacity:.65;filter:alpha(opacity=65)}.text-red{color:#dd4b39!important}.text-yellow{color:#f39c12!important}.text-aqua{color:#00c0ef!important}.text-blue{color:#0073b7!important}.text-black{color:#111!important}.text-light-blue{color:#3c8dbc!important}.text-green{color:#00a65a!important}.text-gray{color:#d2d6de!important}.text-navy{color:#001f3f!important}.text-teal{color:#39cccc!important}.text-olive{color:#3d9970!important}.text-lime{color:#01ff70!important}.text-orange{color:#ff851b!important}.text-fuchsia{color:#f012be!important}.text-purple{color:#605ca8!important}.text-maroon{color:#d81b60!important}.link-muted{color:#7a869d}.link-muted:hover,.link-muted:focus{color:#606c84}.link-black{color:#666}.link-black:hover,.link-black:focus{color:#999}.hide{display:none!important}.no-border{border:0!important}.no-padding{padding:0!important}.no-margin{margin:0!important}.no-shadow{box-shadow:none!important}.list-unstyled,.chart-legend,.contacts-list,.users-list,.mailbox-attachments{list-style:none;margin:0;padding:0}.list-group-unbordered>.list-group-item{border-left:0;border-right:0;border-radius:0;padding-left:0;padding-right:0}.flat{border-radius:0!important}.text-bold,.text-bold.table td,.text-bold.table th{font-weight:700}.text-sm{font-size:12px}.jqstooltip{padding:5px!important;width:auto!important;height:auto!important}.bg-teal-gradient{background:#39cccc!important;background:-webkit-gradient(linear,left bottom,left top,color-stop(0,#39cccc),color-stop(1,#7adddd))!important;background:-ms-linear-gradient(bottom,#39cccc,#7adddd)!important;background:-moz-linear-gradient(center bottom,#39cccc 0,#7adddd 100%)!important;background:-o-linear-gradient(#7adddd,#39cccc)!important;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#7adddd', endColorstr='#39cccc', GradientType=0)!important;color:#fff}.bg-light-blue-gradient{background:#3c8dbc!important;background:-webkit-gradient(linear,left bottom,left top,color-stop(0,#3c8dbc),color-stop(1,#67a8ce))!important;background:-ms-linear-gradient(bottom,#3c8dbc,#67a8ce)!important;background:-moz-linear-gradient(center bottom,#3c8dbc 0,#67a8ce 100%)!important;background:-o-linear-gradient(#67a8ce,#3c8dbc)!important;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#67a8ce', endColorstr='#3c8dbc', GradientType=0)!important;color:#fff}.bg-blue-gradient{background:#0073b7!important;background:-webkit-gradient(linear,left bottom,left top,color-stop(0,#0073b7),color-stop(1,#0089db))!important;background:-ms-linear-gradient(bottom,#0073b7,#0089db)!important;background:-moz-linear-gradient(center bottom,#0073b7 0,#0089db 100%)!important;background:-o-linear-gradient(#0089db,#0073b7)!important;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0089db', endColorstr='#0073b7', GradientType=0)!important;color:#fff}.bg-aqua-gradient{background:#00c0ef!important;background:-webkit-gradient(linear,left bottom,left top,color-stop(0,#00c0ef),color-stop(1,#14d1ff))!important;background:-ms-linear-gradient(bottom,#00c0ef,#14d1ff)!important;background:-moz-linear-gradient(center bottom,#00c0ef 0,#14d1ff 100%)!important;background:-o-linear-gradient(#14d1ff,#00c0ef)!important;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#14d1ff', endColorstr='#00c0ef', GradientType=0)!important;color:#fff}.bg-yellow-gradient{background:#f39c12!important;background:-webkit-gradient(linear,left bottom,left top,color-stop(0,#f39c12),color-stop(1,#f7bc60))!important;background:-ms-linear-gradient(bottom,#f39c12,#f7bc60)!important;background:-moz-linear-gradient(center bottom,#f39c12 0,#f7bc60 100%)!important;background:-o-linear-gradient(#f7bc60,#f39c12)!important;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f7bc60', endColorstr='#f39c12', GradientType=0)!important;color:#fff}.bg-purple-gradient{background:#605ca8!important;background:-webkit-gradient(linear,left bottom,left top,color-stop(0,#605ca8),color-stop(1,#9491c4))!important;background:-ms-linear-gradient(bottom,#605ca8,#9491c4)!important;background:-moz-linear-gradient(center bottom,#605ca8 0,#9491c4 100%)!important;background:-o-linear-gradient(#9491c4,#605ca8)!important;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#9491c4', endColorstr='#605ca8', GradientType=0)!important;color:#fff}.bg-green-gradient{background:#00a65a!important;background:-webkit-gradient(linear,left bottom,left top,color-stop(0,#00a65a),color-stop(1,#00ca6d))!important;background:-ms-linear-gradient(bottom,#00a65a,#00ca6d)!important;background:-moz-linear-gradient(center bottom,#00a65a 0,#00ca6d 100%)!important;background:-o-linear-gradient(#00ca6d,#00a65a)!important;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ca6d', endColorstr='#00a65a', GradientType=0)!important;color:#fff}.bg-red-gradient{background:#dd4b39!important;background:-webkit-gradient(linear,left bottom,left top,color-stop(0,#dd4b39),color-stop(1,#e47365))!important;background:-ms-linear-gradient(bottom,#dd4b39,#e47365)!important;background:-moz-linear-gradient(center bottom,#dd4b39 0,#e47365 100%)!important;background:-o-linear-gradient(#e47365,#dd4b39)!important;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#e47365', endColorstr='#dd4b39', GradientType=0)!important;color:#fff}.bg-black-gradient{background:#111!important;background:-webkit-gradient(linear,left bottom,left top,color-stop(0,#111),color-stop(1,#2b2b2b))!important;background:-ms-linear-gradient(bottom,#111,#2b2b2b)!important;background:-moz-linear-gradient(center bottom,#111 0,#2b2b2b 100%)!important;background:-o-linear-gradient(#2b2b2b,#111)!important;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#2b2b2b', endColorstr='#111111', GradientType=0)!important;color:#fff}.bg-maroon-gradient{background:#d81b60!important;background:-webkit-gradient(linear,left bottom,left top,color-stop(0,#d81b60),color-stop(1,#e73f7c))!important;background:-ms-linear-gradient(bottom,#d81b60,#e73f7c)!important;background:-moz-linear-gradient(center bottom,#d81b60 0,#e73f7c 100%)!important;background:-o-linear-gradient(#e73f7c,#d81b60)!important;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#e73f7c', endColorstr='#d81b60', GradientType=0)!important;color:#fff}.description-block .description-icon{font-size:16px}.no-pad-top{padding-top:0}.position-static{position:static!important}.list-header{font-size:15px;padding:10px 4px;font-weight:700;color:#666}.list-seperator{height:1px;background:#f4f4f4;margin:15px 0 9px}.list-link>a{padding:4px;color:#777}.list-link>a:hover{color:#222}.font-light{font-weight:300}.user-block:before,.user-block:after{content:" ";display:table}.user-block:after{clear:both}.user-block img{width:40px;height:40px;float:left}.user-block .username,.user-block .description,.user-block .comment{display:block;margin-left:50px}.user-block .username{font-size:16px;font-weight:600}.user-block .description{color:#999;font-size:13px}.user-block.user-block-sm .username,.user-block.user-block-sm .description,.user-block.user-block-sm .comment{margin-left:40px}.user-block.user-block-sm .username{font-size:14px}.img-sm,.img-md,.img-lg,.box-comments .box-comment img,.user-block.user-block-sm img{float:left}.img-sm,.box-comments .box-comment img,.user-block.user-block-sm img{width:30px!important;height:30px!important}.img-sm+.img-push{margin-left:40px}.img-md{width:60px;height:60px}.img-md+.img-push{margin-left:70px}.img-lg{width:100px;height:100px}.img-lg+.img-push{margin-left:110px}.img-bordered{border:3px solid #d2d6de;padding:3px}.img-bordered-sm{border:2px solid #d2d6de;padding:2px}.attachment-block{border:1px solid #f4f4f4;padding:5px;margin-bottom:10px;background:#f7f7f7}.attachment-block .attachment-img{max-width:100px;max-height:100px;height:auto;float:left}.attachment-block .attachment-pushed{margin-left:110px}.attachment-block .attachment-heading{margin:0}.attachment-block .attachment-text{color:#555}.connectedSortable{min-height:100px}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sort-highlight{background:#f4f4f4;border:1px dashed #ddd;margin-bottom:10px}.full-opacity-hover{opacity:.65;filter:alpha(opacity=65)}.full-opacity-hover:hover{opacity:1;filter:alpha(opacity=100)}.chart{position:relative;overflow:hidden;width:100%}.chart svg,.chart canvas{width:100%!important}@media print{.no-print,.main-sidebar,.left-side,.main-header,.content-header{display:none!important}.content-wrapper,.right-side,.main-footer{margin-left:0!important;min-height:0!important;-webkit-transform:translate(0,0)!important;-ms-transform:translate(0,0)!important;-o-transform:translate(0,0)!important;transform:translate(0,0)!important}.fixed .content-wrapper,.fixed .right-side{padding-top:0!important}.invoice{width:100%;border:0;margin:0;padding:0}.invoice-col{float:left;width:33.3333333%}.table-responsive{overflow:auto}.table-responsive>.table tr th,.table-responsive>.table tr td{white-space:normal!important}}
2881099/FreeScheduler
1,443
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/css/index.css
/* 系统字体重设 */ body, h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, .main-header .logo { font-family: "Microsoft YaHei", segoe ui, "Helvetica Neue", Helvetica, Arial, sans-serif; } /*公共样式*/ .mt10 { margin-top: 10px; } .mt15 { margin-top: 15px; } .mt20 { margin-top: 20px; } .mr10 { margin-right: 10px; } .mr15 { margin-right: 15px; } .mr20 { margin-right: 20px; } .mb5 { margin-bottom: 5px; } .mb10 { margin-bottom: 10px; } .mb15 { margin-bottom: 15px; } .mb20 { margin-bottom: 20px; } .ml10 { margin-left: 10px; } .ml15 { margin-left: 15px; } .ml20 { margin-left: 20px; } /*table#GridView1, form#form_add table { width:100%; } table#GridView1 td, table#GridView1 th, form#form_add table td, form#form_add table th { padding:6px 12px 6px 12px; } table#GridView1 th { background-color:#9999aa; }*/ table#GridView1 td.page{margin-top:12px;} table#GridView1 td.page .normal{background:#fff;border:1px solid #384EA3;padding:3px 5px 2px 5px;margin:0px 3px 0px 0px;color:#BC2931;float:left;} table#GridView1 td.page .dot{float:left;} table#GridView1 td.page .statics{} table#GridView1 td.page a{padding:3px 5px 2px 5px;margin:0px 3px 0px 0px;background:#367fa9;border:1px solid #384EA3;color:#fff;text-decoration:none;float:left;} table#GridView1 td.page a:visited {color:#fff;} table#GridView1 td.page a:hover{color:#BC2931;border:1px solid #384EA3;background:#fff;} .datepicker { border: 1px solid #aaa; }
2881099/FreeScheduler
12,507
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/pace/pace.min.js
/*! pace 1.0.2 */ (function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X=[].slice,Y={}.hasOwnProperty,Z=function(a,b){function c(){this.constructor=a}for(var d in b)Y.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},$=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};for(u={catchupTime:100,initialRate:.03,minTime:250,ghostTime:100,maxProgressPerFrame:20,easeFactor:1.25,startOnPageLoad:!0,restartOnPushState:!0,restartOnRequestAfter:500,target:"body",elements:{checkInterval:100,selectors:["body"]},eventLag:{minSamples:10,sampleCount:3,lagThreshold:3},ajax:{trackMethods:["GET"],trackWebSockets:!0,ignoreURLs:[]}},C=function(){var a;return null!=(a="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.now?performance.now():void 0)?a:+new Date},E=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,t=window.cancelAnimationFrame||window.mozCancelAnimationFrame,null==E&&(E=function(a){return setTimeout(a,50)},t=function(a){return clearTimeout(a)}),G=function(a){var b,c;return b=C(),(c=function(){var d;return d=C()-b,d>=33?(b=C(),a(d,function(){return E(c)})):setTimeout(c,33-d)})()},F=function(){var a,b,c;return c=arguments[0],b=arguments[1],a=3<=arguments.length?X.call(arguments,2):[],"function"==typeof c[b]?c[b].apply(c,a):c[b]},v=function(){var a,b,c,d,e,f,g;for(b=arguments[0],d=2<=arguments.length?X.call(arguments,1):[],f=0,g=d.length;g>f;f++)if(c=d[f])for(a in c)Y.call(c,a)&&(e=c[a],null!=b[a]&&"object"==typeof b[a]&&null!=e&&"object"==typeof e?v(b[a],e):b[a]=e);return b},q=function(a){var b,c,d,e,f;for(c=b=0,e=0,f=a.length;f>e;e++)d=a[e],c+=Math.abs(d),b++;return c/b},x=function(a,b){var c,d,e;if(null==a&&(a="options"),null==b&&(b=!0),e=document.querySelector("[data-pace-"+a+"]")){if(c=e.getAttribute("data-pace-"+a),!b)return c;try{return JSON.parse(c)}catch(f){return d=f,"undefined"!=typeof console&&null!==console?console.error("Error parsing inline pace options",d):void 0}}},g=function(){function a(){}return a.prototype.on=function(a,b,c,d){var e;return null==d&&(d=!1),null==this.bindings&&(this.bindings={}),null==(e=this.bindings)[a]&&(e[a]=[]),this.bindings[a].push({handler:b,ctx:c,once:d})},a.prototype.once=function(a,b,c){return this.on(a,b,c,!0)},a.prototype.off=function(a,b){var c,d,e;if(null!=(null!=(d=this.bindings)?d[a]:void 0)){if(null==b)return delete this.bindings[a];for(c=0,e=[];c<this.bindings[a].length;)e.push(this.bindings[a][c].handler===b?this.bindings[a].splice(c,1):c++);return e}},a.prototype.trigger=function(){var a,b,c,d,e,f,g,h,i;if(c=arguments[0],a=2<=arguments.length?X.call(arguments,1):[],null!=(g=this.bindings)?g[c]:void 0){for(e=0,i=[];e<this.bindings[c].length;)h=this.bindings[c][e],d=h.handler,b=h.ctx,f=h.once,d.apply(null!=b?b:this,a),i.push(f?this.bindings[c].splice(e,1):e++);return i}},a}(),j=window.Pace||{},window.Pace=j,v(j,g.prototype),D=j.options=v({},u,window.paceOptions,x()),U=["ajax","document","eventLag","elements"],Q=0,S=U.length;S>Q;Q++)K=U[Q],D[K]===!0&&(D[K]=u[K]);i=function(a){function b(){return V=b.__super__.constructor.apply(this,arguments)}return Z(b,a),b}(Error),b=function(){function a(){this.progress=0}return a.prototype.getElement=function(){var a;if(null==this.el){if(a=document.querySelector(D.target),!a)throw new i;this.el=document.createElement("div"),this.el.className="pace pace-active",document.body.className=document.body.className.replace(/pace-done/g,""),document.body.className+=" pace-running",this.el.innerHTML='<div class="pace-progress">\n <div class="pace-progress-inner"></div>\n</div>\n<div class="pace-activity"></div>',null!=a.firstChild?a.insertBefore(this.el,a.firstChild):a.appendChild(this.el)}return this.el},a.prototype.finish=function(){var a;return a=this.getElement(),a.className=a.className.replace("pace-active",""),a.className+=" pace-inactive",document.body.className=document.body.className.replace("pace-running",""),document.body.className+=" pace-done"},a.prototype.update=function(a){return this.progress=a,this.render()},a.prototype.destroy=function(){try{this.getElement().parentNode.removeChild(this.getElement())}catch(a){i=a}return this.el=void 0},a.prototype.render=function(){var a,b,c,d,e,f,g;if(null==document.querySelector(D.target))return!1;for(a=this.getElement(),d="translate3d("+this.progress+"%, 0, 0)",g=["webkitTransform","msTransform","transform"],e=0,f=g.length;f>e;e++)b=g[e],a.children[0].style[b]=d;return(!this.lastRenderedProgress||this.lastRenderedProgress|0!==this.progress|0)&&(a.children[0].setAttribute("data-progress-text",""+(0|this.progress)+"%"),this.progress>=100?c="99":(c=this.progress<10?"0":"",c+=0|this.progress),a.children[0].setAttribute("data-progress",""+c)),this.lastRenderedProgress=this.progress},a.prototype.done=function(){return this.progress>=100},a}(),h=function(){function a(){this.bindings={}}return a.prototype.trigger=function(a,b){var c,d,e,f,g;if(null!=this.bindings[a]){for(f=this.bindings[a],g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(c.call(this,b));return g}},a.prototype.on=function(a,b){var c;return null==(c=this.bindings)[a]&&(c[a]=[]),this.bindings[a].push(b)},a}(),P=window.XMLHttpRequest,O=window.XDomainRequest,N=window.WebSocket,w=function(a,b){var c,d,e;e=[];for(d in b.prototype)try{e.push(null==a[d]&&"function"!=typeof b[d]?"function"==typeof Object.defineProperty?Object.defineProperty(a,d,{get:function(){return b.prototype[d]},configurable:!0,enumerable:!0}):a[d]=b.prototype[d]:void 0)}catch(f){c=f}return e},A=[],j.ignore=function(){var a,b,c;return b=arguments[0],a=2<=arguments.length?X.call(arguments,1):[],A.unshift("ignore"),c=b.apply(null,a),A.shift(),c},j.track=function(){var a,b,c;return b=arguments[0],a=2<=arguments.length?X.call(arguments,1):[],A.unshift("track"),c=b.apply(null,a),A.shift(),c},J=function(a){var b;if(null==a&&(a="GET"),"track"===A[0])return"force";if(!A.length&&D.ajax){if("socket"===a&&D.ajax.trackWebSockets)return!0;if(b=a.toUpperCase(),$.call(D.ajax.trackMethods,b)>=0)return!0}return!1},k=function(a){function b(){var a,c=this;b.__super__.constructor.apply(this,arguments),a=function(a){var b;return b=a.open,a.open=function(d,e){return J(d)&&c.trigger("request",{type:d,url:e,request:a}),b.apply(a,arguments)}},window.XMLHttpRequest=function(b){var c;return c=new P(b),a(c),c};try{w(window.XMLHttpRequest,P)}catch(d){}if(null!=O){window.XDomainRequest=function(){var b;return b=new O,a(b),b};try{w(window.XDomainRequest,O)}catch(d){}}if(null!=N&&D.ajax.trackWebSockets){window.WebSocket=function(a,b){var d;return d=null!=b?new N(a,b):new N(a),J("socket")&&c.trigger("request",{type:"socket",url:a,protocols:b,request:d}),d};try{w(window.WebSocket,N)}catch(d){}}}return Z(b,a),b}(h),R=null,y=function(){return null==R&&(R=new k),R},I=function(a){var b,c,d,e;for(e=D.ajax.ignoreURLs,c=0,d=e.length;d>c;c++)if(b=e[c],"string"==typeof b){if(-1!==a.indexOf(b))return!0}else if(b.test(a))return!0;return!1},y().on("request",function(b){var c,d,e,f,g;return f=b.type,e=b.request,g=b.url,I(g)?void 0:j.running||D.restartOnRequestAfter===!1&&"force"!==J(f)?void 0:(d=arguments,c=D.restartOnRequestAfter||0,"boolean"==typeof c&&(c=0),setTimeout(function(){var b,c,g,h,i,k;if(b="socket"===f?e.readyState<2:0<(h=e.readyState)&&4>h){for(j.restart(),i=j.sources,k=[],c=0,g=i.length;g>c;c++){if(K=i[c],K instanceof a){K.watch.apply(K,d);break}k.push(void 0)}return k}},c))}),a=function(){function a(){var a=this;this.elements=[],y().on("request",function(){return a.watch.apply(a,arguments)})}return a.prototype.watch=function(a){var b,c,d,e;return d=a.type,b=a.request,e=a.url,I(e)?void 0:(c="socket"===d?new n(b):new o(b),this.elements.push(c))},a}(),o=function(){function a(a){var b,c,d,e,f,g,h=this;if(this.progress=0,null!=window.ProgressEvent)for(c=null,a.addEventListener("progress",function(a){return h.progress=a.lengthComputable?100*a.loaded/a.total:h.progress+(100-h.progress)/2},!1),g=["load","abort","timeout","error"],d=0,e=g.length;e>d;d++)b=g[d],a.addEventListener(b,function(){return h.progress=100},!1);else f=a.onreadystatechange,a.onreadystatechange=function(){var b;return 0===(b=a.readyState)||4===b?h.progress=100:3===a.readyState&&(h.progress=50),"function"==typeof f?f.apply(null,arguments):void 0}}return a}(),n=function(){function a(a){var b,c,d,e,f=this;for(this.progress=0,e=["error","open"],c=0,d=e.length;d>c;c++)b=e[c],a.addEventListener(b,function(){return f.progress=100},!1)}return a}(),d=function(){function a(a){var b,c,d,f;for(null==a&&(a={}),this.elements=[],null==a.selectors&&(a.selectors=[]),f=a.selectors,c=0,d=f.length;d>c;c++)b=f[c],this.elements.push(new e(b))}return a}(),e=function(){function a(a){this.selector=a,this.progress=0,this.check()}return a.prototype.check=function(){var a=this;return document.querySelector(this.selector)?this.done():setTimeout(function(){return a.check()},D.elements.checkInterval)},a.prototype.done=function(){return this.progress=100},a}(),c=function(){function a(){var a,b,c=this;this.progress=null!=(b=this.states[document.readyState])?b:100,a=document.onreadystatechange,document.onreadystatechange=function(){return null!=c.states[document.readyState]&&(c.progress=c.states[document.readyState]),"function"==typeof a?a.apply(null,arguments):void 0}}return a.prototype.states={loading:0,interactive:50,complete:100},a}(),f=function(){function a(){var a,b,c,d,e,f=this;this.progress=0,a=0,e=[],d=0,c=C(),b=setInterval(function(){var g;return g=C()-c-50,c=C(),e.push(g),e.length>D.eventLag.sampleCount&&e.shift(),a=q(e),++d>=D.eventLag.minSamples&&a<D.eventLag.lagThreshold?(f.progress=100,clearInterval(b)):f.progress=100*(3/(a+3))},50)}return a}(),m=function(){function a(a){this.source=a,this.last=this.sinceLastUpdate=0,this.rate=D.initialRate,this.catchup=0,this.progress=this.lastProgress=0,null!=this.source&&(this.progress=F(this.source,"progress"))}return a.prototype.tick=function(a,b){var c;return null==b&&(b=F(this.source,"progress")),b>=100&&(this.done=!0),b===this.last?this.sinceLastUpdate+=a:(this.sinceLastUpdate&&(this.rate=(b-this.last)/this.sinceLastUpdate),this.catchup=(b-this.progress)/D.catchupTime,this.sinceLastUpdate=0,this.last=b),b>this.progress&&(this.progress+=this.catchup*a),c=1-Math.pow(this.progress/100,D.easeFactor),this.progress+=c*this.rate*a,this.progress=Math.min(this.lastProgress+D.maxProgressPerFrame,this.progress),this.progress=Math.max(0,this.progress),this.progress=Math.min(100,this.progress),this.lastProgress=this.progress,this.progress},a}(),L=null,H=null,r=null,M=null,p=null,s=null,j.running=!1,z=function(){return D.restartOnPushState?j.restart():void 0},null!=window.history.pushState&&(T=window.history.pushState,window.history.pushState=function(){return z(),T.apply(window.history,arguments)}),null!=window.history.replaceState&&(W=window.history.replaceState,window.history.replaceState=function(){return z(),W.apply(window.history,arguments)}),l={ajax:a,elements:d,document:c,eventLag:f},(B=function(){var a,c,d,e,f,g,h,i;for(j.sources=L=[],g=["ajax","elements","document","eventLag"],c=0,e=g.length;e>c;c++)a=g[c],D[a]!==!1&&L.push(new l[a](D[a]));for(i=null!=(h=D.extraSources)?h:[],d=0,f=i.length;f>d;d++)K=i[d],L.push(new K(D));return j.bar=r=new b,H=[],M=new m})(),j.stop=function(){return j.trigger("stop"),j.running=!1,r.destroy(),s=!0,null!=p&&("function"==typeof t&&t(p),p=null),B()},j.restart=function(){return j.trigger("restart"),j.stop(),j.start()},j.go=function(){var a;return j.running=!0,r.render(),a=C(),s=!1,p=G(function(b,c){var d,e,f,g,h,i,k,l,n,o,p,q,t,u,v,w;for(l=100-r.progress,e=p=0,f=!0,i=q=0,u=L.length;u>q;i=++q)for(K=L[i],o=null!=H[i]?H[i]:H[i]=[],h=null!=(w=K.elements)?w:[K],k=t=0,v=h.length;v>t;k=++t)g=h[k],n=null!=o[k]?o[k]:o[k]=new m(g),f&=n.done,n.done||(e++,p+=n.tick(b));return d=p/e,r.update(M.tick(b,d)),r.done()||f||s?(r.update(100),j.trigger("done"),setTimeout(function(){return r.finish(),j.running=!1,j.trigger("hide")},Math.max(D.ghostTime,Math.max(D.minTime-(C()-a),0)))):c()})},j.start=function(a){v(D,a),j.running=!0;try{r.render()}catch(b){i=b}return document.querySelector(".pace")?(j.trigger("start"),j.go()):setTimeout(j.start,50)},"function"==typeof define&&define.amd?define(["pace"],function(){return j}):"object"==typeof exports?module.exports=j:D.startOnPageLoad&&j.start()}).call(this);
2881099/FreeScheduler
1,863
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/pace/pace.min.css
.pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.pace-inactive{display:none}.pace .pace-progress{background:#fff;position:fixed;z-index:2000;top:0;right:100%;width:100%;height:2px}.pace .pace-progress-inner{display:block;position:absolute;right:0;width:100px;height:100%;box-shadow:0 0 10px #fff,0 0 5px #fff;opacity:1;-webkit-transform:rotate(3deg) translate(0px,-4px);-moz-transform:rotate(3deg) translate(0px,-4px);-ms-transform:rotate(3deg) translate(0px,-4px);-o-transform:rotate(3deg) translate(0px,-4px);transform:rotate(3deg) translate(0px,-4px)}.pace .pace-activity{display:block;position:fixed;z-index:2000;top:15px;right:50%;width:14px;height:14px;border:solid 2px transparent;border-top-color:#fff;border-left-color:#fff;border-radius:10px;-webkit-animation:pace-spinner 400ms linear infinite;-moz-animation:pace-spinner 400ms linear infinite;-ms-animation:pace-spinner 400ms linear infinite;-o-animation:pace-spinner 400ms linear infinite;animation:pace-spinner 400ms linear infinite}@media (max-width: 767px){.pace .pace-activity{top:15px;right:15px;width:14px;height:14px}}@-webkit-keyframes pace-spinner{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes pace-spinner{0%{-moz-transform:rotate(0deg);transform:rotate(0deg)}100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes pace-spinner{0%{-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@-ms-keyframes pace-spinner{0%{-ms-transform:rotate(0deg);transform:rotate(0deg)}100%{-ms-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes pace-spinner{0%{transform:rotate(0deg);transform:rotate(0deg)}100%{transform:rotate(360deg);transform:rotate(360deg)}}
2881099/FreeScheduler
26,566
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/pace/pace.js
(function() { var AjaxMonitor, Bar, DocumentMonitor, ElementMonitor, ElementTracker, EventLagMonitor, Evented, Events, NoTargetError, Pace, RequestIntercept, SOURCE_KEYS, Scaler, SocketRequestTracker, XHRRequestTracker, animation, avgAmplitude, bar, cancelAnimation, cancelAnimationFrame, defaultOptions, extend, extendNative, getFromDOM, getIntercept, handlePushState, ignoreStack, init, now, options, requestAnimationFrame, result, runAnimation, scalers, shouldIgnoreURL, shouldTrack, source, sources, uniScaler, _WebSocket, _XDomainRequest, _XMLHttpRequest, _i, _intercept, _len, _pushState, _ref, _ref1, _replaceState, __slice = [].slice, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; defaultOptions = { catchupTime: 100, initialRate: .03, minTime: 250, ghostTime: 100, maxProgressPerFrame: 20, easeFactor: 1.25, startOnPageLoad: true, restartOnPushState: true, restartOnRequestAfter: 500, target: 'body', elements: { checkInterval: 100, selectors: ['body'] }, eventLag: { minSamples: 10, sampleCount: 3, lagThreshold: 3 }, ajax: { trackMethods: ['GET'], trackWebSockets: true, ignoreURLs: [] } }; now = function() { var _ref; return (_ref = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref : +(new Date); }; requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame; cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame; if (requestAnimationFrame == null) { requestAnimationFrame = function(fn) { return setTimeout(fn, 50); }; cancelAnimationFrame = function(id) { return clearTimeout(id); }; } runAnimation = function(fn) { var last, tick; last = now(); tick = function() { var diff; diff = now() - last; if (diff >= 33) { last = now(); return fn(diff, function() { return requestAnimationFrame(tick); }); } else { return setTimeout(tick, 33 - diff); } }; return tick(); }; result = function() { var args, key, obj; obj = arguments[0], key = arguments[1], args = 3 <= arguments.length ? __slice.call(arguments, 2) : []; if (typeof obj[key] === 'function') { return obj[key].apply(obj, args); } else { return obj[key]; } }; extend = function() { var key, out, source, sources, val, _i, _len; out = arguments[0], sources = 2 <= arguments.length ? __slice.call(arguments, 1) : []; for (_i = 0, _len = sources.length; _i < _len; _i++) { source = sources[_i]; if (source) { for (key in source) { if (!__hasProp.call(source, key)) continue; val = source[key]; if ((out[key] != null) && typeof out[key] === 'object' && (val != null) && typeof val === 'object') { extend(out[key], val); } else { out[key] = val; } } } } return out; }; avgAmplitude = function(arr) { var count, sum, v, _i, _len; sum = count = 0; for (_i = 0, _len = arr.length; _i < _len; _i++) { v = arr[_i]; sum += Math.abs(v); count++; } return sum / count; }; getFromDOM = function(key, json) { var data, e, el; if (key == null) { key = 'options'; } if (json == null) { json = true; } el = document.querySelector("[data-pace-" + key + "]"); if (!el) { return; } data = el.getAttribute("data-pace-" + key); if (!json) { return data; } try { return JSON.parse(data); } catch (_error) { e = _error; return typeof console !== "undefined" && console !== null ? console.error("Error parsing inline pace options", e) : void 0; } }; Evented = (function() { function Evented() {} Evented.prototype.on = function(event, handler, ctx, once) { var _base; if (once == null) { once = false; } if (this.bindings == null) { this.bindings = {}; } if ((_base = this.bindings)[event] == null) { _base[event] = []; } return this.bindings[event].push({ handler: handler, ctx: ctx, once: once }); }; Evented.prototype.once = function(event, handler, ctx) { return this.on(event, handler, ctx, true); }; Evented.prototype.off = function(event, handler) { var i, _ref, _results; if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) { return; } if (handler == null) { return delete this.bindings[event]; } else { i = 0; _results = []; while (i < this.bindings[event].length) { if (this.bindings[event][i].handler === handler) { _results.push(this.bindings[event].splice(i, 1)); } else { _results.push(i++); } } return _results; } }; Evented.prototype.trigger = function() { var args, ctx, event, handler, i, once, _ref, _ref1, _results; event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; if ((_ref = this.bindings) != null ? _ref[event] : void 0) { i = 0; _results = []; while (i < this.bindings[event].length) { _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once; handler.apply(ctx != null ? ctx : this, args); if (once) { _results.push(this.bindings[event].splice(i, 1)); } else { _results.push(i++); } } return _results; } }; return Evented; })(); Pace = window.Pace || {}; window.Pace = Pace; extend(Pace, Evented.prototype); options = Pace.options = extend({}, defaultOptions, window.paceOptions, getFromDOM()); _ref = ['ajax', 'document', 'eventLag', 'elements']; for (_i = 0, _len = _ref.length; _i < _len; _i++) { source = _ref[_i]; if (options[source] === true) { options[source] = defaultOptions[source]; } } NoTargetError = (function(_super) { __extends(NoTargetError, _super); function NoTargetError() { _ref1 = NoTargetError.__super__.constructor.apply(this, arguments); return _ref1; } return NoTargetError; })(Error); Bar = (function() { function Bar() { this.progress = 0; } Bar.prototype.getElement = function() { var targetElement; if (this.el == null) { targetElement = document.querySelector(options.target); if (!targetElement) { throw new NoTargetError; } this.el = document.createElement('div'); this.el.className = "pace pace-active"; document.body.className = document.body.className.replace(/pace-done/g, ''); document.body.className += ' pace-running'; this.el.innerHTML = '<div class="pace-progress">\n <div class="pace-progress-inner"></div>\n</div>\n<div class="pace-activity"></div>'; if (targetElement.firstChild != null) { targetElement.insertBefore(this.el, targetElement.firstChild); } else { targetElement.appendChild(this.el); } } return this.el; }; Bar.prototype.finish = function() { var el; el = this.getElement(); el.className = el.className.replace('pace-active', ''); el.className += ' pace-inactive'; document.body.className = document.body.className.replace('pace-running', ''); return document.body.className += ' pace-done'; }; Bar.prototype.update = function(prog) { this.progress = prog; return this.render(); }; Bar.prototype.destroy = function() { try { this.getElement().parentNode.removeChild(this.getElement()); } catch (_error) { NoTargetError = _error; } return this.el = void 0; }; Bar.prototype.render = function() { var el, key, progressStr, transform, _j, _len1, _ref2; if (document.querySelector(options.target) == null) { return false; } el = this.getElement(); transform = "translate3d(" + this.progress + "%, 0, 0)"; _ref2 = ['webkitTransform', 'msTransform', 'transform']; for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { key = _ref2[_j]; el.children[0].style[key] = transform; } if (!this.lastRenderedProgress || this.lastRenderedProgress | 0 !== this.progress | 0) { el.children[0].setAttribute('data-progress-text', "" + (this.progress | 0) + "%"); if (this.progress >= 100) { progressStr = '99'; } else { progressStr = this.progress < 10 ? "0" : ""; progressStr += this.progress | 0; } el.children[0].setAttribute('data-progress', "" + progressStr); } return this.lastRenderedProgress = this.progress; }; Bar.prototype.done = function() { return this.progress >= 100; }; return Bar; })(); Events = (function() { function Events() { this.bindings = {}; } Events.prototype.trigger = function(name, val) { var binding, _j, _len1, _ref2, _results; if (this.bindings[name] != null) { _ref2 = this.bindings[name]; _results = []; for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { binding = _ref2[_j]; _results.push(binding.call(this, val)); } return _results; } }; Events.prototype.on = function(name, fn) { var _base; if ((_base = this.bindings)[name] == null) { _base[name] = []; } return this.bindings[name].push(fn); }; return Events; })(); _XMLHttpRequest = window.XMLHttpRequest; _XDomainRequest = window.XDomainRequest; _WebSocket = window.WebSocket; extendNative = function(to, from) { var e, key, _results; _results = []; for (key in from.prototype) { try { if ((to[key] == null) && typeof from[key] !== 'function') { if (typeof Object.defineProperty === 'function') { _results.push(Object.defineProperty(to, key, { get: function() { return from.prototype[key]; }, configurable: true, enumerable: true })); } else { _results.push(to[key] = from.prototype[key]); } } else { _results.push(void 0); } } catch (_error) { e = _error; } } return _results; }; ignoreStack = []; Pace.ignore = function() { var args, fn, ret; fn = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; ignoreStack.unshift('ignore'); ret = fn.apply(null, args); ignoreStack.shift(); return ret; }; Pace.track = function() { var args, fn, ret; fn = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; ignoreStack.unshift('track'); ret = fn.apply(null, args); ignoreStack.shift(); return ret; }; shouldTrack = function(method) { var _ref2; if (method == null) { method = 'GET'; } if (ignoreStack[0] === 'track') { return 'force'; } if (!ignoreStack.length && options.ajax) { if (method === 'socket' && options.ajax.trackWebSockets) { return true; } else if (_ref2 = method.toUpperCase(), __indexOf.call(options.ajax.trackMethods, _ref2) >= 0) { return true; } } return false; }; RequestIntercept = (function(_super) { __extends(RequestIntercept, _super); function RequestIntercept() { var monitorXHR, _this = this; RequestIntercept.__super__.constructor.apply(this, arguments); monitorXHR = function(req) { var _open; _open = req.open; return req.open = function(type, url, async) { if (shouldTrack(type)) { _this.trigger('request', { type: type, url: url, request: req }); } return _open.apply(req, arguments); }; }; window.XMLHttpRequest = function(flags) { var req; req = new _XMLHttpRequest(flags); monitorXHR(req); return req; }; try { extendNative(window.XMLHttpRequest, _XMLHttpRequest); } catch (_error) {} if (_XDomainRequest != null) { window.XDomainRequest = function() { var req; req = new _XDomainRequest; monitorXHR(req); return req; }; try { extendNative(window.XDomainRequest, _XDomainRequest); } catch (_error) {} } if ((_WebSocket != null) && options.ajax.trackWebSockets) { window.WebSocket = function(url, protocols) { var req; if (protocols != null) { req = new _WebSocket(url, protocols); } else { req = new _WebSocket(url); } if (shouldTrack('socket')) { _this.trigger('request', { type: 'socket', url: url, protocols: protocols, request: req }); } return req; }; try { extendNative(window.WebSocket, _WebSocket); } catch (_error) {} } } return RequestIntercept; })(Events); _intercept = null; getIntercept = function() { if (_intercept == null) { _intercept = new RequestIntercept; } return _intercept; }; shouldIgnoreURL = function(url) { var pattern, _j, _len1, _ref2; _ref2 = options.ajax.ignoreURLs; for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { pattern = _ref2[_j]; if (typeof pattern === 'string') { if (url.indexOf(pattern) !== -1) { return true; } } else { if (pattern.test(url)) { return true; } } } return false; }; getIntercept().on('request', function(_arg) { var after, args, request, type, url; type = _arg.type, request = _arg.request, url = _arg.url; if (shouldIgnoreURL(url)) { return; } if (!Pace.running && (options.restartOnRequestAfter !== false || shouldTrack(type) === 'force')) { args = arguments; after = options.restartOnRequestAfter || 0; if (typeof after === 'boolean') { after = 0; } return setTimeout(function() { var stillActive, _j, _len1, _ref2, _ref3, _results; if (type === 'socket') { stillActive = request.readyState < 2; } else { stillActive = (0 < (_ref2 = request.readyState) && _ref2 < 4); } if (stillActive) { Pace.restart(); _ref3 = Pace.sources; _results = []; for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { source = _ref3[_j]; if (source instanceof AjaxMonitor) { source.watch.apply(source, args); break; } else { _results.push(void 0); } } return _results; } }, after); } }); AjaxMonitor = (function() { function AjaxMonitor() { var _this = this; this.elements = []; getIntercept().on('request', function() { return _this.watch.apply(_this, arguments); }); } AjaxMonitor.prototype.watch = function(_arg) { var request, tracker, type, url; type = _arg.type, request = _arg.request, url = _arg.url; if (shouldIgnoreURL(url)) { return; } if (type === 'socket') { tracker = new SocketRequestTracker(request); } else { tracker = new XHRRequestTracker(request); } return this.elements.push(tracker); }; return AjaxMonitor; })(); XHRRequestTracker = (function() { function XHRRequestTracker(request) { var event, size, _j, _len1, _onreadystatechange, _ref2, _this = this; this.progress = 0; if (window.ProgressEvent != null) { size = null; request.addEventListener('progress', function(evt) { if (evt.lengthComputable) { return _this.progress = 100 * evt.loaded / evt.total; } else { return _this.progress = _this.progress + (100 - _this.progress) / 2; } }, false); _ref2 = ['load', 'abort', 'timeout', 'error']; for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { event = _ref2[_j]; request.addEventListener(event, function() { return _this.progress = 100; }, false); } } else { _onreadystatechange = request.onreadystatechange; request.onreadystatechange = function() { var _ref3; if ((_ref3 = request.readyState) === 0 || _ref3 === 4) { _this.progress = 100; } else if (request.readyState === 3) { _this.progress = 50; } return typeof _onreadystatechange === "function" ? _onreadystatechange.apply(null, arguments) : void 0; }; } } return XHRRequestTracker; })(); SocketRequestTracker = (function() { function SocketRequestTracker(request) { var event, _j, _len1, _ref2, _this = this; this.progress = 0; _ref2 = ['error', 'open']; for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { event = _ref2[_j]; request.addEventListener(event, function() { return _this.progress = 100; }, false); } } return SocketRequestTracker; })(); ElementMonitor = (function() { function ElementMonitor(options) { var selector, _j, _len1, _ref2; if (options == null) { options = {}; } this.elements = []; if (options.selectors == null) { options.selectors = []; } _ref2 = options.selectors; for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { selector = _ref2[_j]; this.elements.push(new ElementTracker(selector)); } } return ElementMonitor; })(); ElementTracker = (function() { function ElementTracker(selector) { this.selector = selector; this.progress = 0; this.check(); } ElementTracker.prototype.check = function() { var _this = this; if (document.querySelector(this.selector)) { return this.done(); } else { return setTimeout((function() { return _this.check(); }), options.elements.checkInterval); } }; ElementTracker.prototype.done = function() { return this.progress = 100; }; return ElementTracker; })(); DocumentMonitor = (function() { DocumentMonitor.prototype.states = { loading: 0, interactive: 50, complete: 100 }; function DocumentMonitor() { var _onreadystatechange, _ref2, _this = this; this.progress = (_ref2 = this.states[document.readyState]) != null ? _ref2 : 100; _onreadystatechange = document.onreadystatechange; document.onreadystatechange = function() { if (_this.states[document.readyState] != null) { _this.progress = _this.states[document.readyState]; } return typeof _onreadystatechange === "function" ? _onreadystatechange.apply(null, arguments) : void 0; }; } return DocumentMonitor; })(); EventLagMonitor = (function() { function EventLagMonitor() { var avg, interval, last, points, samples, _this = this; this.progress = 0; avg = 0; samples = []; points = 0; last = now(); interval = setInterval(function() { var diff; diff = now() - last - 50; last = now(); samples.push(diff); if (samples.length > options.eventLag.sampleCount) { samples.shift(); } avg = avgAmplitude(samples); if (++points >= options.eventLag.minSamples && avg < options.eventLag.lagThreshold) { _this.progress = 100; return clearInterval(interval); } else { return _this.progress = 100 * (3 / (avg + 3)); } }, 50); } return EventLagMonitor; })(); Scaler = (function() { function Scaler(source) { this.source = source; this.last = this.sinceLastUpdate = 0; this.rate = options.initialRate; this.catchup = 0; this.progress = this.lastProgress = 0; if (this.source != null) { this.progress = result(this.source, 'progress'); } } Scaler.prototype.tick = function(frameTime, val) { var scaling; if (val == null) { val = result(this.source, 'progress'); } if (val >= 100) { this.done = true; } if (val === this.last) { this.sinceLastUpdate += frameTime; } else { if (this.sinceLastUpdate) { this.rate = (val - this.last) / this.sinceLastUpdate; } this.catchup = (val - this.progress) / options.catchupTime; this.sinceLastUpdate = 0; this.last = val; } if (val > this.progress) { this.progress += this.catchup * frameTime; } scaling = 1 - Math.pow(this.progress / 100, options.easeFactor); this.progress += scaling * this.rate * frameTime; this.progress = Math.min(this.lastProgress + options.maxProgressPerFrame, this.progress); this.progress = Math.max(0, this.progress); this.progress = Math.min(100, this.progress); this.lastProgress = this.progress; return this.progress; }; return Scaler; })(); sources = null; scalers = null; bar = null; uniScaler = null; animation = null; cancelAnimation = null; Pace.running = false; handlePushState = function() { if (options.restartOnPushState) { return Pace.restart(); } }; if (window.history.pushState != null) { _pushState = window.history.pushState; window.history.pushState = function() { handlePushState(); return _pushState.apply(window.history, arguments); }; } if (window.history.replaceState != null) { _replaceState = window.history.replaceState; window.history.replaceState = function() { handlePushState(); return _replaceState.apply(window.history, arguments); }; } SOURCE_KEYS = { ajax: AjaxMonitor, elements: ElementMonitor, document: DocumentMonitor, eventLag: EventLagMonitor }; (init = function() { var type, _j, _k, _len1, _len2, _ref2, _ref3, _ref4; Pace.sources = sources = []; _ref2 = ['ajax', 'elements', 'document', 'eventLag']; for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { type = _ref2[_j]; if (options[type] !== false) { sources.push(new SOURCE_KEYS[type](options[type])); } } _ref4 = (_ref3 = options.extraSources) != null ? _ref3 : []; for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) { source = _ref4[_k]; sources.push(new source(options)); } Pace.bar = bar = new Bar; scalers = []; return uniScaler = new Scaler; })(); Pace.stop = function() { Pace.trigger('stop'); Pace.running = false; bar.destroy(); cancelAnimation = true; if (animation != null) { if (typeof cancelAnimationFrame === "function") { cancelAnimationFrame(animation); } animation = null; } return init(); }; Pace.restart = function() { Pace.trigger('restart'); Pace.stop(); return Pace.start(); }; Pace.go = function() { var start; Pace.running = true; bar.render(); start = now(); cancelAnimation = false; return animation = runAnimation(function(frameTime, enqueueNextFrame) { var avg, count, done, element, elements, i, j, remaining, scaler, scalerList, sum, _j, _k, _len1, _len2, _ref2; remaining = 100 - bar.progress; count = sum = 0; done = true; for (i = _j = 0, _len1 = sources.length; _j < _len1; i = ++_j) { source = sources[i]; scalerList = scalers[i] != null ? scalers[i] : scalers[i] = []; elements = (_ref2 = source.elements) != null ? _ref2 : [source]; for (j = _k = 0, _len2 = elements.length; _k < _len2; j = ++_k) { element = elements[j]; scaler = scalerList[j] != null ? scalerList[j] : scalerList[j] = new Scaler(element); done &= scaler.done; if (scaler.done) { continue; } count++; sum += scaler.tick(frameTime); } } avg = sum / count; bar.update(uniScaler.tick(frameTime, avg)); if (bar.done() || done || cancelAnimation) { bar.update(100); Pace.trigger('done'); return setTimeout(function() { bar.finish(); Pace.running = false; return Pace.trigger('hide'); }, Math.max(options.ghostTime, Math.max(options.minTime - (now() - start), 0))); } else { return enqueueNextFrame(); } }); }; Pace.start = function(_options) { extend(options, _options); Pace.running = true; try { bar.render(); } catch (_error) { NoTargetError = _error; } if (!document.querySelector('.pace')) { return setTimeout(Pace.start, 50); } else { Pace.trigger('start'); return Pace.go(); } }; if (typeof define === 'function' && define.amd) { define(['pace'], function() { return Pace; }); } else if (typeof exports === 'object') { module.exports = Pace; } else { if (options.startOnPageLoad) { Pace.start(); } } }).call(this);
2881099/FreeScheduler
2,206
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/pace/pace.css
.pace { -webkit-pointer-events: none; pointer-events: none; -webkit-user-select: none; -moz-user-select: none; user-select: none; } .pace-inactive { display: none; } .pace .pace-progress { background: #fff; position: fixed; z-index: 2000; top: 0; right: 100%; width: 100%; height: 2px; } .pace .pace-progress-inner { display: block; position: absolute; right: 0px; width: 100px; height: 100%; box-shadow: 0 0 10px #fff, 0 0 5px #fff; opacity: 1.0; -webkit-transform: rotate(3deg) translate(0px, -4px); -moz-transform: rotate(3deg) translate(0px, -4px); -ms-transform: rotate(3deg) translate(0px, -4px); -o-transform: rotate(3deg) translate(0px, -4px); transform: rotate(3deg) translate(0px, -4px); } .pace .pace-activity { display: block; position: fixed; z-index: 2000; top: 15px; right: 50%; width: 14px; height: 14px; border: solid 2px transparent; border-top-color: #fff; border-left-color: #fff; border-radius: 10px; -webkit-animation: pace-spinner 400ms linear infinite; -moz-animation: pace-spinner 400ms linear infinite; -ms-animation: pace-spinner 400ms linear infinite; -o-animation: pace-spinner 400ms linear infinite; animation: pace-spinner 400ms linear infinite; } @media (max-width: 767px) { .pace .pace-activity { top: 15px; right: 15px; width: 14px; height: 14px; } } @-webkit-keyframes pace-spinner { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } } @-moz-keyframes pace-spinner { 0% { -moz-transform: rotate(0deg); transform: rotate(0deg); } 100% { -moz-transform: rotate(360deg); transform: rotate(360deg); } } @-o-keyframes pace-spinner { 0% { -o-transform: rotate(0deg); transform: rotate(0deg); } 100% { -o-transform: rotate(360deg); transform: rotate(360deg); } } @-ms-keyframes pace-spinner { 0% { -ms-transform: rotate(0deg); transform: rotate(0deg); } 100% { -ms-transform: rotate(360deg); transform: rotate(360deg); } } @keyframes pace-spinner { 0% { transform: rotate(0deg); transform: rotate(0deg); } 100% { transform: rotate(360deg); transform: rotate(360deg); } }
2881099/FreeScheduler
4,591
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/respond/respond.min.js
/*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2014 Scott Jehl * Licensed under MIT * http://j.mp/respondjs */ !function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='&shy;<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){v(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))},g=function(a){return a.replace(c.regex.minmaxwh,"").match(c.regex.other)};if(c.ajax=f,c.queue=d,c.unsupportedmq=g,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,comments:/\/\*[^*]*\*+([^/][^*]*\*+)*\//gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,maxw:/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,minmaxwh:/\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,other:/\([^\)]*\)/g},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var h,i,j,k=a.document,l=k.documentElement,m=[],n=[],o=[],p={},q=30,r=k.getElementsByTagName("head")[0]||l,s=k.getElementsByTagName("base")[0],t=r.getElementsByTagName("link"),u=function(){var a,b=k.createElement("div"),c=k.body,d=l.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=k.createElement("body"),c.style.background="none"),l.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&l.insertBefore(c,l.firstChild),a=b.offsetWidth,f?l.removeChild(c):c.removeChild(b),l.style.fontSize=d,e&&(c.style.fontSize=e),a=j=parseFloat(a)},v=function(b){var c="clientWidth",d=l[c],e="CSS1Compat"===k.compatMode&&d||k.body[c]||d,f={},g=t[t.length-1],p=(new Date).getTime();if(b&&h&&q>p-h)return a.clearTimeout(i),i=a.setTimeout(v,q),void 0;h=p;for(var s in m)if(m.hasOwnProperty(s)){var w=m[s],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?j||u():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?j||u():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(n[w.rules]))}for(var C in o)o.hasOwnProperty(C)&&o[C]&&o[C].parentNode===r&&r.removeChild(o[C]);o.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=k.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,r.insertBefore(E,g.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(k.createTextNode(F)),o.push(E)}},w=function(a,b,d){var e=a.replace(c.regex.comments,"").replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var h=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},i=!f&&d;b.length&&(b+="/"),i&&(f=1);for(var j=0;f>j;j++){var k,l,o,p;i?(k=d,n.push(h(a))):(k=e[j].match(c.regex.findStyles)&&RegExp.$1,n.push(RegExp.$2&&h(RegExp.$2))),o=k.split(","),p=o.length;for(var q=0;p>q;q++)l=o[q],g(l)||m.push({media:l.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:n.length-1,hasquery:l.indexOf("(")>-1,minw:l.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:l.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}v()},x=function(){if(d.length){var b=d.shift();f(b.href,function(c){w(c,b.href,b.media),p[b.href]=!0,a.setTimeout(function(){x()},0)})}},y=function(){for(var b=0;b<t.length;b++){var c=t[b],e=c.href,f=c.media,g=c.rel&&"stylesheet"===c.rel.toLowerCase();e&&g&&!p[e]&&(c.styleSheet&&c.styleSheet.rawCssText?(w(c.styleSheet.rawCssText,e,f),p[e]=!0):(!/^([a-zA-Z:]*\/\/)/.test(e)&&!s||e.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&("//"===e.substring(0,2)&&(e=a.location.protocol+e),d.push({href:e,media:f})))}x()};y(),c.update=y,c.getEmValue=u,a.addEventListener?a.addEventListener("resize",b,!1):a.attachEvent&&a.attachEvent("onresize",b)}}(this);
2881099/FreeScheduler
33,745
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/datepicker/datepicker3.css
/*! * Datepicker for Bootstrap * * Copyright 2012 Stefan Petre * Improvements by Andrew Rowls * Licensed under the Apache License v2.0 * http://www.apache.org/licenses/LICENSE-2.0 * */ .datepicker { padding: 4px; border-radius: 4px; direction: ltr; /*.dow { border-top: 1px solid #ddd !important; }*/ } .datepicker-inline { width: 100%; } .datepicker.datepicker-rtl { direction: rtl; } .datepicker.datepicker-rtl table tr td span { float: right; } .datepicker-dropdown { top: 0; left: 0; } .datepicker-dropdown:before { content: ''; display: inline-block; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 7px solid #ccc; border-top: 0; border-bottom-color: rgba(0, 0, 0, 0.2); position: absolute; } .datepicker-dropdown:after { content: ''; display: inline-block; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 6px solid #fff; border-top: 0; position: absolute; } .datepicker-dropdown.datepicker-orient-left:before { left: 6px; } .datepicker-dropdown.datepicker-orient-left:after { left: 7px; } .datepicker-dropdown.datepicker-orient-right:before { right: 6px; } .datepicker-dropdown.datepicker-orient-right:after { right: 7px; } .datepicker-dropdown.datepicker-orient-top:before { top: -7px; } .datepicker-dropdown.datepicker-orient-top:after { top: -6px; } .datepicker-dropdown.datepicker-orient-bottom:before { bottom: -7px; border-bottom: 0; border-top: 7px solid #999; } .datepicker-dropdown.datepicker-orient-bottom:after { bottom: -6px; border-bottom: 0; border-top: 6px solid #fff; } .datepicker > div { display: none; } .datepicker.days div.datepicker-days { display: block; } .datepicker.months div.datepicker-months { display: block; } .datepicker.years div.datepicker-years { display: block; } .datepicker table { margin: 0; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .datepicker table tr td, .datepicker table tr th { text-align: center; width: 30px; height: 30px; border-radius: 4px; border: none; } .table-striped .datepicker table tr td, .table-striped .datepicker table tr th { background-color: transparent; } .datepicker table tr td.day:hover, .datepicker table tr td.day.focused { background: rgba(0,0,0,0.2); cursor: pointer; } .datepicker table tr td.old, .datepicker table tr td.new { color: #777; } .datepicker table tr td.disabled, .datepicker table tr td.disabled:hover { background: none; color: #444; cursor: default; } .datepicker table tr td.today, .datepicker table tr td.today:hover, .datepicker table tr td.today.disabled, .datepicker table tr td.today.disabled:hover { color: #000000; background: rgba(0,0,0,0.2); border-color: #ffb733; } .datepicker table tr td.today:hover, .datepicker table tr td.today:hover:hover, .datepicker table tr td.today.disabled:hover, .datepicker table tr td.today.disabled:hover:hover, .datepicker table tr td.today:focus, .datepicker table tr td.today:hover:focus, .datepicker table tr td.today.disabled:focus, .datepicker table tr td.today.disabled:hover:focus, .datepicker table tr td.today:active, .datepicker table tr td.today:hover:active, .datepicker table tr td.today.disabled:active, .datepicker table tr td.today.disabled:hover:active, .datepicker table tr td.today.active, .datepicker table tr td.today:hover.active, .datepicker table tr td.today.disabled.active, .datepicker table tr td.today.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td.today, .open .dropdown-toggle.datepicker table tr td.today:hover, .open .dropdown-toggle.datepicker table tr td.today.disabled, .open .dropdown-toggle.datepicker table tr td.today.disabled:hover { color: #000000; background: rgba(0,0,0,0.2); border-color: #f59e00; } .datepicker table tr td.today:active, .datepicker table tr td.today:hover:active, .datepicker table tr td.today.disabled:active, .datepicker table tr td.today.disabled:hover:active, .datepicker table tr td.today.active, .datepicker table tr td.today:hover.active, .datepicker table tr td.today.disabled.active, .datepicker table tr td.today.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td.today, .open .dropdown-toggle.datepicker table tr td.today:hover, .open .dropdown-toggle.datepicker table tr td.today.disabled, .open .dropdown-toggle.datepicker table tr td.today.disabled:hover { background-image: none; } .datepicker table tr td.today.disabled, .datepicker table tr td.today:hover.disabled, .datepicker table tr td.today.disabled.disabled, .datepicker table tr td.today.disabled:hover.disabled, .datepicker table tr td.today[disabled], .datepicker table tr td.today:hover[disabled], .datepicker table tr td.today.disabled[disabled], .datepicker table tr td.today.disabled:hover[disabled], fieldset[disabled] .datepicker table tr td.today, fieldset[disabled] .datepicker table tr td.today:hover, fieldset[disabled] .datepicker table tr td.today.disabled, fieldset[disabled] .datepicker table tr td.today.disabled:hover, .datepicker table tr td.today.disabled:hover, .datepicker table tr td.today:hover.disabled:hover, .datepicker table tr td.today.disabled.disabled:hover, .datepicker table tr td.today.disabled:hover.disabled:hover, .datepicker table tr td.today[disabled]:hover, .datepicker table tr td.today:hover[disabled]:hover, .datepicker table tr td.today.disabled[disabled]:hover, .datepicker table tr td.today.disabled:hover[disabled]:hover, fieldset[disabled] .datepicker table tr td.today:hover, fieldset[disabled] .datepicker table tr td.today:hover:hover, fieldset[disabled] .datepicker table tr td.today.disabled:hover, fieldset[disabled] .datepicker table tr td.today.disabled:hover:hover, .datepicker table tr td.today.disabled:focus, .datepicker table tr td.today:hover.disabled:focus, .datepicker table tr td.today.disabled.disabled:focus, .datepicker table tr td.today.disabled:hover.disabled:focus, .datepicker table tr td.today[disabled]:focus, .datepicker table tr td.today:hover[disabled]:focus, .datepicker table tr td.today.disabled[disabled]:focus, .datepicker table tr td.today.disabled:hover[disabled]:focus, fieldset[disabled] .datepicker table tr td.today:focus, fieldset[disabled] .datepicker table tr td.today:hover:focus, fieldset[disabled] .datepicker table tr td.today.disabled:focus, fieldset[disabled] .datepicker table tr td.today.disabled:hover:focus, .datepicker table tr td.today.disabled:active, .datepicker table tr td.today:hover.disabled:active, .datepicker table tr td.today.disabled.disabled:active, .datepicker table tr td.today.disabled:hover.disabled:active, .datepicker table tr td.today[disabled]:active, .datepicker table tr td.today:hover[disabled]:active, .datepicker table tr td.today.disabled[disabled]:active, .datepicker table tr td.today.disabled:hover[disabled]:active, fieldset[disabled] .datepicker table tr td.today:active, fieldset[disabled] .datepicker table tr td.today:hover:active, fieldset[disabled] .datepicker table tr td.today.disabled:active, fieldset[disabled] .datepicker table tr td.today.disabled:hover:active, .datepicker table tr td.today.disabled.active, .datepicker table tr td.today:hover.disabled.active, .datepicker table tr td.today.disabled.disabled.active, .datepicker table tr td.today.disabled:hover.disabled.active, .datepicker table tr td.today[disabled].active, .datepicker table tr td.today:hover[disabled].active, .datepicker table tr td.today.disabled[disabled].active, .datepicker table tr td.today.disabled:hover[disabled].active, fieldset[disabled] .datepicker table tr td.today.active, fieldset[disabled] .datepicker table tr td.today:hover.active, fieldset[disabled] .datepicker table tr td.today.disabled.active, fieldset[disabled] .datepicker table tr td.today.disabled:hover.active { background: rgba(0,0,0,0.2); border-color: #ffb733; } .datepicker table tr td.today:hover:hover { color: #000; } .datepicker table tr td.today.active:hover { color: #fff; } .datepicker table tr td.range, .datepicker table tr td.range:hover, .datepicker table tr td.range.disabled, .datepicker table tr td.range.disabled:hover { background: rgba(0,0,0,0.2); border-radius: 0; } .datepicker table tr td.range.today, .datepicker table tr td.range.today:hover, .datepicker table tr td.range.today.disabled, .datepicker table tr td.range.today.disabled:hover { color: #000000; background: rgba(0,0,0,0.2); border-color: #f1a417; border-radius: 0; } .datepicker table tr td.range.today:hover, .datepicker table tr td.range.today:hover:hover, .datepicker table tr td.range.today.disabled:hover, .datepicker table tr td.range.today.disabled:hover:hover, .datepicker table tr td.range.today:focus, .datepicker table tr td.range.today:hover:focus, .datepicker table tr td.range.today.disabled:focus, .datepicker table tr td.range.today.disabled:hover:focus, .datepicker table tr td.range.today:active, .datepicker table tr td.range.today:hover:active, .datepicker table tr td.range.today.disabled:active, .datepicker table tr td.range.today.disabled:hover:active, .datepicker table tr td.range.today.active, .datepicker table tr td.range.today:hover.active, .datepicker table tr td.range.today.disabled.active, .datepicker table tr td.range.today.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td.range.today, .open .dropdown-toggle.datepicker table tr td.range.today:hover, .open .dropdown-toggle.datepicker table tr td.range.today.disabled, .open .dropdown-toggle.datepicker table tr td.range.today.disabled:hover { color: #000000; background: rgba(0,0,0,0.2); border-color: #bf800c; } .datepicker table tr td.range.today:active, .datepicker table tr td.range.today:hover:active, .datepicker table tr td.range.today.disabled:active, .datepicker table tr td.range.today.disabled:hover:active, .datepicker table tr td.range.today.active, .datepicker table tr td.range.today:hover.active, .datepicker table tr td.range.today.disabled.active, .datepicker table tr td.range.today.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td.range.today, .open .dropdown-toggle.datepicker table tr td.range.today:hover, .open .dropdown-toggle.datepicker table tr td.range.today.disabled, .open .dropdown-toggle.datepicker table tr td.range.today.disabled:hover { background-image: none; } .datepicker table tr td.range.today.disabled, .datepicker table tr td.range.today:hover.disabled, .datepicker table tr td.range.today.disabled.disabled, .datepicker table tr td.range.today.disabled:hover.disabled, .datepicker table tr td.range.today[disabled], .datepicker table tr td.range.today:hover[disabled], .datepicker table tr td.range.today.disabled[disabled], .datepicker table tr td.range.today.disabled:hover[disabled], fieldset[disabled] .datepicker table tr td.range.today, fieldset[disabled] .datepicker table tr td.range.today:hover, fieldset[disabled] .datepicker table tr td.range.today.disabled, fieldset[disabled] .datepicker table tr td.range.today.disabled:hover, .datepicker table tr td.range.today.disabled:hover, .datepicker table tr td.range.today:hover.disabled:hover, .datepicker table tr td.range.today.disabled.disabled:hover, .datepicker table tr td.range.today.disabled:hover.disabled:hover, .datepicker table tr td.range.today[disabled]:hover, .datepicker table tr td.range.today:hover[disabled]:hover, .datepicker table tr td.range.today.disabled[disabled]:hover, .datepicker table tr td.range.today.disabled:hover[disabled]:hover, fieldset[disabled] .datepicker table tr td.range.today:hover, fieldset[disabled] .datepicker table tr td.range.today:hover:hover, fieldset[disabled] .datepicker table tr td.range.today.disabled:hover, fieldset[disabled] .datepicker table tr td.range.today.disabled:hover:hover, .datepicker table tr td.range.today.disabled:focus, .datepicker table tr td.range.today:hover.disabled:focus, .datepicker table tr td.range.today.disabled.disabled:focus, .datepicker table tr td.range.today.disabled:hover.disabled:focus, .datepicker table tr td.range.today[disabled]:focus, .datepicker table tr td.range.today:hover[disabled]:focus, .datepicker table tr td.range.today.disabled[disabled]:focus, .datepicker table tr td.range.today.disabled:hover[disabled]:focus, fieldset[disabled] .datepicker table tr td.range.today:focus, fieldset[disabled] .datepicker table tr td.range.today:hover:focus, fieldset[disabled] .datepicker table tr td.range.today.disabled:focus, fieldset[disabled] .datepicker table tr td.range.today.disabled:hover:focus, .datepicker table tr td.range.today.disabled:active, .datepicker table tr td.range.today:hover.disabled:active, .datepicker table tr td.range.today.disabled.disabled:active, .datepicker table tr td.range.today.disabled:hover.disabled:active, .datepicker table tr td.range.today[disabled]:active, .datepicker table tr td.range.today:hover[disabled]:active, .datepicker table tr td.range.today.disabled[disabled]:active, .datepicker table tr td.range.today.disabled:hover[disabled]:active, fieldset[disabled] .datepicker table tr td.range.today:active, fieldset[disabled] .datepicker table tr td.range.today:hover:active, fieldset[disabled] .datepicker table tr td.range.today.disabled:active, fieldset[disabled] .datepicker table tr td.range.today.disabled:hover:active, .datepicker table tr td.range.today.disabled.active, .datepicker table tr td.range.today:hover.disabled.active, .datepicker table tr td.range.today.disabled.disabled.active, .datepicker table tr td.range.today.disabled:hover.disabled.active, .datepicker table tr td.range.today[disabled].active, .datepicker table tr td.range.today:hover[disabled].active, .datepicker table tr td.range.today.disabled[disabled].active, .datepicker table tr td.range.today.disabled:hover[disabled].active, fieldset[disabled] .datepicker table tr td.range.today.active, fieldset[disabled] .datepicker table tr td.range.today:hover.active, fieldset[disabled] .datepicker table tr td.range.today.disabled.active, fieldset[disabled] .datepicker table tr td.range.today.disabled:hover.active { background: rgba(0,0,0,0.2); border-color: #f1a417; } .datepicker table tr td.selected, .datepicker table tr td.selected:hover, .datepicker table tr td.selected.disabled, .datepicker table tr td.selected.disabled:hover { color: #ffffff; background: rgba(0,0,0,0.2); border-color: #555555; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .datepicker table tr td.selected:hover, .datepicker table tr td.selected:hover:hover, .datepicker table tr td.selected.disabled:hover, .datepicker table tr td.selected.disabled:hover:hover, .datepicker table tr td.selected:focus, .datepicker table tr td.selected:hover:focus, .datepicker table tr td.selected.disabled:focus, .datepicker table tr td.selected.disabled:hover:focus, .datepicker table tr td.selected:active, .datepicker table tr td.selected:hover:active, .datepicker table tr td.selected.disabled:active, .datepicker table tr td.selected.disabled:hover:active, .datepicker table tr td.selected.active, .datepicker table tr td.selected:hover.active, .datepicker table tr td.selected.disabled.active, .datepicker table tr td.selected.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td.selected, .open .dropdown-toggle.datepicker table tr td.selected:hover, .open .dropdown-toggle.datepicker table tr td.selected.disabled, .open .dropdown-toggle.datepicker table tr td.selected.disabled:hover { color: #ffffff; background: rgba(0,0,0,0.2); border-color: #373737; } .datepicker table tr td.selected:active, .datepicker table tr td.selected:hover:active, .datepicker table tr td.selected.disabled:active, .datepicker table tr td.selected.disabled:hover:active, .datepicker table tr td.selected.active, .datepicker table tr td.selected:hover.active, .datepicker table tr td.selected.disabled.active, .datepicker table tr td.selected.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td.selected, .open .dropdown-toggle.datepicker table tr td.selected:hover, .open .dropdown-toggle.datepicker table tr td.selected.disabled, .open .dropdown-toggle.datepicker table tr td.selected.disabled:hover { background-image: none; } .datepicker table tr td.selected.disabled, .datepicker table tr td.selected:hover.disabled, .datepicker table tr td.selected.disabled.disabled, .datepicker table tr td.selected.disabled:hover.disabled, .datepicker table tr td.selected[disabled], .datepicker table tr td.selected:hover[disabled], .datepicker table tr td.selected.disabled[disabled], .datepicker table tr td.selected.disabled:hover[disabled], fieldset[disabled] .datepicker table tr td.selected, fieldset[disabled] .datepicker table tr td.selected:hover, fieldset[disabled] .datepicker table tr td.selected.disabled, fieldset[disabled] .datepicker table tr td.selected.disabled:hover, .datepicker table tr td.selected.disabled:hover, .datepicker table tr td.selected:hover.disabled:hover, .datepicker table tr td.selected.disabled.disabled:hover, .datepicker table tr td.selected.disabled:hover.disabled:hover, .datepicker table tr td.selected[disabled]:hover, .datepicker table tr td.selected:hover[disabled]:hover, .datepicker table tr td.selected.disabled[disabled]:hover, .datepicker table tr td.selected.disabled:hover[disabled]:hover, fieldset[disabled] .datepicker table tr td.selected:hover, fieldset[disabled] .datepicker table tr td.selected:hover:hover, fieldset[disabled] .datepicker table tr td.selected.disabled:hover, fieldset[disabled] .datepicker table tr td.selected.disabled:hover:hover, .datepicker table tr td.selected.disabled:focus, .datepicker table tr td.selected:hover.disabled:focus, .datepicker table tr td.selected.disabled.disabled:focus, .datepicker table tr td.selected.disabled:hover.disabled:focus, .datepicker table tr td.selected[disabled]:focus, .datepicker table tr td.selected:hover[disabled]:focus, .datepicker table tr td.selected.disabled[disabled]:focus, .datepicker table tr td.selected.disabled:hover[disabled]:focus, fieldset[disabled] .datepicker table tr td.selected:focus, fieldset[disabled] .datepicker table tr td.selected:hover:focus, fieldset[disabled] .datepicker table tr td.selected.disabled:focus, fieldset[disabled] .datepicker table tr td.selected.disabled:hover:focus, .datepicker table tr td.selected.disabled:active, .datepicker table tr td.selected:hover.disabled:active, .datepicker table tr td.selected.disabled.disabled:active, .datepicker table tr td.selected.disabled:hover.disabled:active, .datepicker table tr td.selected[disabled]:active, .datepicker table tr td.selected:hover[disabled]:active, .datepicker table tr td.selected.disabled[disabled]:active, .datepicker table tr td.selected.disabled:hover[disabled]:active, fieldset[disabled] .datepicker table tr td.selected:active, fieldset[disabled] .datepicker table tr td.selected:hover:active, fieldset[disabled] .datepicker table tr td.selected.disabled:active, fieldset[disabled] .datepicker table tr td.selected.disabled:hover:active, .datepicker table tr td.selected.disabled.active, .datepicker table tr td.selected:hover.disabled.active, .datepicker table tr td.selected.disabled.disabled.active, .datepicker table tr td.selected.disabled:hover.disabled.active, .datepicker table tr td.selected[disabled].active, .datepicker table tr td.selected:hover[disabled].active, .datepicker table tr td.selected.disabled[disabled].active, .datepicker table tr td.selected.disabled:hover[disabled].active, fieldset[disabled] .datepicker table tr td.selected.active, fieldset[disabled] .datepicker table tr td.selected:hover.active, fieldset[disabled] .datepicker table tr td.selected.disabled.active, fieldset[disabled] .datepicker table tr td.selected.disabled:hover.active { background: rgba(0,0,0,0.2); border-color: #555555; } .datepicker table tr td.active, .datepicker table tr td.active:hover, .datepicker table tr td.active.disabled, .datepicker table tr td.active.disabled:hover { color: #ffffff; background: rgba(0,0,0,0.2); border-color: #357ebd; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .datepicker table tr td.active:hover, .datepicker table tr td.active:hover:hover, .datepicker table tr td.active.disabled:hover, .datepicker table tr td.active.disabled:hover:hover, .datepicker table tr td.active:focus, .datepicker table tr td.active:hover:focus, .datepicker table tr td.active.disabled:focus, .datepicker table tr td.active.disabled:hover:focus, .datepicker table tr td.active:active, .datepicker table tr td.active:hover:active, .datepicker table tr td.active.disabled:active, .datepicker table tr td.active.disabled:hover:active, .datepicker table tr td.active.active, .datepicker table tr td.active:hover.active, .datepicker table tr td.active.disabled.active, .datepicker table tr td.active.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td.active, .open .dropdown-toggle.datepicker table tr td.active:hover, .open .dropdown-toggle.datepicker table tr td.active.disabled, .open .dropdown-toggle.datepicker table tr td.active.disabled:hover { color: #ffffff; background: rgba(0,0,0,0.5); border-color: #285e8e; } .datepicker table tr td.active:active, .datepicker table tr td.active:hover:active, .datepicker table tr td.active.disabled:active, .datepicker table tr td.active.disabled:hover:active, .datepicker table tr td.active.active, .datepicker table tr td.active:hover.active, .datepicker table tr td.active.disabled.active, .datepicker table tr td.active.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td.active, .open .dropdown-toggle.datepicker table tr td.active:hover, .open .dropdown-toggle.datepicker table tr td.active.disabled, .open .dropdown-toggle.datepicker table tr td.active.disabled:hover { background-image: none; } .datepicker table tr td.active.disabled, .datepicker table tr td.active:hover.disabled, .datepicker table tr td.active.disabled.disabled, .datepicker table tr td.active.disabled:hover.disabled, .datepicker table tr td.active[disabled], .datepicker table tr td.active:hover[disabled], .datepicker table tr td.active.disabled[disabled], .datepicker table tr td.active.disabled:hover[disabled], fieldset[disabled] .datepicker table tr td.active, fieldset[disabled] .datepicker table tr td.active:hover, fieldset[disabled] .datepicker table tr td.active.disabled, fieldset[disabled] .datepicker table tr td.active.disabled:hover, .datepicker table tr td.active.disabled:hover, .datepicker table tr td.active:hover.disabled:hover, .datepicker table tr td.active.disabled.disabled:hover, .datepicker table tr td.active.disabled:hover.disabled:hover, .datepicker table tr td.active[disabled]:hover, .datepicker table tr td.active:hover[disabled]:hover, .datepicker table tr td.active.disabled[disabled]:hover, .datepicker table tr td.active.disabled:hover[disabled]:hover, fieldset[disabled] .datepicker table tr td.active:hover, fieldset[disabled] .datepicker table tr td.active:hover:hover, fieldset[disabled] .datepicker table tr td.active.disabled:hover, fieldset[disabled] .datepicker table tr td.active.disabled:hover:hover, .datepicker table tr td.active.disabled:focus, .datepicker table tr td.active:hover.disabled:focus, .datepicker table tr td.active.disabled.disabled:focus, .datepicker table tr td.active.disabled:hover.disabled:focus, .datepicker table tr td.active[disabled]:focus, .datepicker table tr td.active:hover[disabled]:focus, .datepicker table tr td.active.disabled[disabled]:focus, .datepicker table tr td.active.disabled:hover[disabled]:focus, fieldset[disabled] .datepicker table tr td.active:focus, fieldset[disabled] .datepicker table tr td.active:hover:focus, fieldset[disabled] .datepicker table tr td.active.disabled:focus, fieldset[disabled] .datepicker table tr td.active.disabled:hover:focus, .datepicker table tr td.active.disabled:active, .datepicker table tr td.active:hover.disabled:active, .datepicker table tr td.active.disabled.disabled:active, .datepicker table tr td.active.disabled:hover.disabled:active, .datepicker table tr td.active[disabled]:active, .datepicker table tr td.active:hover[disabled]:active, .datepicker table tr td.active.disabled[disabled]:active, .datepicker table tr td.active.disabled:hover[disabled]:active, fieldset[disabled] .datepicker table tr td.active:active, fieldset[disabled] .datepicker table tr td.active:hover:active, fieldset[disabled] .datepicker table tr td.active.disabled:active, fieldset[disabled] .datepicker table tr td.active.disabled:hover:active, .datepicker table tr td.active.disabled.active, .datepicker table tr td.active:hover.disabled.active, .datepicker table tr td.active.disabled.disabled.active, .datepicker table tr td.active.disabled:hover.disabled.active, .datepicker table tr td.active[disabled].active, .datepicker table tr td.active:hover[disabled].active, .datepicker table tr td.active.disabled[disabled].active, .datepicker table tr td.active.disabled:hover[disabled].active, fieldset[disabled] .datepicker table tr td.active.active, fieldset[disabled] .datepicker table tr td.active:hover.active, fieldset[disabled] .datepicker table tr td.active.disabled.active, fieldset[disabled] .datepicker table tr td.active.disabled:hover.active { background-color: #428bca; border-color: #357ebd; } .datepicker table tr td span { display: block; width: 23%; height: 54px; line-height: 54px; float: left; margin: 1%; cursor: pointer; border-radius: 4px; } .datepicker table tr td span:hover { background: rgba(0,0,0,0.2); } .datepicker table tr td span.disabled, .datepicker table tr td span.disabled:hover { background: none; color: #444; cursor: default; } .datepicker table tr td span.active, .datepicker table tr td span.active:hover, .datepicker table tr td span.active.disabled, .datepicker table tr td span.active.disabled:hover { color: #ffffff; background-color: #428bca; border-color: #357ebd; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .datepicker table tr td span.active:hover, .datepicker table tr td span.active:hover:hover, .datepicker table tr td span.active.disabled:hover, .datepicker table tr td span.active.disabled:hover:hover, .datepicker table tr td span.active:focus, .datepicker table tr td span.active:hover:focus, .datepicker table tr td span.active.disabled:focus, .datepicker table tr td span.active.disabled:hover:focus, .datepicker table tr td span.active:active, .datepicker table tr td span.active:hover:active, .datepicker table tr td span.active.disabled:active, .datepicker table tr td span.active.disabled:hover:active, .datepicker table tr td span.active.active, .datepicker table tr td span.active:hover.active, .datepicker table tr td span.active.disabled.active, .datepicker table tr td span.active.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td span.active, .open .dropdown-toggle.datepicker table tr td span.active:hover, .open .dropdown-toggle.datepicker table tr td span.active.disabled, .open .dropdown-toggle.datepicker table tr td span.active.disabled:hover { color: #ffffff; background-color: #3276b1; border-color: #285e8e; } .datepicker table tr td span.active:active, .datepicker table tr td span.active:hover:active, .datepicker table tr td span.active.disabled:active, .datepicker table tr td span.active.disabled:hover:active, .datepicker table tr td span.active.active, .datepicker table tr td span.active:hover.active, .datepicker table tr td span.active.disabled.active, .datepicker table tr td span.active.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td span.active, .open .dropdown-toggle.datepicker table tr td span.active:hover, .open .dropdown-toggle.datepicker table tr td span.active.disabled, .open .dropdown-toggle.datepicker table tr td span.active.disabled:hover { background-image: none; } .datepicker table tr td span.active.disabled, .datepicker table tr td span.active:hover.disabled, .datepicker table tr td span.active.disabled.disabled, .datepicker table tr td span.active.disabled:hover.disabled, .datepicker table tr td span.active[disabled], .datepicker table tr td span.active:hover[disabled], .datepicker table tr td span.active.disabled[disabled], .datepicker table tr td span.active.disabled:hover[disabled], fieldset[disabled] .datepicker table tr td span.active, fieldset[disabled] .datepicker table tr td span.active:hover, fieldset[disabled] .datepicker table tr td span.active.disabled, fieldset[disabled] .datepicker table tr td span.active.disabled:hover, .datepicker table tr td span.active.disabled:hover, .datepicker table tr td span.active:hover.disabled:hover, .datepicker table tr td span.active.disabled.disabled:hover, .datepicker table tr td span.active.disabled:hover.disabled:hover, .datepicker table tr td span.active[disabled]:hover, .datepicker table tr td span.active:hover[disabled]:hover, .datepicker table tr td span.active.disabled[disabled]:hover, .datepicker table tr td span.active.disabled:hover[disabled]:hover, fieldset[disabled] .datepicker table tr td span.active:hover, fieldset[disabled] .datepicker table tr td span.active:hover:hover, fieldset[disabled] .datepicker table tr td span.active.disabled:hover, fieldset[disabled] .datepicker table tr td span.active.disabled:hover:hover, .datepicker table tr td span.active.disabled:focus, .datepicker table tr td span.active:hover.disabled:focus, .datepicker table tr td span.active.disabled.disabled:focus, .datepicker table tr td span.active.disabled:hover.disabled:focus, .datepicker table tr td span.active[disabled]:focus, .datepicker table tr td span.active:hover[disabled]:focus, .datepicker table tr td span.active.disabled[disabled]:focus, .datepicker table tr td span.active.disabled:hover[disabled]:focus, fieldset[disabled] .datepicker table tr td span.active:focus, fieldset[disabled] .datepicker table tr td span.active:hover:focus, fieldset[disabled] .datepicker table tr td span.active.disabled:focus, fieldset[disabled] .datepicker table tr td span.active.disabled:hover:focus, .datepicker table tr td span.active.disabled:active, .datepicker table tr td span.active:hover.disabled:active, .datepicker table tr td span.active.disabled.disabled:active, .datepicker table tr td span.active.disabled:hover.disabled:active, .datepicker table tr td span.active[disabled]:active, .datepicker table tr td span.active:hover[disabled]:active, .datepicker table tr td span.active.disabled[disabled]:active, .datepicker table tr td span.active.disabled:hover[disabled]:active, fieldset[disabled] .datepicker table tr td span.active:active, fieldset[disabled] .datepicker table tr td span.active:hover:active, fieldset[disabled] .datepicker table tr td span.active.disabled:active, fieldset[disabled] .datepicker table tr td span.active.disabled:hover:active, .datepicker table tr td span.active.disabled.active, .datepicker table tr td span.active:hover.disabled.active, .datepicker table tr td span.active.disabled.disabled.active, .datepicker table tr td span.active.disabled:hover.disabled.active, .datepicker table tr td span.active[disabled].active, .datepicker table tr td span.active:hover[disabled].active, .datepicker table tr td span.active.disabled[disabled].active, .datepicker table tr td span.active.disabled:hover[disabled].active, fieldset[disabled] .datepicker table tr td span.active.active, fieldset[disabled] .datepicker table tr td span.active:hover.active, fieldset[disabled] .datepicker table tr td span.active.disabled.active, fieldset[disabled] .datepicker table tr td span.active.disabled:hover.active { background-color: #428bca; border-color: #357ebd; } .datepicker table tr td span.old, .datepicker table tr td span.new { color: #444; } .datepicker th.datepicker-switch { width: 145px; } .datepicker thead tr:first-child th, .datepicker tfoot tr th { cursor: pointer; } .datepicker thead tr:first-child th:hover, .datepicker tfoot tr th:hover { background: rgba(0,0,0,0.2); } .datepicker .cw { font-size: 10px; width: 12px; padding: 0 2px 0 5px; vertical-align: middle; } .datepicker thead tr:first-child th.cw { cursor: default; background-color: transparent; } .input-group.date .input-group-addon i { cursor: pointer; width: 16px; height: 16px; } .input-daterange input { text-align: center; } .input-daterange input:first-child { border-radius: 3px 0 0 3px; } .input-daterange input:last-child { border-radius: 0 3px 3px 0; } .input-daterange .input-group-addon { width: auto; min-width: 16px; padding: 4px 5px; font-weight: normal; line-height: 1.428571429; text-align: center; text-shadow: 0 1px 0 #fff; vertical-align: middle; background-color: #eeeeee; border: solid #cccccc; border-width: 1px 0; margin-left: -5px; margin-right: -5px; } .datepicker.dropdown-menu { position: absolute; top: 100%; left: 0; z-index: 1000; float: left; display: none; min-width: 160px; list-style: none; background-color: #ffffff; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.2); border-radius: 5px; -webkit-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); -webkit-background-clip: padding-box; -moz-background-clip: padding; background-clip: padding-box; *border-right-width: 2px; *border-bottom-width: 2px; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px; line-height: 1.428571429; } .datepicker.dropdown-menu th, .datepicker.dropdown-menu td { padding: 4px 5px; }
2881099/FreeScheduler
46,838
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/datepicker/bootstrap-datepicker.js
/* ========================================================= * bootstrap-datepicker.js * Repo: https://github.com/eternicode/bootstrap-datepicker/ * Demo: http://eternicode.github.io/bootstrap-datepicker/ * Docs: http://bootstrap-datepicker.readthedocs.org/ * Forked from http://www.eyecon.ro/bootstrap-datepicker * ========================================================= * Started by Stefan Petre; improvements by Andrew Rowls + contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================= */ (function($, undefined){ var $window = $(window); function UTCDate(){ return new Date(Date.UTC.apply(Date, arguments)); } function UTCToday(){ var today = new Date(); return UTCDate(today.getFullYear(), today.getMonth(), today.getDate()); } function alias(method){ return function(){ return this[method].apply(this, arguments); }; } var DateArray = (function(){ var extras = { get: function(i){ return this.slice(i)[0]; }, contains: function(d){ // Array.indexOf is not cross-browser; // $.inArray doesn't work with Dates var val = d && d.valueOf(); for (var i=0, l=this.length; i < l; i++) if (this[i].valueOf() === val) return i; return -1; }, remove: function(i){ this.splice(i,1); }, replace: function(new_array){ if (!new_array) return; if (!$.isArray(new_array)) new_array = [new_array]; this.clear(); this.push.apply(this, new_array); }, clear: function(){ this.splice(0); }, copy: function(){ var a = new DateArray(); a.replace(this); return a; } }; return function(){ var a = []; a.push.apply(a, arguments); $.extend(a, extras); return a; }; })(); // Picker object var Datepicker = function(element, options){ this.dates = new DateArray(); this.viewDate = UTCToday(); this.focusDate = null; this._process_options(options); this.element = $(element); this.isInline = false; this.isInput = this.element.is('input'); this.component = this.element.is('.date') ? this.element.find('.add-on, .input-group-addon, .btn') : false; this.hasInput = this.component && this.element.find('input').length; if (this.component && this.component.length === 0) this.component = false; this.picker = $(DPGlobal.template); this._buildEvents(); this._attachEvents(); if (this.isInline){ this.picker.addClass('datepicker-inline').appendTo(this.element); } else { this.picker.addClass('datepicker-dropdown dropdown-menu'); } if (this.o.rtl){ this.picker.addClass('datepicker-rtl'); } this.viewMode = this.o.startView; if (this.o.calendarWeeks) this.picker.find('tfoot th.today') .attr('colspan', function(i, val){ return parseInt(val) + 1; }); this._allow_update = false; this.setStartDate(this._o.startDate); this.setEndDate(this._o.endDate); this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled); this.fillDow(); this.fillMonths(); this._allow_update = true; this.update(); this.showMode(); if (this.isInline){ this.show(); } }; Datepicker.prototype = { constructor: Datepicker, _process_options: function(opts){ // Store raw options for reference this._o = $.extend({}, this._o, opts); // Processed options var o = this.o = $.extend({}, this._o); // Check if "de-DE" style date is available, if not language should // fallback to 2 letter code eg "de" var lang = o.language; if (!dates[lang]){ lang = lang.split('-')[0]; if (!dates[lang]) lang = defaults.language; } o.language = lang; switch (o.startView){ case 2: case 'decade': o.startView = 2; break; case 1: case 'year': o.startView = 1; break; default: o.startView = 0; } switch (o.minViewMode){ case 1: case 'months': o.minViewMode = 1; break; case 2: case 'years': o.minViewMode = 2; break; default: o.minViewMode = 0; } o.startView = Math.max(o.startView, o.minViewMode); // true, false, or Number > 0 if (o.multidate !== true){ o.multidate = Number(o.multidate) || false; if (o.multidate !== false) o.multidate = Math.max(0, o.multidate); else o.multidate = 1; } o.multidateSeparator = String(o.multidateSeparator); o.weekStart %= 7; o.weekEnd = ((o.weekStart + 6) % 7); var format = DPGlobal.parseFormat(o.format); if (o.startDate !== -Infinity){ if (!!o.startDate){ if (o.startDate instanceof Date) o.startDate = this._local_to_utc(this._zero_time(o.startDate)); else o.startDate = DPGlobal.parseDate(o.startDate, format, o.language); } else { o.startDate = -Infinity; } } if (o.endDate !== Infinity){ if (!!o.endDate){ if (o.endDate instanceof Date) o.endDate = this._local_to_utc(this._zero_time(o.endDate)); else o.endDate = DPGlobal.parseDate(o.endDate, format, o.language); } else { o.endDate = Infinity; } } o.daysOfWeekDisabled = o.daysOfWeekDisabled||[]; if (!$.isArray(o.daysOfWeekDisabled)) o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/); o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function(d){ return parseInt(d, 10); }); var plc = String(o.orientation).toLowerCase().split(/\s+/g), _plc = o.orientation.toLowerCase(); plc = $.grep(plc, function(word){ return (/^auto|left|right|top|bottom$/).test(word); }); o.orientation = {x: 'auto', y: 'auto'}; if (!_plc || _plc === 'auto') ; // no action else if (plc.length === 1){ switch (plc[0]){ case 'top': case 'bottom': o.orientation.y = plc[0]; break; case 'left': case 'right': o.orientation.x = plc[0]; break; } } else { _plc = $.grep(plc, function(word){ return (/^left|right$/).test(word); }); o.orientation.x = _plc[0] || 'auto'; _plc = $.grep(plc, function(word){ return (/^top|bottom$/).test(word); }); o.orientation.y = _plc[0] || 'auto'; } }, _events: [], _secondaryEvents: [], _applyEvents: function(evs){ for (var i=0, el, ch, ev; i < evs.length; i++){ el = evs[i][0]; if (evs[i].length === 2){ ch = undefined; ev = evs[i][1]; } else if (evs[i].length === 3){ ch = evs[i][1]; ev = evs[i][2]; } el.on(ev, ch); } }, _unapplyEvents: function(evs){ for (var i=0, el, ev, ch; i < evs.length; i++){ el = evs[i][0]; if (evs[i].length === 2){ ch = undefined; ev = evs[i][1]; } else if (evs[i].length === 3){ ch = evs[i][1]; ev = evs[i][2]; } el.off(ev, ch); } }, _buildEvents: function(){ if (this.isInput){ // single input this._events = [ [this.element, { focus: $.proxy(this.show, this), keyup: $.proxy(function(e){ if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1) this.update(); }, this), keydown: $.proxy(this.keydown, this) }] ]; } else if (this.component && this.hasInput){ // component: input + button this._events = [ // For components that are not readonly, allow keyboard nav [this.element.find('input'), { focus: $.proxy(this.show, this), keyup: $.proxy(function(e){ if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1) this.update(); }, this), keydown: $.proxy(this.keydown, this) }], [this.component, { click: $.proxy(this.show, this) }] ]; } else if (this.element.is('div')){ // inline datepicker this.isInline = true; } else { this._events = [ [this.element, { click: $.proxy(this.show, this) }] ]; } this._events.push( // Component: listen for blur on element descendants [this.element, '*', { blur: $.proxy(function(e){ this._focused_from = e.target; }, this) }], // Input: listen for blur on element [this.element, { blur: $.proxy(function(e){ this._focused_from = e.target; }, this) }] ); this._secondaryEvents = [ [this.picker, { click: $.proxy(this.click, this) }], [$(window), { resize: $.proxy(this.place, this) }], [$(document), { 'mousedown touchstart': $.proxy(function(e){ // Clicked outside the datepicker, hide it if (!( this.element.is(e.target) || this.element.find(e.target).length || this.picker.is(e.target) || this.picker.find(e.target).length )){ this.hide(); } }, this) }] ]; }, _attachEvents: function(){ this._detachEvents(); this._applyEvents(this._events); }, _detachEvents: function(){ this._unapplyEvents(this._events); }, _attachSecondaryEvents: function(){ this._detachSecondaryEvents(); this._applyEvents(this._secondaryEvents); }, _detachSecondaryEvents: function(){ this._unapplyEvents(this._secondaryEvents); }, _trigger: function(event, altdate){ var date = altdate || this.dates.get(-1), local_date = this._utc_to_local(date); this.element.trigger({ type: event, date: local_date, dates: $.map(this.dates, this._utc_to_local), format: $.proxy(function(ix, format){ if (arguments.length === 0){ ix = this.dates.length - 1; format = this.o.format; } else if (typeof ix === 'string'){ format = ix; ix = this.dates.length - 1; } format = format || this.o.format; var date = this.dates.get(ix); return DPGlobal.formatDate(date, format, this.o.language); }, this) }); }, show: function(){ if (!this.isInline) this.picker.appendTo('body'); this.picker.show(); this.place(); this._attachSecondaryEvents(); this._trigger('show'); }, hide: function(){ if (this.isInline) return; if (!this.picker.is(':visible')) return; this.focusDate = null; this.picker.hide().detach(); this._detachSecondaryEvents(); this.viewMode = this.o.startView; this.showMode(); if ( this.o.forceParse && ( this.isInput && this.element.val() || this.hasInput && this.element.find('input').val() ) ) this.setValue(); this._trigger('hide'); }, remove: function(){ this.hide(); this._detachEvents(); this._detachSecondaryEvents(); this.picker.remove(); delete this.element.data().datepicker; if (!this.isInput){ delete this.element.data().date; } }, _utc_to_local: function(utc){ return utc && new Date(utc.getTime() + (utc.getTimezoneOffset()*60000)); }, _local_to_utc: function(local){ return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000)); }, _zero_time: function(local){ return local && new Date(local.getFullYear(), local.getMonth(), local.getDate()); }, _zero_utc_time: function(utc){ return utc && new Date(Date.UTC(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate())); }, getDates: function(){ return $.map(this.dates, this._utc_to_local); }, getUTCDates: function(){ return $.map(this.dates, function(d){ return new Date(d); }); }, getDate: function(){ return this._utc_to_local(this.getUTCDate()); }, getUTCDate: function(){ return new Date(this.dates.get(-1)); }, setDates: function(){ var args = $.isArray(arguments[0]) ? arguments[0] : arguments; this.update.apply(this, args); this._trigger('changeDate'); this.setValue(); }, setUTCDates: function(){ var args = $.isArray(arguments[0]) ? arguments[0] : arguments; this.update.apply(this, $.map(args, this._utc_to_local)); this._trigger('changeDate'); this.setValue(); }, setDate: alias('setDates'), setUTCDate: alias('setUTCDates'), setValue: function(){ var formatted = this.getFormattedDate(); if (!this.isInput){ if (this.component){ this.element.find('input').val(formatted).change(); } } else { this.element.val(formatted).change(); } }, getFormattedDate: function(format){ if (format === undefined) format = this.o.format; var lang = this.o.language; return $.map(this.dates, function(d){ return DPGlobal.formatDate(d, format, lang); }).join(this.o.multidateSeparator); }, setStartDate: function(startDate){ this._process_options({startDate: startDate}); this.update(); this.updateNavArrows(); }, setEndDate: function(endDate){ this._process_options({endDate: endDate}); this.update(); this.updateNavArrows(); }, setDaysOfWeekDisabled: function(daysOfWeekDisabled){ this._process_options({daysOfWeekDisabled: daysOfWeekDisabled}); this.update(); this.updateNavArrows(); }, place: function(){ if (this.isInline) return; var calendarWidth = this.picker.outerWidth(), calendarHeight = this.picker.outerHeight(), visualPadding = 10, windowWidth = $window.width(), windowHeight = $window.height(), scrollTop = $window.scrollTop(); var zIndex = parseInt(this.element.parents().filter(function(){ return $(this).css('z-index') !== 'auto'; }).first().css('z-index'))+10; var offset = this.component ? this.component.parent().offset() : this.element.offset(); var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false); var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false); var left = offset.left, top = offset.top; this.picker.removeClass( 'datepicker-orient-top datepicker-orient-bottom '+ 'datepicker-orient-right datepicker-orient-left' ); if (this.o.orientation.x !== 'auto'){ this.picker.addClass('datepicker-orient-' + this.o.orientation.x); if (this.o.orientation.x === 'right') left -= calendarWidth - width; } // auto x orientation is best-placement: if it crosses a window // edge, fudge it sideways else { // Default to left this.picker.addClass('datepicker-orient-left'); if (offset.left < 0) left -= offset.left - visualPadding; else if (offset.left + calendarWidth > windowWidth) left = windowWidth - calendarWidth - visualPadding; } // auto y orientation is best-situation: top or bottom, no fudging, // decision based on which shows more of the calendar var yorient = this.o.orientation.y, top_overflow, bottom_overflow; if (yorient === 'auto'){ top_overflow = -scrollTop + offset.top - calendarHeight; bottom_overflow = scrollTop + windowHeight - (offset.top + height + calendarHeight); if (Math.max(top_overflow, bottom_overflow) === bottom_overflow) yorient = 'top'; else yorient = 'bottom'; } this.picker.addClass('datepicker-orient-' + yorient); if (yorient === 'top') top += height; else top -= calendarHeight + parseInt(this.picker.css('padding-top')); this.picker.css({ top: top, left: left, zIndex: zIndex }); }, _allow_update: true, update: function(){ if (!this._allow_update) return; var oldDates = this.dates.copy(), dates = [], fromArgs = false; if (arguments.length){ $.each(arguments, $.proxy(function(i, date){ if (date instanceof Date) date = this._local_to_utc(date); dates.push(date); }, this)); fromArgs = true; } else { dates = this.isInput ? this.element.val() : this.element.data('date') || this.element.find('input').val(); if (dates && this.o.multidate) dates = dates.split(this.o.multidateSeparator); else dates = [dates]; delete this.element.data().date; } dates = $.map(dates, $.proxy(function(date){ return DPGlobal.parseDate(date, this.o.format, this.o.language); }, this)); dates = $.grep(dates, $.proxy(function(date){ return ( date < this.o.startDate || date > this.o.endDate || !date ); }, this), true); this.dates.replace(dates); if (this.dates.length) this.viewDate = new Date(this.dates.get(-1)); else if (this.viewDate < this.o.startDate) this.viewDate = new Date(this.o.startDate); else if (this.viewDate > this.o.endDate) this.viewDate = new Date(this.o.endDate); if (fromArgs){ // setting date by clicking this.setValue(); } else if (dates.length){ // setting date by typing if (String(oldDates) !== String(this.dates)) this._trigger('changeDate'); } if (!this.dates.length && oldDates.length) this._trigger('clearDate'); this.fill(); }, fillDow: function(){ var dowCnt = this.o.weekStart, html = '<tr>'; if (this.o.calendarWeeks){ var cell = '<th class="cw">&nbsp;</th>'; html += cell; this.picker.find('.datepicker-days thead tr:first-child').prepend(cell); } while (dowCnt < this.o.weekStart + 7){ html += '<th class="dow">'+dates[this.o.language].daysMin[(dowCnt++)%7]+'</th>'; } html += '</tr>'; this.picker.find('.datepicker-days thead').append(html); }, fillMonths: function(){ var html = '', i = 0; while (i < 12){ html += '<span class="month">'+dates[this.o.language].monthsShort[i++]+'</span>'; } this.picker.find('.datepicker-months td').html(html); }, setRange: function(range){ if (!range || !range.length) delete this.range; else this.range = $.map(range, function(d){ return d.valueOf(); }); this.fill(); }, getClassNames: function(date){ var cls = [], year = this.viewDate.getUTCFullYear(), month = this.viewDate.getUTCMonth(), today = new Date(); if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){ cls.push('old'); } else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){ cls.push('new'); } if (this.focusDate && date.valueOf() === this.focusDate.valueOf()) cls.push('focused'); // Compare internal UTC date with local today, not UTC today if (this.o.todayHighlight && date.getUTCFullYear() === today.getFullYear() && date.getUTCMonth() === today.getMonth() && date.getUTCDate() === today.getDate()){ cls.push('today'); } if (this.dates.contains(date) !== -1) cls.push('active'); if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate || $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1){ cls.push('disabled'); } if (this.range){ if (date > this.range[0] && date < this.range[this.range.length-1]){ cls.push('range'); } if ($.inArray(date.valueOf(), this.range) !== -1){ cls.push('selected'); } } return cls; }, fill: function(){ var d = new Date(this.viewDate), year = d.getUTCFullYear(), month = d.getUTCMonth(), startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity, startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity, endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity, endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity, todaytxt = dates[this.o.language].today || dates['en'].today || '', cleartxt = dates[this.o.language].clear || dates['en'].clear || '', tooltip; this.picker.find('.datepicker-days thead th.datepicker-switch') .text(dates[this.o.language].months[month]+' '+year); this.picker.find('tfoot th.today') .text(todaytxt) .toggle(this.o.todayBtn !== false); this.picker.find('tfoot th.clear') .text(cleartxt) .toggle(this.o.clearBtn !== false); this.updateNavArrows(); this.fillMonths(); var prevMonth = UTCDate(year, month-1, 28), day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth()); prevMonth.setUTCDate(day); prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7); var nextMonth = new Date(prevMonth); nextMonth.setUTCDate(nextMonth.getUTCDate() + 42); nextMonth = nextMonth.valueOf(); var html = []; var clsName; while (prevMonth.valueOf() < nextMonth){ if (prevMonth.getUTCDay() === this.o.weekStart){ html.push('<tr>'); if (this.o.calendarWeeks){ // ISO 8601: First week contains first thursday. // ISO also states week starts on Monday, but we can be more abstract here. var // Start of current week: based on weekstart/current date ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5), // Thursday of this week th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5), // First Thursday of year, year from thursday yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5), // Calendar week: ms between thursdays, div ms per day, div 7 days calWeek = (th - yth) / 864e5 / 7 + 1; html.push('<td class="cw">'+ calWeek +'</td>'); } } clsName = this.getClassNames(prevMonth); clsName.push('day'); if (this.o.beforeShowDay !== $.noop){ var before = this.o.beforeShowDay(this._utc_to_local(prevMonth)); if (before === undefined) before = {}; else if (typeof(before) === 'boolean') before = {enabled: before}; else if (typeof(before) === 'string') before = {classes: before}; if (before.enabled === false) clsName.push('disabled'); if (before.classes) clsName = clsName.concat(before.classes.split(/\s+/)); if (before.tooltip) tooltip = before.tooltip; } clsName = $.unique(clsName); html.push('<td class="'+clsName.join(' ')+'"' + (tooltip ? ' title="'+tooltip+'"' : '') + '>'+prevMonth.getUTCDate() + '</td>'); if (prevMonth.getUTCDay() === this.o.weekEnd){ html.push('</tr>'); } prevMonth.setUTCDate(prevMonth.getUTCDate()+1); } this.picker.find('.datepicker-days tbody').empty().append(html.join('')); var months = this.picker.find('.datepicker-months') .find('th:eq(1)') .text(year) .end() .find('span').removeClass('active'); $.each(this.dates, function(i, d){ if (d.getUTCFullYear() === year) months.eq(d.getUTCMonth()).addClass('active'); }); if (year < startYear || year > endYear){ months.addClass('disabled'); } if (year === startYear){ months.slice(0, startMonth).addClass('disabled'); } if (year === endYear){ months.slice(endMonth+1).addClass('disabled'); } html = ''; year = parseInt(year/10, 10) * 10; var yearCont = this.picker.find('.datepicker-years') .find('th:eq(1)') .text(year + '-' + (year + 9)) .end() .find('td'); year -= 1; var years = $.map(this.dates, function(d){ return d.getUTCFullYear(); }), classes; for (var i = -1; i < 11; i++){ classes = ['year']; if (i === -1) classes.push('old'); else if (i === 10) classes.push('new'); if ($.inArray(year, years) !== -1) classes.push('active'); if (year < startYear || year > endYear) classes.push('disabled'); html += '<span class="' + classes.join(' ') + '">'+year+'</span>'; year += 1; } yearCont.html(html); }, updateNavArrows: function(){ if (!this._allow_update) return; var d = new Date(this.viewDate), year = d.getUTCFullYear(), month = d.getUTCMonth(); switch (this.viewMode){ case 0: if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()){ this.picker.find('.prev').css({visibility: 'hidden'}); } else { this.picker.find('.prev').css({visibility: 'visible'}); } if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()){ this.picker.find('.next').css({visibility: 'hidden'}); } else { this.picker.find('.next').css({visibility: 'visible'}); } break; case 1: case 2: if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()){ this.picker.find('.prev').css({visibility: 'hidden'}); } else { this.picker.find('.prev').css({visibility: 'visible'}); } if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()){ this.picker.find('.next').css({visibility: 'hidden'}); } else { this.picker.find('.next').css({visibility: 'visible'}); } break; } }, click: function(e){ e.preventDefault(); var target = $(e.target).closest('span, td, th'), year, month, day; if (target.length === 1){ switch (target[0].nodeName.toLowerCase()){ case 'th': switch (target[0].className){ case 'datepicker-switch': this.showMode(1); break; case 'prev': case 'next': var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1); switch (this.viewMode){ case 0: this.viewDate = this.moveMonth(this.viewDate, dir); this._trigger('changeMonth', this.viewDate); break; case 1: case 2: this.viewDate = this.moveYear(this.viewDate, dir); if (this.viewMode === 1) this._trigger('changeYear', this.viewDate); break; } this.fill(); break; case 'today': var date = new Date(); date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); this.showMode(-2); var which = this.o.todayBtn === 'linked' ? null : 'view'; this._setDate(date, which); break; case 'clear': var element; if (this.isInput) element = this.element; else if (this.component) element = this.element.find('input'); if (element) element.val("").change(); this.update(); this._trigger('changeDate'); if (this.o.autoclose) this.hide(); break; } break; case 'span': if (!target.is('.disabled')){ this.viewDate.setUTCDate(1); if (target.is('.month')){ day = 1; month = target.parent().find('span').index(target); year = this.viewDate.getUTCFullYear(); this.viewDate.setUTCMonth(month); this._trigger('changeMonth', this.viewDate); if (this.o.minViewMode === 1){ this._setDate(UTCDate(year, month, day)); } } else { day = 1; month = 0; year = parseInt(target.text(), 10)||0; this.viewDate.setUTCFullYear(year); this._trigger('changeYear', this.viewDate); if (this.o.minViewMode === 2){ this._setDate(UTCDate(year, month, day)); } } this.showMode(-1); this.fill(); } break; case 'td': if (target.is('.day') && !target.is('.disabled')){ day = parseInt(target.text(), 10)||1; year = this.viewDate.getUTCFullYear(); month = this.viewDate.getUTCMonth(); if (target.is('.old')){ if (month === 0){ month = 11; year -= 1; } else { month -= 1; } } else if (target.is('.new')){ if (month === 11){ month = 0; year += 1; } else { month += 1; } } this._setDate(UTCDate(year, month, day)); } break; } } if (this.picker.is(':visible') && this._focused_from){ $(this._focused_from).focus(); } delete this._focused_from; }, _toggle_multidate: function(date){ var ix = this.dates.contains(date); if (!date){ this.dates.clear(); } else if (ix !== -1){ this.dates.remove(ix); } else { this.dates.push(date); } if (typeof this.o.multidate === 'number') while (this.dates.length > this.o.multidate) this.dates.remove(0); }, _setDate: function(date, which){ if (!which || which === 'date') this._toggle_multidate(date && new Date(date)); if (!which || which === 'view') this.viewDate = date && new Date(date); this.fill(); this.setValue(); this._trigger('changeDate'); var element; if (this.isInput){ element = this.element; } else if (this.component){ element = this.element.find('input'); } if (element){ element.change(); } if (this.o.autoclose && (!which || which === 'date')){ this.hide(); } }, moveMonth: function(date, dir){ if (!date) return undefined; if (!dir) return date; var new_date = new Date(date.valueOf()), day = new_date.getUTCDate(), month = new_date.getUTCMonth(), mag = Math.abs(dir), new_month, test; dir = dir > 0 ? 1 : -1; if (mag === 1){ test = dir === -1 // If going back one month, make sure month is not current month // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02) ? function(){ return new_date.getUTCMonth() === month; } // If going forward one month, make sure month is as expected // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02) : function(){ return new_date.getUTCMonth() !== new_month; }; new_month = month + dir; new_date.setUTCMonth(new_month); // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11 if (new_month < 0 || new_month > 11) new_month = (new_month + 12) % 12; } else { // For magnitudes >1, move one month at a time... for (var i=0; i < mag; i++) // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)... new_date = this.moveMonth(new_date, dir); // ...then reset the day, keeping it in the new month new_month = new_date.getUTCMonth(); new_date.setUTCDate(day); test = function(){ return new_month !== new_date.getUTCMonth(); }; } // Common date-resetting loop -- if date is beyond end of month, make it // end of month while (test()){ new_date.setUTCDate(--day); new_date.setUTCMonth(new_month); } return new_date; }, moveYear: function(date, dir){ return this.moveMonth(date, dir*12); }, dateWithinRange: function(date){ return date >= this.o.startDate && date <= this.o.endDate; }, keydown: function(e){ if (this.picker.is(':not(:visible)')){ if (e.keyCode === 27) // allow escape to hide and re-show picker this.show(); return; } var dateChanged = false, dir, newDate, newViewDate, focusDate = this.focusDate || this.viewDate; switch (e.keyCode){ case 27: // escape if (this.focusDate){ this.focusDate = null; this.viewDate = this.dates.get(-1) || this.viewDate; this.fill(); } else this.hide(); e.preventDefault(); break; case 37: // left case 39: // right if (!this.o.keyboardNavigation) break; dir = e.keyCode === 37 ? -1 : 1; if (e.ctrlKey){ newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir); newViewDate = this.moveYear(focusDate, dir); this._trigger('changeYear', this.viewDate); } else if (e.shiftKey){ newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir); newViewDate = this.moveMonth(focusDate, dir); this._trigger('changeMonth', this.viewDate); } else { newDate = new Date(this.dates.get(-1) || UTCToday()); newDate.setUTCDate(newDate.getUTCDate() + dir); newViewDate = new Date(focusDate); newViewDate.setUTCDate(focusDate.getUTCDate() + dir); } if (this.dateWithinRange(newDate)){ this.focusDate = this.viewDate = newViewDate; this.setValue(); this.fill(); e.preventDefault(); } break; case 38: // up case 40: // down if (!this.o.keyboardNavigation) break; dir = e.keyCode === 38 ? -1 : 1; if (e.ctrlKey){ newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir); newViewDate = this.moveYear(focusDate, dir); this._trigger('changeYear', this.viewDate); } else if (e.shiftKey){ newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir); newViewDate = this.moveMonth(focusDate, dir); this._trigger('changeMonth', this.viewDate); } else { newDate = new Date(this.dates.get(-1) || UTCToday()); newDate.setUTCDate(newDate.getUTCDate() + dir * 7); newViewDate = new Date(focusDate); newViewDate.setUTCDate(focusDate.getUTCDate() + dir * 7); } if (this.dateWithinRange(newDate)){ this.focusDate = this.viewDate = newViewDate; this.setValue(); this.fill(); e.preventDefault(); } break; case 32: // spacebar // Spacebar is used in manually typing dates in some formats. // As such, its behavior should not be hijacked. break; case 13: // enter focusDate = this.focusDate || this.dates.get(-1) || this.viewDate; this._toggle_multidate(focusDate); dateChanged = true; this.focusDate = null; this.viewDate = this.dates.get(-1) || this.viewDate; this.setValue(); this.fill(); if (this.picker.is(':visible')){ e.preventDefault(); if (this.o.autoclose) this.hide(); } break; case 9: // tab this.focusDate = null; this.viewDate = this.dates.get(-1) || this.viewDate; this.fill(); this.hide(); break; } if (dateChanged){ if (this.dates.length) this._trigger('changeDate'); else this._trigger('clearDate'); var element; if (this.isInput){ element = this.element; } else if (this.component){ element = this.element.find('input'); } if (element){ element.change(); } } }, showMode: function(dir){ if (dir){ this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir)); } this.picker .find('>div') .hide() .filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName) .css('display', 'block'); this.updateNavArrows(); } }; var DateRangePicker = function(element, options){ this.element = $(element); this.inputs = $.map(options.inputs, function(i){ return i.jquery ? i[0] : i; }); delete options.inputs; $(this.inputs) .datepicker(options) .bind('changeDate', $.proxy(this.dateUpdated, this)); this.pickers = $.map(this.inputs, function(i){ return $(i).data('datepicker'); }); this.updateDates(); }; DateRangePicker.prototype = { updateDates: function(){ this.dates = $.map(this.pickers, function(i){ return i.getUTCDate(); }); this.updateRanges(); }, updateRanges: function(){ var range = $.map(this.dates, function(d){ return d.valueOf(); }); $.each(this.pickers, function(i, p){ p.setRange(range); }); }, dateUpdated: function(e){ // `this.updating` is a workaround for preventing infinite recursion // between `changeDate` triggering and `setUTCDate` calling. Until // there is a better mechanism. if (this.updating) return; this.updating = true; var dp = $(e.target).data('datepicker'), new_date = dp.getUTCDate(), i = $.inArray(e.target, this.inputs), l = this.inputs.length; if (i === -1) return; $.each(this.pickers, function(i, p){ if (!p.getUTCDate()) p.setUTCDate(new_date); }); if (new_date < this.dates[i]){ // Date being moved earlier/left while (i >= 0 && new_date < this.dates[i]){ this.pickers[i--].setUTCDate(new_date); } } else if (new_date > this.dates[i]){ // Date being moved later/right while (i < l && new_date > this.dates[i]){ this.pickers[i++].setUTCDate(new_date); } } this.updateDates(); delete this.updating; }, remove: function(){ $.map(this.pickers, function(p){ p.remove(); }); delete this.element.data().datepicker; } }; function opts_from_el(el, prefix){ // Derive options from element data-attrs var data = $(el).data(), out = {}, inkey, replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])'); prefix = new RegExp('^' + prefix.toLowerCase()); function re_lower(_,a){ return a.toLowerCase(); } for (var key in data) if (prefix.test(key)){ inkey = key.replace(replace, re_lower); out[inkey] = data[key]; } return out; } function opts_from_locale(lang){ // Derive options from locale plugins var out = {}; // Check if "de-DE" style date is available, if not language should // fallback to 2 letter code eg "de" if (!dates[lang]){ lang = lang.split('-')[0]; if (!dates[lang]) return; } var d = dates[lang]; $.each(locale_opts, function(i,k){ if (k in d) out[k] = d[k]; }); return out; } var old = $.fn.datepicker; $.fn.datepicker = function(option){ var args = Array.apply(null, arguments); args.shift(); var internal_return; this.each(function(){ var $this = $(this), data = $this.data('datepicker'), options = typeof option === 'object' && option; if (!data){ var elopts = opts_from_el(this, 'date'), // Preliminary otions xopts = $.extend({}, defaults, elopts, options), locopts = opts_from_locale(xopts.language), // Options priority: js args, data-attrs, locales, defaults opts = $.extend({}, defaults, locopts, elopts, options); if ($this.is('.input-daterange') || opts.inputs){ var ropts = { inputs: opts.inputs || $this.find('input').toArray() }; $this.data('datepicker', (data = new DateRangePicker(this, $.extend(opts, ropts)))); } else { $this.data('datepicker', (data = new Datepicker(this, opts))); } } if (typeof option === 'string' && typeof data[option] === 'function'){ internal_return = data[option].apply(data, args); if (internal_return !== undefined) return false; } }); if (internal_return !== undefined) return internal_return; else return this; }; var defaults = $.fn.datepicker.defaults = { autoclose: false, beforeShowDay: $.noop, calendarWeeks: false, clearBtn: false, daysOfWeekDisabled: [], endDate: Infinity, forceParse: true, format: 'mm/dd/yyyy', keyboardNavigation: true, language: 'en', minViewMode: 0, multidate: false, multidateSeparator: ',', orientation: "auto", rtl: false, startDate: -Infinity, startView: 0, todayBtn: false, todayHighlight: false, weekStart: 0 }; var locale_opts = $.fn.datepicker.locale_opts = [ 'format', 'rtl', 'weekStart' ]; $.fn.datepicker.Constructor = Datepicker; var dates = $.fn.datepicker.dates = { en: { days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"], months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], today: "Today", clear: "Clear" } }; var DPGlobal = { modes: [ { clsName: 'days', navFnc: 'Month', navStep: 1 }, { clsName: 'months', navFnc: 'FullYear', navStep: 1 }, { clsName: 'years', navFnc: 'FullYear', navStep: 10 }], isLeapYear: function(year){ return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)); }, getDaysInMonth: function(year, month){ return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; }, validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g, nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g, parseFormat: function(format){ // IE treats \0 as a string end in inputs (truncating the value), // so it's a bad format delimiter, anyway var separators = format.replace(this.validParts, '\0').split('\0'), parts = format.match(this.validParts); if (!separators || !separators.length || !parts || parts.length === 0){ throw new Error("Invalid date format."); } return {separators: separators, parts: parts}; }, parseDate: function(date, format, language){ if (!date) return undefined; if (date instanceof Date) return date; if (typeof format === 'string') format = DPGlobal.parseFormat(format); var part_re = /([\-+]\d+)([dmwy])/, parts = date.match(/([\-+]\d+)([dmwy])/g), part, dir, i; if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)){ date = new Date(); for (i=0; i < parts.length; i++){ part = part_re.exec(parts[i]); dir = parseInt(part[1]); switch (part[2]){ case 'd': date.setUTCDate(date.getUTCDate() + dir); break; case 'm': date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir); break; case 'w': date.setUTCDate(date.getUTCDate() + dir * 7); break; case 'y': date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir); break; } } return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0); } parts = date && date.match(this.nonpunctuation) || []; date = new Date(); var parsed = {}, setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'], setters_map = { yyyy: function(d,v){ return d.setUTCFullYear(v); }, yy: function(d,v){ return d.setUTCFullYear(2000+v); }, m: function(d,v){ if (isNaN(d)) return d; v -= 1; while (v < 0) v += 12; v %= 12; d.setUTCMonth(v); while (d.getUTCMonth() !== v) d.setUTCDate(d.getUTCDate()-1); return d; }, d: function(d,v){ return d.setUTCDate(v); } }, val, filtered; setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m']; setters_map['dd'] = setters_map['d']; date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); var fparts = format.parts.slice(); // Remove noop parts if (parts.length !== fparts.length){ fparts = $(fparts).filter(function(i,p){ return $.inArray(p, setters_order) !== -1; }).toArray(); } // Process remainder function match_part(){ var m = this.slice(0, parts[i].length), p = parts[i].slice(0, m.length); return m === p; } if (parts.length === fparts.length){ var cnt; for (i=0, cnt = fparts.length; i < cnt; i++){ val = parseInt(parts[i], 10); part = fparts[i]; if (isNaN(val)){ switch (part){ case 'MM': filtered = $(dates[language].months).filter(match_part); val = $.inArray(filtered[0], dates[language].months) + 1; break; case 'M': filtered = $(dates[language].monthsShort).filter(match_part); val = $.inArray(filtered[0], dates[language].monthsShort) + 1; break; } } parsed[part] = val; } var _date, s; for (i=0; i < setters_order.length; i++){ s = setters_order[i]; if (s in parsed && !isNaN(parsed[s])){ _date = new Date(date); setters_map[s](_date, parsed[s]); if (!isNaN(_date)) date = _date; } } } return date; }, formatDate: function(date, format, language){ if (!date) return ''; if (typeof format === 'string') format = DPGlobal.parseFormat(format); var val = { d: date.getUTCDate(), D: dates[language].daysShort[date.getUTCDay()], DD: dates[language].days[date.getUTCDay()], m: date.getUTCMonth() + 1, M: dates[language].monthsShort[date.getUTCMonth()], MM: dates[language].months[date.getUTCMonth()], yy: date.getUTCFullYear().toString().substring(2), yyyy: date.getUTCFullYear() }; val.dd = (val.d < 10 ? '0' : '') + val.d; val.mm = (val.m < 10 ? '0' : '') + val.m; date = []; var seps = $.extend([], format.separators); for (var i=0, cnt = format.parts.length; i <= cnt; i++){ if (seps.length) date.push(seps.shift()); date.push(val[format.parts[i]]); } return date.join(''); }, headTemplate: '<thead>'+ '<tr>'+ '<th class="prev">&laquo;</th>'+ '<th colspan="5" class="datepicker-switch"></th>'+ '<th class="next">&raquo;</th>'+ '</tr>'+ '</thead>', contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>', footTemplate: '<tfoot>'+ '<tr>'+ '<th colspan="7" class="today"></th>'+ '</tr>'+ '<tr>'+ '<th colspan="7" class="clear"></th>'+ '</tr>'+ '</tfoot>' }; DPGlobal.template = '<div class="datepicker">'+ '<div class="datepicker-days">'+ '<table class="table table-condensed">'+ DPGlobal.headTemplate+ '<tbody></tbody>'+ DPGlobal.footTemplate+ '</table>'+ '</div>'+ '<div class="datepicker-months">'+ '<table class="table table-condensed">'+ DPGlobal.headTemplate+ DPGlobal.contTemplate+ DPGlobal.footTemplate+ '</table>'+ '</div>'+ '<div class="datepicker-years">'+ '<table class="table table-condensed">'+ DPGlobal.headTemplate+ DPGlobal.contTemplate+ DPGlobal.footTemplate+ '</table>'+ '</div>'+ '</div>'; $.fn.datepicker.DPGlobal = DPGlobal; /* DATEPICKER NO CONFLICT * =================== */ $.fn.datepicker.noConflict = function(){ $.fn.datepicker = old; return this; }; /* DATEPICKER DATA-API * ================== */ $(document).on( 'focus.datepicker.data-api click.datepicker.data-api', '[data-provide="datepicker"]', function(e){ var $this = $(this); if ($this.data('datepicker')) return; e.preventDefault(); // component click requires us to explicitly show it $this.datepicker('show'); } ); $(function(){ $('[data-provide="datepicker-inline"]').datepicker(); }); }(window.jQuery));
2881099/FreeScheduler
1,576
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/input-mask/jquery.inputmask.phone.extensions.js
/* Input Mask plugin extensions http://github.com/RobinHerbots/jquery.inputmask Copyright (c) 2010 - 2014 Robin Herbots Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) Version: 0.0.0 Phone extension. When using this extension make sure you specify the correct url to get the masks $(selector).inputmask("phone", { url: "Scripts/jquery.inputmask/phone-codes/phone-codes.json", onKeyValidation: function () { //show some metadata in the console console.log($(this).inputmask("getmetadata")["name_en"]); } }); */ (function ($) { $.extend($.inputmask.defaults.aliases, { 'phone': { url: "phone-codes/phone-codes.json", mask: function (opts) { opts.definitions = { 'p': { validator: function () { return false; }, cardinality: 1 }, '#': { validator: "[0-9]", cardinality: 1 } }; var maskList = []; $.ajax({ url: opts.url, async: false, dataType: 'json', success: function (response) { maskList = response; } }); maskList.splice(0, 0, "+p(ppp)ppp-pppp"); return maskList; } } }); })(jQuery);
2881099/FreeScheduler
90,539
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/input-mask/jquery.inputmask.js
/** * @license Input Mask plugin for jquery * http://github.com/RobinHerbots/jquery.inputmask * Copyright (c) 2010 - 2014 Robin Herbots * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) * Version: 0.0.0 */ (function ($) { if ($.fn.inputmask === undefined) { //helper functions function isInputEventSupported(eventName) { var el = document.createElement('input'), eventName = 'on' + eventName, isSupported = (eventName in el); if (!isSupported) { el.setAttribute(eventName, 'return;'); isSupported = typeof el[eventName] == 'function'; } el = null; return isSupported; } function resolveAlias(aliasStr, options, opts) { var aliasDefinition = opts.aliases[aliasStr]; if (aliasDefinition) { if (aliasDefinition.alias) resolveAlias(aliasDefinition.alias, undefined, opts); //alias is another alias $.extend(true, opts, aliasDefinition); //merge alias definition in the options $.extend(true, opts, options); //reapply extra given options return true; } return false; } function generateMaskSets(opts) { var ms = []; var genmasks = []; //used to keep track of the masks that where processed, to avoid duplicates function getMaskTemplate(mask) { if (opts.numericInput) { mask = mask.split('').reverse().join(''); } var escaped = false, outCount = 0, greedy = opts.greedy, repeat = opts.repeat; if (repeat == "*") greedy = false; //if (greedy == true && opts.placeholder == "") opts.placeholder = " "; if (mask.length == 1 && greedy == false && repeat != 0) { opts.placeholder = ""; } //hide placeholder with single non-greedy mask var singleMask = $.map(mask.split(""), function (element, index) { var outElem = []; if (element == opts.escapeChar) { escaped = true; } else if ((element != opts.optionalmarker.start && element != opts.optionalmarker.end) || escaped) { var maskdef = opts.definitions[element]; if (maskdef && !escaped) { for (var i = 0; i < maskdef.cardinality; i++) { outElem.push(opts.placeholder.charAt((outCount + i) % opts.placeholder.length)); } } else { outElem.push(element); escaped = false; } outCount += outElem.length; return outElem; } }); //allocate repetitions var repeatedMask = singleMask.slice(); for (var i = 1; i < repeat && greedy; i++) { repeatedMask = repeatedMask.concat(singleMask.slice()); } return { "mask": repeatedMask, "repeat": repeat, "greedy": greedy }; } //test definition => {fn: RegExp/function, cardinality: int, optionality: bool, newBlockMarker: bool, offset: int, casing: null/upper/lower, def: definitionSymbol} function getTestingChain(mask) { if (opts.numericInput) { mask = mask.split('').reverse().join(''); } var isOptional = false, escaped = false; var newBlockMarker = false; //indicates wheter the begin/ending of a block should be indicated return $.map(mask.split(""), function (element, index) { var outElem = []; if (element == opts.escapeChar) { escaped = true; } else if (element == opts.optionalmarker.start && !escaped) { isOptional = true; newBlockMarker = true; } else if (element == opts.optionalmarker.end && !escaped) { isOptional = false; newBlockMarker = true; } else { var maskdef = opts.definitions[element]; if (maskdef && !escaped) { var prevalidators = maskdef["prevalidator"], prevalidatorsL = prevalidators ? prevalidators.length : 0; for (var i = 1; i < maskdef.cardinality; i++) { var prevalidator = prevalidatorsL >= i ? prevalidators[i - 1] : [], validator = prevalidator["validator"], cardinality = prevalidator["cardinality"]; outElem.push({ fn: validator ? typeof validator == 'string' ? new RegExp(validator) : new function () { this.test = validator; } : new RegExp("."), cardinality: cardinality ? cardinality : 1, optionality: isOptional, newBlockMarker: isOptional == true ? newBlockMarker : false, offset: 0, casing: maskdef["casing"], def: maskdef["definitionSymbol"] || element }); if (isOptional == true) //reset newBlockMarker newBlockMarker = false; } outElem.push({ fn: maskdef.validator ? typeof maskdef.validator == 'string' ? new RegExp(maskdef.validator) : new function () { this.test = maskdef.validator; } : new RegExp("."), cardinality: maskdef.cardinality, optionality: isOptional, newBlockMarker: newBlockMarker, offset: 0, casing: maskdef["casing"], def: maskdef["definitionSymbol"] || element }); } else { outElem.push({ fn: null, cardinality: 0, optionality: isOptional, newBlockMarker: newBlockMarker, offset: 0, casing: null, def: element }); escaped = false; } //reset newBlockMarker newBlockMarker = false; return outElem; } }); } function markOptional(maskPart) { //needed for the clearOptionalTail functionality return opts.optionalmarker.start + maskPart + opts.optionalmarker.end; } function splitFirstOptionalEndPart(maskPart) { var optionalStartMarkers = 0, optionalEndMarkers = 0, mpl = maskPart.length; for (var i = 0; i < mpl; i++) { if (maskPart.charAt(i) == opts.optionalmarker.start) { optionalStartMarkers++; } if (maskPart.charAt(i) == opts.optionalmarker.end) { optionalEndMarkers++; } if (optionalStartMarkers > 0 && optionalStartMarkers == optionalEndMarkers) break; } var maskParts = [maskPart.substring(0, i)]; if (i < mpl) { maskParts.push(maskPart.substring(i + 1, mpl)); } return maskParts; } function splitFirstOptionalStartPart(maskPart) { var mpl = maskPart.length; for (var i = 0; i < mpl; i++) { if (maskPart.charAt(i) == opts.optionalmarker.start) { break; } } var maskParts = [maskPart.substring(0, i)]; if (i < mpl) { maskParts.push(maskPart.substring(i + 1, mpl)); } return maskParts; } function generateMask(maskPrefix, maskPart, metadata) { var maskParts = splitFirstOptionalEndPart(maskPart); var newMask, maskTemplate; var masks = splitFirstOptionalStartPart(maskParts[0]); if (masks.length > 1) { newMask = maskPrefix + masks[0] + markOptional(masks[1]) + (maskParts.length > 1 ? maskParts[1] : ""); if ($.inArray(newMask, genmasks) == -1 && newMask != "") { genmasks.push(newMask); maskTemplate = getMaskTemplate(newMask); ms.push({ "mask": newMask, "_buffer": maskTemplate["mask"], "buffer": maskTemplate["mask"].slice(), "tests": getTestingChain(newMask), "lastValidPosition": -1, "greedy": maskTemplate["greedy"], "repeat": maskTemplate["repeat"], "metadata": metadata }); } newMask = maskPrefix + masks[0] + (maskParts.length > 1 ? maskParts[1] : ""); if ($.inArray(newMask, genmasks) == -1 && newMask != "") { genmasks.push(newMask); maskTemplate = getMaskTemplate(newMask); ms.push({ "mask": newMask, "_buffer": maskTemplate["mask"], "buffer": maskTemplate["mask"].slice(), "tests": getTestingChain(newMask), "lastValidPosition": -1, "greedy": maskTemplate["greedy"], "repeat": maskTemplate["repeat"], "metadata": metadata }); } if (splitFirstOptionalStartPart(masks[1]).length > 1) { //optional contains another optional generateMask(maskPrefix + masks[0], masks[1] + maskParts[1], metadata); } if (maskParts.length > 1 && splitFirstOptionalStartPart(maskParts[1]).length > 1) { generateMask(maskPrefix + masks[0] + markOptional(masks[1]), maskParts[1], metadata); generateMask(maskPrefix + masks[0], maskParts[1], metadata); } } else { newMask = maskPrefix + maskParts; if ($.inArray(newMask, genmasks) == -1 && newMask != "") { genmasks.push(newMask); maskTemplate = getMaskTemplate(newMask); ms.push({ "mask": newMask, "_buffer": maskTemplate["mask"], "buffer": maskTemplate["mask"].slice(), "tests": getTestingChain(newMask), "lastValidPosition": -1, "greedy": maskTemplate["greedy"], "repeat": maskTemplate["repeat"], "metadata": metadata }); } } } if ($.isFunction(opts.mask)) { //allow mask to be a preprocessing fn - should return a valid mask opts.mask = opts.mask.call(this, opts); } if ($.isArray(opts.mask)) { $.each(opts.mask, function (ndx, msk) { if (msk["mask"] != undefined) { generateMask("", msk["mask"].toString(), msk); } else generateMask("", msk.toString()); }); } else generateMask("", opts.mask.toString()); return opts.greedy ? ms : ms.sort(function (a, b) { return a["mask"].length - b["mask"].length; }); } var msie10 = navigator.userAgent.match(new RegExp("msie 10", "i")) !== null, iphone = navigator.userAgent.match(new RegExp("iphone", "i")) !== null, android = navigator.userAgent.match(new RegExp("android.*safari.*", "i")) !== null, androidchrome = navigator.userAgent.match(new RegExp("android.*chrome.*", "i")) !== null, pasteEvent = isInputEventSupported('paste') ? 'paste' : isInputEventSupported('input') ? 'input' : "propertychange"; //masking scope //actionObj definition see below function maskScope(masksets, activeMasksetIndex, opts, actionObj) { var isRTL = false, valueOnFocus = getActiveBuffer().join(''), $el, chromeValueOnInput, skipKeyPressEvent = false, //Safari 5.1.x - modal dialog fires keypress twice workaround skipInputEvent = false, //skip when triggered from within inputmask ignorable = false; //maskset helperfunctions function getActiveMaskSet() { return masksets[activeMasksetIndex]; } function getActiveTests() { return getActiveMaskSet()['tests']; } function getActiveBufferTemplate() { return getActiveMaskSet()['_buffer']; } function getActiveBuffer() { return getActiveMaskSet()['buffer']; } function isValid(pos, c, strict) { //strict true ~ no correction or autofill strict = strict === true; //always set a value to strict to prevent possible strange behavior in the extensions function _isValid(position, activeMaskset, c, strict) { var testPos = determineTestPosition(position), loopend = c ? 1 : 0, chrs = '', buffer = activeMaskset["buffer"]; for (var i = activeMaskset['tests'][testPos].cardinality; i > loopend; i--) { chrs += getBufferElement(buffer, testPos - (i - 1)); } if (c) { chrs += c; } //return is false or a json object => { pos: ??, c: ??} or true return activeMaskset['tests'][testPos].fn != null ? activeMaskset['tests'][testPos].fn.test(chrs, buffer, position, strict, opts) : (c == getBufferElement(activeMaskset['_buffer'], position, true) || c == opts.skipOptionalPartCharacter) ? { "refresh": true, c: getBufferElement(activeMaskset['_buffer'], position, true), pos: position } : false; } function PostProcessResults(maskForwards, results) { var hasValidActual = false; $.each(results, function (ndx, rslt) { hasValidActual = $.inArray(rslt["activeMasksetIndex"], maskForwards) == -1 && rslt["result"] !== false; if (hasValidActual) return false; }); if (hasValidActual) { //strip maskforwards results = $.map(results, function (rslt, ndx) { if ($.inArray(rslt["activeMasksetIndex"], maskForwards) == -1) { return rslt; } else { masksets[rslt["activeMasksetIndex"]]["lastValidPosition"] = actualLVP; } }); } else { //keep maskforwards with the least forward var lowestPos = -1, lowestIndex = -1, rsltValid; $.each(results, function (ndx, rslt) { if ($.inArray(rslt["activeMasksetIndex"], maskForwards) != -1 && rslt["result"] !== false & (lowestPos == -1 || lowestPos > rslt["result"]["pos"])) { lowestPos = rslt["result"]["pos"]; lowestIndex = rslt["activeMasksetIndex"]; } }); results = $.map(results, function (rslt, ndx) { if ($.inArray(rslt["activeMasksetIndex"], maskForwards) != -1) { if (rslt["result"]["pos"] == lowestPos) { return rslt; } else if (rslt["result"] !== false) { for (var i = pos; i < lowestPos; i++) { rsltValid = _isValid(i, masksets[rslt["activeMasksetIndex"]], masksets[lowestIndex]["buffer"][i], true); if (rsltValid === false) { masksets[rslt["activeMasksetIndex"]]["lastValidPosition"] = lowestPos - 1; break; } else { setBufferElement(masksets[rslt["activeMasksetIndex"]]["buffer"], i, masksets[lowestIndex]["buffer"][i], true); masksets[rslt["activeMasksetIndex"]]["lastValidPosition"] = i; } } //also check check for the lowestpos with the new input rsltValid = _isValid(lowestPos, masksets[rslt["activeMasksetIndex"]], c, true); if (rsltValid !== false) { setBufferElement(masksets[rslt["activeMasksetIndex"]]["buffer"], lowestPos, c, true); masksets[rslt["activeMasksetIndex"]]["lastValidPosition"] = lowestPos; } //console.log("ndx " + rslt["activeMasksetIndex"] + " validate " + masksets[rslt["activeMasksetIndex"]]["buffer"].join('') + " lv " + masksets[rslt["activeMasksetIndex"]]['lastValidPosition']); return rslt; } } }); } return results; } if (strict) { var result = _isValid(pos, getActiveMaskSet(), c, strict); //only check validity in current mask when validating strict if (result === true) { result = { "pos": pos }; //always take a possible corrected maskposition into account } return result; } var results = [], result = false, currentActiveMasksetIndex = activeMasksetIndex, actualBuffer = getActiveBuffer().slice(), actualLVP = getActiveMaskSet()["lastValidPosition"], actualPrevious = seekPrevious(pos), maskForwards = []; $.each(masksets, function (index, value) { if (typeof (value) == "object") { activeMasksetIndex = index; var maskPos = pos; var lvp = getActiveMaskSet()['lastValidPosition'], rsltValid; if (lvp == actualLVP) { if ((maskPos - actualLVP) > 1) { for (var i = lvp == -1 ? 0 : lvp; i < maskPos; i++) { rsltValid = _isValid(i, getActiveMaskSet(), actualBuffer[i], true); if (rsltValid === false) { break; } else { setBufferElement(getActiveBuffer(), i, actualBuffer[i], true); if (rsltValid === true) { rsltValid = { "pos": i }; //always take a possible corrected maskposition into account } var newValidPosition = rsltValid.pos || i; if (getActiveMaskSet()['lastValidPosition'] < newValidPosition) getActiveMaskSet()['lastValidPosition'] = newValidPosition; //set new position from isValid } } } //does the input match on a further position? if (!isMask(maskPos) && !_isValid(maskPos, getActiveMaskSet(), c, strict)) { var maxForward = seekNext(maskPos) - maskPos; for (var fw = 0; fw < maxForward; fw++) { if (_isValid(++maskPos, getActiveMaskSet(), c, strict) !== false) break; } maskForwards.push(activeMasksetIndex); //console.log('maskforward ' + activeMasksetIndex + " pos " + pos + " maskPos " + maskPos); } } if (getActiveMaskSet()['lastValidPosition'] >= actualLVP || activeMasksetIndex == currentActiveMasksetIndex) { if (maskPos >= 0 && maskPos < getMaskLength()) { result = _isValid(maskPos, getActiveMaskSet(), c, strict); if (result !== false) { if (result === true) { result = { "pos": maskPos }; //always take a possible corrected maskposition into account } var newValidPosition = result.pos || maskPos; if (getActiveMaskSet()['lastValidPosition'] < newValidPosition) getActiveMaskSet()['lastValidPosition'] = newValidPosition; //set new position from isValid } //console.log("pos " + pos + " ndx " + activeMasksetIndex + " validate " + getActiveBuffer().join('') + " lv " + getActiveMaskSet()['lastValidPosition']); results.push({ "activeMasksetIndex": index, "result": result }); } } } }); activeMasksetIndex = currentActiveMasksetIndex; //reset activeMasksetIndex return PostProcessResults(maskForwards, results); //return results of the multiple mask validations } function determineActiveMasksetIndex() { var currentMasksetIndex = activeMasksetIndex, highestValid = { "activeMasksetIndex": 0, "lastValidPosition": -1, "next": -1 }; $.each(masksets, function (index, value) { if (typeof (value) == "object") { activeMasksetIndex = index; if (getActiveMaskSet()['lastValidPosition'] > highestValid['lastValidPosition']) { highestValid["activeMasksetIndex"] = index; highestValid["lastValidPosition"] = getActiveMaskSet()['lastValidPosition']; highestValid["next"] = seekNext(getActiveMaskSet()['lastValidPosition']); } else if (getActiveMaskSet()['lastValidPosition'] == highestValid['lastValidPosition'] && (highestValid['next'] == -1 || highestValid['next'] > seekNext(getActiveMaskSet()['lastValidPosition']))) { highestValid["activeMasksetIndex"] = index; highestValid["lastValidPosition"] = getActiveMaskSet()['lastValidPosition']; highestValid["next"] = seekNext(getActiveMaskSet()['lastValidPosition']); } } }); activeMasksetIndex = highestValid["lastValidPosition"] != -1 && masksets[currentMasksetIndex]["lastValidPosition"] == highestValid["lastValidPosition"] ? currentMasksetIndex : highestValid["activeMasksetIndex"]; if (currentMasksetIndex != activeMasksetIndex) { clearBuffer(getActiveBuffer(), seekNext(highestValid["lastValidPosition"]), getMaskLength()); getActiveMaskSet()["writeOutBuffer"] = true; } $el.data('_inputmask')['activeMasksetIndex'] = activeMasksetIndex; //store the activeMasksetIndex } function isMask(pos) { var testPos = determineTestPosition(pos); var test = getActiveTests()[testPos]; return test != undefined ? test.fn : false; } function determineTestPosition(pos) { return pos % getActiveTests().length; } function getMaskLength() { return opts.getMaskLength(getActiveBufferTemplate(), getActiveMaskSet()['greedy'], getActiveMaskSet()['repeat'], getActiveBuffer(), opts); } //pos: from position function seekNext(pos) { var maskL = getMaskLength(); if (pos >= maskL) return maskL; var position = pos; while (++position < maskL && !isMask(position)) { } return position; } //pos: from position function seekPrevious(pos) { var position = pos; if (position <= 0) return 0; while (--position > 0 && !isMask(position)) { } return position; } function setBufferElement(buffer, position, element, autoPrepare) { if (autoPrepare) position = prepareBuffer(buffer, position); var test = getActiveTests()[determineTestPosition(position)]; var elem = element; if (elem != undefined && test != undefined) { switch (test.casing) { case "upper": elem = element.toUpperCase(); break; case "lower": elem = element.toLowerCase(); break; } } buffer[position] = elem; } function getBufferElement(buffer, position, autoPrepare) { if (autoPrepare) position = prepareBuffer(buffer, position); return buffer[position]; } //needed to handle the non-greedy mask repetitions function prepareBuffer(buffer, position) { var j; while (buffer[position] == undefined && buffer.length < getMaskLength()) { j = 0; while (getActiveBufferTemplate()[j] !== undefined) { //add a new buffer buffer.push(getActiveBufferTemplate()[j++]); } } return position; } function writeBuffer(input, buffer, caretPos) { input._valueSet(buffer.join('')); if (caretPos != undefined) { caret(input, caretPos); } } function clearBuffer(buffer, start, end, stripNomasks) { for (var i = start, maskL = getMaskLength() ; i < end && i < maskL; i++) { if (stripNomasks === true) { if (!isMask(i)) setBufferElement(buffer, i, ""); } else setBufferElement(buffer, i, getBufferElement(getActiveBufferTemplate().slice(), i, true)); } } function setReTargetPlaceHolder(buffer, pos) { var testPos = determineTestPosition(pos); setBufferElement(buffer, pos, getBufferElement(getActiveBufferTemplate(), testPos)); } function getPlaceHolder(pos) { return opts.placeholder.charAt(pos % opts.placeholder.length); } function checkVal(input, writeOut, strict, nptvl, intelliCheck) { var inputValue = nptvl != undefined ? nptvl.slice() : truncateInput(input._valueGet()).split(''); $.each(masksets, function (ndx, ms) { if (typeof (ms) == "object") { ms["buffer"] = ms["_buffer"].slice(); ms["lastValidPosition"] = -1; ms["p"] = -1; } }); if (strict !== true) activeMasksetIndex = 0; if (writeOut) input._valueSet(""); //initial clear var ml = getMaskLength(); $.each(inputValue, function (ndx, charCode) { if (intelliCheck === true) { var p = getActiveMaskSet()["p"], lvp = p == -1 ? p : seekPrevious(p), pos = lvp == -1 ? ndx : seekNext(lvp); if ($.inArray(charCode, getActiveBufferTemplate().slice(lvp + 1, pos)) == -1) { keypressEvent.call(input, undefined, true, charCode.charCodeAt(0), writeOut, strict, ndx); } } else { keypressEvent.call(input, undefined, true, charCode.charCodeAt(0), writeOut, strict, ndx); } }); if (strict === true && getActiveMaskSet()["p"] != -1) { getActiveMaskSet()["lastValidPosition"] = seekPrevious(getActiveMaskSet()["p"]); } } function escapeRegex(str) { return $.inputmask.escapeRegex.call(this, str); } function truncateInput(inputValue) { return inputValue.replace(new RegExp("(" + escapeRegex(getActiveBufferTemplate().join('')) + ")*$"), ""); } function clearOptionalTail(input) { var buffer = getActiveBuffer(), tmpBuffer = buffer.slice(), testPos, pos; for (var pos = tmpBuffer.length - 1; pos >= 0; pos--) { var testPos = determineTestPosition(pos); if (getActiveTests()[testPos].optionality) { if (!isMask(pos) || !isValid(pos, buffer[pos], true)) tmpBuffer.pop(); else break; } else break; } writeBuffer(input, tmpBuffer); } function unmaskedvalue($input, skipDatepickerCheck) { if (getActiveTests() && (skipDatepickerCheck === true || !$input.hasClass('hasDatepicker'))) { //checkVal(input, false, true); var umValue = $.map(getActiveBuffer(), function (element, index) { return isMask(index) && isValid(index, element, true) ? element : null; }); var unmaskedValue = (isRTL ? umValue.reverse() : umValue).join(''); return opts.onUnMask != undefined ? opts.onUnMask.call(this, getActiveBuffer().join(''), unmaskedValue) : unmaskedValue; } else { return $input[0]._valueGet(); } } function TranslatePosition(pos) { if (isRTL && typeof pos == 'number' && (!opts.greedy || opts.placeholder != "")) { var bffrLght = getActiveBuffer().length; pos = bffrLght - pos; } return pos; } function caret(input, begin, end) { var npt = input.jquery && input.length > 0 ? input[0] : input, range; if (typeof begin == 'number') { begin = TranslatePosition(begin); end = TranslatePosition(end); if (!$(input).is(':visible')) { return; } end = (typeof end == 'number') ? end : begin; npt.scrollLeft = npt.scrollWidth; if (opts.insertMode == false && begin == end) end++; //set visualization for insert/overwrite mode if (npt.setSelectionRange) { npt.selectionStart = begin; npt.selectionEnd = android ? begin : end; } else if (npt.createTextRange) { range = npt.createTextRange(); range.collapse(true); range.moveEnd('character', end); range.moveStart('character', begin); range.select(); } } else { if (!$(input).is(':visible')) { return { "begin": 0, "end": 0 }; } if (npt.setSelectionRange) { begin = npt.selectionStart; end = npt.selectionEnd; } else if (document.selection && document.selection.createRange) { range = document.selection.createRange(); begin = 0 - range.duplicate().moveStart('character', -100000); end = begin + range.text.length; } begin = TranslatePosition(begin); end = TranslatePosition(end); return { "begin": begin, "end": end }; } } function isComplete(buffer) { //return true / false / undefined (repeat *) if (opts.repeat == "*") return undefined; var complete = false, highestValidPosition = 0, currentActiveMasksetIndex = activeMasksetIndex; $.each(masksets, function (ndx, ms) { if (typeof (ms) == "object") { activeMasksetIndex = ndx; var aml = seekPrevious(getMaskLength()); if (ms["lastValidPosition"] >= highestValidPosition && ms["lastValidPosition"] == aml) { var msComplete = true; for (var i = 0; i <= aml; i++) { var mask = isMask(i), testPos = determineTestPosition(i); if ((mask && (buffer[i] == undefined || buffer[i] == getPlaceHolder(i))) || (!mask && buffer[i] != getActiveBufferTemplate()[testPos])) { msComplete = false; break; } } complete = complete || msComplete; if (complete) //break loop return false; } highestValidPosition = ms["lastValidPosition"]; } }); activeMasksetIndex = currentActiveMasksetIndex; //reset activeMaskset return complete; } function isSelection(begin, end) { return isRTL ? (begin - end) > 1 || ((begin - end) == 1 && opts.insertMode) : (end - begin) > 1 || ((end - begin) == 1 && opts.insertMode); } //private functions function installEventRuler(npt) { var events = $._data(npt).events; $.each(events, function (eventType, eventHandlers) { $.each(eventHandlers, function (ndx, eventHandler) { if (eventHandler.namespace == "inputmask") { if (eventHandler.type != "setvalue") { var handler = eventHandler.handler; eventHandler.handler = function (e) { if (this.readOnly || this.disabled) e.preventDefault; else return handler.apply(this, arguments); }; } } }); }); } function patchValueProperty(npt) { var valueProperty; if (Object.getOwnPropertyDescriptor) valueProperty = Object.getOwnPropertyDescriptor(npt, "value"); if (valueProperty && valueProperty.get) { if (!npt._valueGet) { var valueGet = valueProperty.get; var valueSet = valueProperty.set; npt._valueGet = function () { return isRTL ? valueGet.call(this).split('').reverse().join('') : valueGet.call(this); }; npt._valueSet = function (value) { valueSet.call(this, isRTL ? value.split('').reverse().join('') : value); }; Object.defineProperty(npt, "value", { get: function () { var $self = $(this), inputData = $(this).data('_inputmask'), masksets = inputData['masksets'], activeMasksetIndex = inputData['activeMasksetIndex']; return inputData && inputData['opts'].autoUnmask ? $self.inputmask('unmaskedvalue') : valueGet.call(this) != masksets[activeMasksetIndex]['_buffer'].join('') ? valueGet.call(this) : ''; }, set: function (value) { valueSet.call(this, value); $(this).triggerHandler('setvalue.inputmask'); } }); } } else if (document.__lookupGetter__ && npt.__lookupGetter__("value")) { if (!npt._valueGet) { var valueGet = npt.__lookupGetter__("value"); var valueSet = npt.__lookupSetter__("value"); npt._valueGet = function () { return isRTL ? valueGet.call(this).split('').reverse().join('') : valueGet.call(this); }; npt._valueSet = function (value) { valueSet.call(this, isRTL ? value.split('').reverse().join('') : value); }; npt.__defineGetter__("value", function () { var $self = $(this), inputData = $(this).data('_inputmask'), masksets = inputData['masksets'], activeMasksetIndex = inputData['activeMasksetIndex']; return inputData && inputData['opts'].autoUnmask ? $self.inputmask('unmaskedvalue') : valueGet.call(this) != masksets[activeMasksetIndex]['_buffer'].join('') ? valueGet.call(this) : ''; }); npt.__defineSetter__("value", function (value) { valueSet.call(this, value); $(this).triggerHandler('setvalue.inputmask'); }); } } else { if (!npt._valueGet) { npt._valueGet = function () { return isRTL ? this.value.split('').reverse().join('') : this.value; }; npt._valueSet = function (value) { this.value = isRTL ? value.split('').reverse().join('') : value; }; } if ($.valHooks.text == undefined || $.valHooks.text.inputmaskpatch != true) { var valueGet = $.valHooks.text && $.valHooks.text.get ? $.valHooks.text.get : function (elem) { return elem.value; }; var valueSet = $.valHooks.text && $.valHooks.text.set ? $.valHooks.text.set : function (elem, value) { elem.value = value; return elem; }; jQuery.extend($.valHooks, { text: { get: function (elem) { var $elem = $(elem); if ($elem.data('_inputmask')) { if ($elem.data('_inputmask')['opts'].autoUnmask) return $elem.inputmask('unmaskedvalue'); else { var result = valueGet(elem), inputData = $elem.data('_inputmask'), masksets = inputData['masksets'], activeMasksetIndex = inputData['activeMasksetIndex']; return result != masksets[activeMasksetIndex]['_buffer'].join('') ? result : ''; } } else return valueGet(elem); }, set: function (elem, value) { var $elem = $(elem); var result = valueSet(elem, value); if ($elem.data('_inputmask')) $elem.triggerHandler('setvalue.inputmask'); return result; }, inputmaskpatch: true } }); } } } //shift chars to left from start to end and put c at end position if defined function shiftL(start, end, c, maskJumps) { var buffer = getActiveBuffer(); if (maskJumps !== false) //jumping over nonmask position while (!isMask(start) && start - 1 >= 0) start--; for (var i = start; i < end && i < getMaskLength() ; i++) { if (isMask(i)) { setReTargetPlaceHolder(buffer, i); var j = seekNext(i); var p = getBufferElement(buffer, j); if (p != getPlaceHolder(j)) { if (j < getMaskLength() && isValid(i, p, true) !== false && getActiveTests()[determineTestPosition(i)].def == getActiveTests()[determineTestPosition(j)].def) { setBufferElement(buffer, i, p, true); } else { if (isMask(i)) break; } } } else { setReTargetPlaceHolder(buffer, i); } } if (c != undefined) setBufferElement(buffer, seekPrevious(end), c); if (getActiveMaskSet()["greedy"] == false) { var trbuffer = truncateInput(buffer.join('')).split(''); buffer.length = trbuffer.length; for (var i = 0, bl = buffer.length; i < bl; i++) { buffer[i] = trbuffer[i]; } if (buffer.length == 0) getActiveMaskSet()["buffer"] = getActiveBufferTemplate().slice(); } return start; //return the used start position } function shiftR(start, end, c) { var buffer = getActiveBuffer(); if (getBufferElement(buffer, start, true) != getPlaceHolder(start)) { for (var i = seekPrevious(end) ; i > start && i >= 0; i--) { if (isMask(i)) { var j = seekPrevious(i); var t = getBufferElement(buffer, j); if (t != getPlaceHolder(j)) { if (isValid(j, t, true) !== false && getActiveTests()[determineTestPosition(i)].def == getActiveTests()[determineTestPosition(j)].def) { setBufferElement(buffer, i, t, true); setReTargetPlaceHolder(buffer, j); } //else break; } } else setReTargetPlaceHolder(buffer, i); } } if (c != undefined && getBufferElement(buffer, start) == getPlaceHolder(start)) setBufferElement(buffer, start, c); var lengthBefore = buffer.length; if (getActiveMaskSet()["greedy"] == false) { var trbuffer = truncateInput(buffer.join('')).split(''); buffer.length = trbuffer.length; for (var i = 0, bl = buffer.length; i < bl; i++) { buffer[i] = trbuffer[i]; } if (buffer.length == 0) getActiveMaskSet()["buffer"] = getActiveBufferTemplate().slice(); } return end - (lengthBefore - buffer.length); //return new start position } function HandleRemove(input, k, pos) { if (opts.numericInput || isRTL) { switch (k) { case opts.keyCode.BACKSPACE: k = opts.keyCode.DELETE; break; case opts.keyCode.DELETE: k = opts.keyCode.BACKSPACE; break; } if (isRTL) { var pend = pos.end; pos.end = pos.begin; pos.begin = pend; } } var isSelection = true; if (pos.begin == pos.end) { var posBegin = k == opts.keyCode.BACKSPACE ? pos.begin - 1 : pos.begin; if (opts.isNumeric && opts.radixPoint != "" && getActiveBuffer()[posBegin] == opts.radixPoint) { pos.begin = (getActiveBuffer().length - 1 == posBegin) /* radixPoint is latest? delete it */ ? pos.begin : k == opts.keyCode.BACKSPACE ? posBegin : seekNext(posBegin); pos.end = pos.begin; } isSelection = false; if (k == opts.keyCode.BACKSPACE) pos.begin--; else if (k == opts.keyCode.DELETE) pos.end++; } else if (pos.end - pos.begin == 1 && !opts.insertMode) { isSelection = false; if (k == opts.keyCode.BACKSPACE) pos.begin--; } clearBuffer(getActiveBuffer(), pos.begin, pos.end); var ml = getMaskLength(); if (opts.greedy == false) { shiftL(pos.begin, ml, undefined, !isRTL && (k == opts.keyCode.BACKSPACE && !isSelection)); } else { var newpos = pos.begin; for (var i = pos.begin; i < pos.end; i++) { //seeknext to skip placeholders at start in selection if (isMask(i) || !isSelection) newpos = shiftL(pos.begin, ml, undefined, !isRTL && (k == opts.keyCode.BACKSPACE && !isSelection)); } if (!isSelection) pos.begin = newpos; } var firstMaskPos = seekNext(-1); clearBuffer(getActiveBuffer(), pos.begin, pos.end, true); checkVal(input, false, masksets[1] == undefined || firstMaskPos >= pos.end, getActiveBuffer()); if (getActiveMaskSet()['lastValidPosition'] < firstMaskPos) { getActiveMaskSet()["lastValidPosition"] = -1; getActiveMaskSet()["p"] = firstMaskPos; } else { getActiveMaskSet()["p"] = pos.begin; } } function keydownEvent(e) { //Safari 5.1.x - modal dialog fires keypress twice workaround skipKeyPressEvent = false; var input = this, $input = $(input), k = e.keyCode, pos = caret(input); //backspace, delete, and escape get special treatment if (k == opts.keyCode.BACKSPACE || k == opts.keyCode.DELETE || (iphone && k == 127) || e.ctrlKey && k == 88) { //backspace/delete e.preventDefault(); //stop default action but allow propagation if (k == 88) valueOnFocus = getActiveBuffer().join(''); HandleRemove(input, k, pos); determineActiveMasksetIndex(); writeBuffer(input, getActiveBuffer(), getActiveMaskSet()["p"]); if (input._valueGet() == getActiveBufferTemplate().join('')) $input.trigger('cleared'); if (opts.showTooltip) { //update tooltip $input.prop("title", getActiveMaskSet()["mask"]); } } else if (k == opts.keyCode.END || k == opts.keyCode.PAGE_DOWN) { //when END or PAGE_DOWN pressed set position at lastmatch setTimeout(function () { var caretPos = seekNext(getActiveMaskSet()["lastValidPosition"]); if (!opts.insertMode && caretPos == getMaskLength() && !e.shiftKey) caretPos--; caret(input, e.shiftKey ? pos.begin : caretPos, caretPos); }, 0); } else if ((k == opts.keyCode.HOME && !e.shiftKey) || k == opts.keyCode.PAGE_UP) { //Home or page_up caret(input, 0, e.shiftKey ? pos.begin : 0); } else if (k == opts.keyCode.ESCAPE || (k == 90 && e.ctrlKey)) { //escape && undo checkVal(input, true, false, valueOnFocus.split('')); $input.click(); } else if (k == opts.keyCode.INSERT && !(e.shiftKey || e.ctrlKey)) { //insert opts.insertMode = !opts.insertMode; caret(input, !opts.insertMode && pos.begin == getMaskLength() ? pos.begin - 1 : pos.begin); } else if (opts.insertMode == false && !e.shiftKey) { if (k == opts.keyCode.RIGHT) { setTimeout(function () { var caretPos = caret(input); caret(input, caretPos.begin); }, 0); } else if (k == opts.keyCode.LEFT) { setTimeout(function () { var caretPos = caret(input); caret(input, caretPos.begin - 1); }, 0); } } var currentCaretPos = caret(input); if (opts.onKeyDown.call(this, e, getActiveBuffer(), opts) === true) //extra stuff to execute on keydown caret(input, currentCaretPos.begin, currentCaretPos.end); ignorable = $.inArray(k, opts.ignorables) != -1; } function keypressEvent(e, checkval, k, writeOut, strict, ndx) { //Safari 5.1.x - modal dialog fires keypress twice workaround if (k == undefined && skipKeyPressEvent) return false; skipKeyPressEvent = true; var input = this, $input = $(input); e = e || window.event; var k = checkval ? k : (e.which || e.charCode || e.keyCode); if (checkval !== true && (!(e.ctrlKey && e.altKey) && (e.ctrlKey || e.metaKey || ignorable))) { return true; } else { if (k) { //special treat the decimal separator if (checkval !== true && k == 46 && e.shiftKey == false && opts.radixPoint == ",") k = 44; var pos, results, result, c = String.fromCharCode(k); if (checkval) { var pcaret = strict ? ndx : getActiveMaskSet()["lastValidPosition"] + 1; pos = { begin: pcaret, end: pcaret }; } else { pos = caret(input); } //should we clear a possible selection?? var isSlctn = isSelection(pos.begin, pos.end), redetermineLVP = false, initialIndex = activeMasksetIndex; if (isSlctn) { activeMasksetIndex = initialIndex; $.each(masksets, function (ndx, lmnt) { //init undobuffer for recovery when not valid if (typeof (lmnt) == "object") { activeMasksetIndex = ndx; getActiveMaskSet()["undoBuffer"] = getActiveBuffer().join(''); } }); HandleRemove(input, opts.keyCode.DELETE, pos); if (!opts.insertMode) { //preserve some space $.each(masksets, function (ndx, lmnt) { if (typeof (lmnt) == "object") { activeMasksetIndex = ndx; shiftR(pos.begin, getMaskLength()); getActiveMaskSet()["lastValidPosition"] = seekNext(getActiveMaskSet()["lastValidPosition"]); } }); } activeMasksetIndex = initialIndex; //restore index } var radixPosition = getActiveBuffer().join('').indexOf(opts.radixPoint); if (opts.isNumeric && checkval !== true && radixPosition != -1) { if (opts.greedy && pos.begin <= radixPosition) { pos.begin = seekPrevious(pos.begin); pos.end = pos.begin; } else if (c == opts.radixPoint) { pos.begin = radixPosition; pos.end = pos.begin; } } var p = pos.begin; results = isValid(p, c, strict); if (strict === true) results = [{ "activeMasksetIndex": activeMasksetIndex, "result": results }]; var minimalForwardPosition = -1; $.each(results, function (index, result) { activeMasksetIndex = result["activeMasksetIndex"]; getActiveMaskSet()["writeOutBuffer"] = true; var np = result["result"]; if (np !== false) { var refresh = false, buffer = getActiveBuffer(); if (np !== true) { refresh = np["refresh"]; //only rewrite buffer from isValid p = np.pos != undefined ? np.pos : p; //set new position from isValid c = np.c != undefined ? np.c : c; //set new char from isValid } if (refresh !== true) { if (opts.insertMode == true) { var lastUnmaskedPosition = getMaskLength(); var bfrClone = buffer.slice(); while (getBufferElement(bfrClone, lastUnmaskedPosition, true) != getPlaceHolder(lastUnmaskedPosition) && lastUnmaskedPosition >= p) { lastUnmaskedPosition = lastUnmaskedPosition == 0 ? -1 : seekPrevious(lastUnmaskedPosition); } if (lastUnmaskedPosition >= p) { shiftR(p, getMaskLength(), c); //shift the lvp if needed var lvp = getActiveMaskSet()["lastValidPosition"], nlvp = seekNext(lvp); if (nlvp != getMaskLength() && lvp >= p && (getBufferElement(getActiveBuffer(), nlvp, true) != getPlaceHolder(nlvp))) { getActiveMaskSet()["lastValidPosition"] = nlvp; } } else getActiveMaskSet()["writeOutBuffer"] = false; } else setBufferElement(buffer, p, c, true); if (minimalForwardPosition == -1 || minimalForwardPosition > seekNext(p)) { minimalForwardPosition = seekNext(p); } } else if (!strict) { var nextPos = p < getMaskLength() ? p + 1 : p; if (minimalForwardPosition == -1 || minimalForwardPosition > nextPos) { minimalForwardPosition = nextPos; } } if (minimalForwardPosition > getActiveMaskSet()["p"]) getActiveMaskSet()["p"] = minimalForwardPosition; //needed for checkval strict } }); if (strict !== true) { activeMasksetIndex = initialIndex; determineActiveMasksetIndex(); } if (writeOut !== false) { $.each(results, function (ndx, rslt) { if (rslt["activeMasksetIndex"] == activeMasksetIndex) { result = rslt; return false; } }); if (result != undefined) { var self = this; setTimeout(function () { opts.onKeyValidation.call(self, result["result"], opts); }, 0); if (getActiveMaskSet()["writeOutBuffer"] && result["result"] !== false) { var buffer = getActiveBuffer(); var newCaretPosition; if (checkval) { newCaretPosition = undefined; } else if (opts.numericInput) { if (p > radixPosition) { newCaretPosition = seekPrevious(minimalForwardPosition); } else if (c == opts.radixPoint) { newCaretPosition = minimalForwardPosition - 1; } else newCaretPosition = seekPrevious(minimalForwardPosition - 1); } else { newCaretPosition = minimalForwardPosition; } writeBuffer(input, buffer, newCaretPosition); if (checkval !== true) { setTimeout(function () { //timeout needed for IE if (isComplete(buffer) === true) $input.trigger("complete"); skipInputEvent = true; $input.trigger("input"); }, 0); } } else if (isSlctn) { getActiveMaskSet()["buffer"] = getActiveMaskSet()["undoBuffer"].split(''); } } } if (opts.showTooltip) { //update tooltip $input.prop("title", getActiveMaskSet()["mask"]); } //needed for IE8 and below if (e) e.preventDefault ? e.preventDefault() : e.returnValue = false; } } } function keyupEvent(e) { var $input = $(this), input = this, k = e.keyCode, buffer = getActiveBuffer(); if (androidchrome && k == opts.keyCode.BACKSPACE) { if (chromeValueOnInput == input._valueGet()) keydownEvent.call(this, e); } opts.onKeyUp.call(this, e, buffer, opts); //extra stuff to execute on keyup if (k == opts.keyCode.TAB && opts.showMaskOnFocus) { if ($input.hasClass('focus.inputmask') && input._valueGet().length == 0) { buffer = getActiveBufferTemplate().slice(); writeBuffer(input, buffer); caret(input, 0); valueOnFocus = getActiveBuffer().join(''); } else { writeBuffer(input, buffer); if (buffer.join('') == getActiveBufferTemplate().join('') && $.inArray(opts.radixPoint, buffer) != -1) { caret(input, TranslatePosition(0)); $input.click(); } else caret(input, TranslatePosition(0), TranslatePosition(getMaskLength())); } } } function inputEvent(e) { if (skipInputEvent === true) { skipInputEvent = false; return true; } var input = this, $input = $(input); chromeValueOnInput = getActiveBuffer().join(''); checkVal(input, false, false); writeBuffer(input, getActiveBuffer()); if (isComplete(getActiveBuffer()) === true) $input.trigger("complete"); $input.click(); } function mask(el) { $el = $(el); if ($el.is(":input")) { //store tests & original buffer in the input element - used to get the unmasked value $el.data('_inputmask', { 'masksets': masksets, 'activeMasksetIndex': activeMasksetIndex, 'opts': opts, 'isRTL': false }); //show tooltip if (opts.showTooltip) { $el.prop("title", getActiveMaskSet()["mask"]); } //correct greedy setting if needed getActiveMaskSet()['greedy'] = getActiveMaskSet()['greedy'] ? getActiveMaskSet()['greedy'] : getActiveMaskSet()['repeat'] == 0; //handle maxlength attribute if ($el.attr("maxLength") != null) //only when the attribute is set { var maxLength = $el.prop('maxLength'); if (maxLength > -1) { //handle *-repeat $.each(masksets, function (ndx, ms) { if (typeof (ms) == "object") { if (ms["repeat"] == "*") { ms["repeat"] = maxLength; } } }); } if (getMaskLength() >= maxLength && maxLength > -1) { //FF sets no defined max length to -1 if (maxLength < getActiveBufferTemplate().length) getActiveBufferTemplate().length = maxLength; if (getActiveMaskSet()['greedy'] == false) { getActiveMaskSet()['repeat'] = Math.round(maxLength / getActiveBufferTemplate().length); } $el.prop('maxLength', getMaskLength() * 2); } } patchValueProperty(el); if (opts.numericInput) opts.isNumeric = opts.numericInput; if (el.dir == "rtl" || (opts.numericInput && opts.rightAlignNumerics) || (opts.isNumeric && opts.rightAlignNumerics)) $el.css("text-align", "right"); if (el.dir == "rtl" || opts.numericInput) { el.dir = "ltr"; $el.removeAttr("dir"); var inputData = $el.data('_inputmask'); inputData['isRTL'] = true; $el.data('_inputmask', inputData); isRTL = true; } //unbind all events - to make sure that no other mask will interfere when re-masking $el.unbind(".inputmask"); $el.removeClass('focus.inputmask'); //bind events $el.closest('form').bind("submit", function () { //trigger change on submit if any if (valueOnFocus != getActiveBuffer().join('')) { $el.change(); } }).bind('reset', function () { setTimeout(function () { $el.trigger("setvalue"); }, 0); }); $el.bind("mouseenter.inputmask", function () { var $input = $(this), input = this; if (!$input.hasClass('focus.inputmask') && opts.showMaskOnHover) { if (input._valueGet() != getActiveBuffer().join('')) { writeBuffer(input, getActiveBuffer()); } } }).bind("blur.inputmask", function () { var $input = $(this), input = this, nptValue = input._valueGet(), buffer = getActiveBuffer(); $input.removeClass('focus.inputmask'); if (valueOnFocus != getActiveBuffer().join('')) { $input.change(); } if (opts.clearMaskOnLostFocus && nptValue != '') { if (nptValue == getActiveBufferTemplate().join('')) input._valueSet(''); else { //clearout optional tail of the mask clearOptionalTail(input); } } if (isComplete(buffer) === false) { $input.trigger("incomplete"); if (opts.clearIncomplete) { $.each(masksets, function (ndx, ms) { if (typeof (ms) == "object") { ms["buffer"] = ms["_buffer"].slice(); ms["lastValidPosition"] = -1; } }); activeMasksetIndex = 0; if (opts.clearMaskOnLostFocus) input._valueSet(''); else { buffer = getActiveBufferTemplate().slice(); writeBuffer(input, buffer); } } } }).bind("focus.inputmask", function () { var $input = $(this), input = this, nptValue = input._valueGet(); if (opts.showMaskOnFocus && !$input.hasClass('focus.inputmask') && (!opts.showMaskOnHover || (opts.showMaskOnHover && nptValue == ''))) { if (input._valueGet() != getActiveBuffer().join('')) { writeBuffer(input, getActiveBuffer(), seekNext(getActiveMaskSet()["lastValidPosition"])); } } $input.addClass('focus.inputmask'); valueOnFocus = getActiveBuffer().join(''); }).bind("mouseleave.inputmask", function () { var $input = $(this), input = this; if (opts.clearMaskOnLostFocus) { if (!$input.hasClass('focus.inputmask') && input._valueGet() != $input.attr("placeholder")) { if (input._valueGet() == getActiveBufferTemplate().join('') || input._valueGet() == '') input._valueSet(''); else { //clearout optional tail of the mask clearOptionalTail(input); } } } }).bind("click.inputmask", function () { var input = this; setTimeout(function () { var selectedCaret = caret(input), buffer = getActiveBuffer(); if (selectedCaret.begin == selectedCaret.end) { var clickPosition = isRTL ? TranslatePosition(selectedCaret.begin) : selectedCaret.begin, lvp = getActiveMaskSet()["lastValidPosition"], lastPosition; if (opts.isNumeric) { lastPosition = opts.skipRadixDance === false && opts.radixPoint != "" && $.inArray(opts.radixPoint, buffer) != -1 ? (opts.numericInput ? seekNext($.inArray(opts.radixPoint, buffer)) : $.inArray(opts.radixPoint, buffer)) : seekNext(lvp); } else { lastPosition = seekNext(lvp); } if (clickPosition < lastPosition) { if (isMask(clickPosition)) caret(input, clickPosition); else caret(input, seekNext(clickPosition)); } else caret(input, lastPosition); } }, 0); }).bind('dblclick.inputmask', function () { var input = this; setTimeout(function () { caret(input, 0, seekNext(getActiveMaskSet()["lastValidPosition"])); }, 0); }).bind(pasteEvent + ".inputmask dragdrop.inputmask drop.inputmask", function (e) { if (skipInputEvent === true) { skipInputEvent = false; return true; } var input = this, $input = $(input); //paste event for IE8 and lower I guess ;-) if (e.type == "propertychange" && input._valueGet().length <= getMaskLength()) { return true; } setTimeout(function () { var pasteValue = opts.onBeforePaste != undefined ? opts.onBeforePaste.call(this, input._valueGet()) : input._valueGet(); checkVal(input, true, false, pasteValue.split(''), true); if (isComplete(getActiveBuffer()) === true) $input.trigger("complete"); $input.click(); }, 0); }).bind('setvalue.inputmask', function () { var input = this; checkVal(input, true); valueOnFocus = getActiveBuffer().join(''); if (input._valueGet() == getActiveBufferTemplate().join('')) input._valueSet(''); }).bind('complete.inputmask', opts.oncomplete ).bind('incomplete.inputmask', opts.onincomplete ).bind('cleared.inputmask', opts.oncleared ).bind("keyup.inputmask", keyupEvent); if (androidchrome) { $el.bind("input.inputmask", inputEvent); } else { $el.bind("keydown.inputmask", keydownEvent ).bind("keypress.inputmask", keypressEvent); } if (msie10) $el.bind("input.inputmask", inputEvent); //apply mask checkVal(el, true, false); valueOnFocus = getActiveBuffer().join(''); // Wrap document.activeElement in a try/catch block since IE9 throw "Unspecified error" if document.activeElement is undefined when we are in an IFrame. var activeElement; try { activeElement = document.activeElement; } catch (e) { } if (activeElement === el) { //position the caret when in focus $el.addClass('focus.inputmask'); caret(el, seekNext(getActiveMaskSet()["lastValidPosition"])); } else if (opts.clearMaskOnLostFocus) { if (getActiveBuffer().join('') == getActiveBufferTemplate().join('')) { el._valueSet(''); } else { clearOptionalTail(el); } } else { writeBuffer(el, getActiveBuffer()); } installEventRuler(el); } } //action object if (actionObj != undefined) { switch (actionObj["action"]) { case "isComplete": return isComplete(actionObj["buffer"]); case "unmaskedvalue": isRTL = actionObj["$input"].data('_inputmask')['isRTL']; return unmaskedvalue(actionObj["$input"], actionObj["skipDatepickerCheck"]); case "mask": mask(actionObj["el"]); break; case "format": $el = $({}); $el.data('_inputmask', { 'masksets': masksets, 'activeMasksetIndex': activeMasksetIndex, 'opts': opts, 'isRTL': opts.numericInput }); if (opts.numericInput) { opts.isNumeric = opts.numericInput; isRTL = true; } checkVal($el, false, false, actionObj["value"].split(''), true); return getActiveBuffer().join(''); } } } $.inputmask = { //options default defaults: { placeholder: "_", optionalmarker: { start: "[", end: "]" }, quantifiermarker: { start: "{", end: "}" }, groupmarker: { start: "(", end: ")" }, escapeChar: "\\", mask: null, oncomplete: $.noop, //executes when the mask is complete onincomplete: $.noop, //executes when the mask is incomplete and focus is lost oncleared: $.noop, //executes when the mask is cleared repeat: 0, //repetitions of the mask: * ~ forever, otherwise specify an integer greedy: true, //true: allocated buffer for the mask and repetitions - false: allocate only if needed autoUnmask: false, //automatically unmask when retrieving the value with $.fn.val or value if the browser supports __lookupGetter__ or getOwnPropertyDescriptor clearMaskOnLostFocus: true, insertMode: true, //insert the input or overwrite the input clearIncomplete: false, //clear the incomplete input on blur aliases: {}, //aliases definitions => see jquery.inputmask.extensions.js onKeyUp: $.noop, //override to implement autocomplete on certain keys for example onKeyDown: $.noop, //override to implement autocomplete on certain keys for example onBeforePaste: undefined, //executes before masking the pasted value to allow preprocessing of the pasted value. args => pastedValue => return processedValue onUnMask: undefined, //executes after unmasking to allow postprocessing of the unmaskedvalue. args => maskedValue, unmaskedValue showMaskOnFocus: true, //show the mask-placeholder when the input has focus showMaskOnHover: true, //show the mask-placeholder when hovering the empty input onKeyValidation: $.noop, //executes on every key-press with the result of isValid. Params: result, opts skipOptionalPartCharacter: " ", //a character which can be used to skip an optional part of a mask showTooltip: false, //show the activemask as tooltip numericInput: false, //numericInput input direction style (input shifts to the left while holding the caret position) //numeric basic properties isNumeric: false, //enable numeric features radixPoint: "", //".", // | "," skipRadixDance: false, //disable radixpoint caret positioning rightAlignNumerics: true, //align numerics to the right //numeric basic properties definitions: { '9': { validator: "[0-9]", cardinality: 1 }, 'a': { validator: "[A-Za-z\u0410-\u044F\u0401\u0451]", cardinality: 1 }, '*': { validator: "[A-Za-z\u0410-\u044F\u0401\u04510-9]", cardinality: 1 } }, keyCode: { ALT: 18, BACKSPACE: 8, CAPS_LOCK: 20, COMMA: 188, COMMAND: 91, COMMAND_LEFT: 91, COMMAND_RIGHT: 93, CONTROL: 17, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, INSERT: 45, LEFT: 37, MENU: 93, NUMPAD_ADD: 107, NUMPAD_DECIMAL: 110, NUMPAD_DIVIDE: 111, NUMPAD_ENTER: 108, NUMPAD_MULTIPLY: 106, NUMPAD_SUBTRACT: 109, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SHIFT: 16, SPACE: 32, TAB: 9, UP: 38, WINDOWS: 91 }, //specify keycodes which should not be considered in the keypress event, otherwise the preventDefault will stop their default behavior especially in FF ignorables: [8, 9, 13, 19, 27, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 93, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123], getMaskLength: function (buffer, greedy, repeat, currentBuffer, opts) { var calculatedLength = buffer.length; if (!greedy) { if (repeat == "*") { calculatedLength = currentBuffer.length + 1; } else if (repeat > 1) { calculatedLength += (buffer.length * (repeat - 1)); } } return calculatedLength; } }, escapeRegex: function (str) { var specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\']; return str.replace(new RegExp('(\\' + specials.join('|\\') + ')', 'gim'), '\\$1'); }, format: function (value, options) { var opts = $.extend(true, {}, $.inputmask.defaults, options); resolveAlias(opts.alias, options, opts); return maskScope(generateMaskSets(opts), 0, opts, { "action": "format", "value": value }); } }; $.fn.inputmask = function (fn, options) { var opts = $.extend(true, {}, $.inputmask.defaults, options), masksets, activeMasksetIndex = 0; if (typeof fn === "string") { switch (fn) { case "mask": //resolve possible aliases given by options resolveAlias(opts.alias, options, opts); masksets = generateMaskSets(opts); if (masksets.length == 0) { return this; } return this.each(function () { maskScope($.extend(true, {}, masksets), 0, opts, { "action": "mask", "el": this }); }); case "unmaskedvalue": var $input = $(this), input = this; if ($input.data('_inputmask')) { masksets = $input.data('_inputmask')['masksets']; activeMasksetIndex = $input.data('_inputmask')['activeMasksetIndex']; opts = $input.data('_inputmask')['opts']; return maskScope(masksets, activeMasksetIndex, opts, { "action": "unmaskedvalue", "$input": $input }); } else return $input.val(); case "remove": return this.each(function () { var $input = $(this), input = this; if ($input.data('_inputmask')) { masksets = $input.data('_inputmask')['masksets']; activeMasksetIndex = $input.data('_inputmask')['activeMasksetIndex']; opts = $input.data('_inputmask')['opts']; //writeout the unmaskedvalue input._valueSet(maskScope(masksets, activeMasksetIndex, opts, { "action": "unmaskedvalue", "$input": $input, "skipDatepickerCheck": true })); //clear data $input.removeData('_inputmask'); //unbind all events $input.unbind(".inputmask"); $input.removeClass('focus.inputmask'); //restore the value property var valueProperty; if (Object.getOwnPropertyDescriptor) valueProperty = Object.getOwnPropertyDescriptor(input, "value"); if (valueProperty && valueProperty.get) { if (input._valueGet) { Object.defineProperty(input, "value", { get: input._valueGet, set: input._valueSet }); } } else if (document.__lookupGetter__ && input.__lookupGetter__("value")) { if (input._valueGet) { input.__defineGetter__("value", input._valueGet); input.__defineSetter__("value", input._valueSet); } } try { //try catch needed for IE7 as it does not supports deleting fns delete input._valueGet; delete input._valueSet; } catch (e) { input._valueGet = undefined; input._valueSet = undefined; } } }); break; case "getemptymask": //return the default (empty) mask value, usefull for setting the default value in validation if (this.data('_inputmask')) { masksets = this.data('_inputmask')['masksets']; activeMasksetIndex = this.data('_inputmask')['activeMasksetIndex']; return masksets[activeMasksetIndex]['_buffer'].join(''); } else return ""; case "hasMaskedValue": //check wheter the returned value is masked or not; currently only works reliable when using jquery.val fn to retrieve the value return this.data('_inputmask') ? !this.data('_inputmask')['opts'].autoUnmask : false; case "isComplete": masksets = this.data('_inputmask')['masksets']; activeMasksetIndex = this.data('_inputmask')['activeMasksetIndex']; opts = this.data('_inputmask')['opts']; return maskScope(masksets, activeMasksetIndex, opts, { "action": "isComplete", "buffer": this[0]._valueGet().split('') }); case "getmetadata": //return mask metadata if exists if (this.data('_inputmask')) { masksets = this.data('_inputmask')['masksets']; activeMasksetIndex = this.data('_inputmask')['activeMasksetIndex']; return masksets[activeMasksetIndex]['metadata']; } else return undefined; default: //check if the fn is an alias if (!resolveAlias(fn, options, opts)) { //maybe fn is a mask so we try //set mask opts.mask = fn; } masksets = generateMaskSets(opts); if (masksets.length == 0) { return this; } return this.each(function () { maskScope($.extend(true, {}, masksets), activeMasksetIndex, opts, { "action": "mask", "el": this }); }); break; } } else if (typeof fn == "object") { opts = $.extend(true, {}, $.inputmask.defaults, fn); resolveAlias(opts.alias, fn, opts); //resolve aliases masksets = generateMaskSets(opts); if (masksets.length == 0) { return this; } return this.each(function () { maskScope($.extend(true, {}, masksets), activeMasksetIndex, opts, { "action": "mask", "el": this }); }); } else if (fn == undefined) { //look for data-inputmask atribute - the attribute should only contain optipns return this.each(function () { var attrOptions = $(this).attr("data-inputmask"); if (attrOptions && attrOptions != "") { try { attrOptions = attrOptions.replace(new RegExp("'", "g"), '"'); var dataoptions = $.parseJSON("{" + attrOptions + "}"); $.extend(true, dataoptions, options); opts = $.extend(true, {}, $.inputmask.defaults, dataoptions); resolveAlias(opts.alias, dataoptions, opts); opts.alias = undefined; $(this).inputmask(opts); } catch (ex) { } //need a more relax parseJSON } }); } }; } })(jQuery);
2881099/FreeScheduler
22,814
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/input-mask/jquery.inputmask.date.extensions.js
/* Input Mask plugin extensions http://github.com/RobinHerbots/jquery.inputmask Copyright (c) 2010 - 2014 Robin Herbots Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) Version: 0.0.0 Optional extensions on the jquery.inputmask base */ (function ($) { //date & time aliases $.extend($.inputmask.defaults.definitions, { 'h': { //hours validator: "[01][0-9]|2[0-3]", cardinality: 2, prevalidator: [{ validator: "[0-2]", cardinality: 1 }] }, 's': { //seconds || minutes validator: "[0-5][0-9]", cardinality: 2, prevalidator: [{ validator: "[0-5]", cardinality: 1 }] }, 'd': { //basic day validator: "0[1-9]|[12][0-9]|3[01]", cardinality: 2, prevalidator: [{ validator: "[0-3]", cardinality: 1 }] }, 'm': { //basic month validator: "0[1-9]|1[012]", cardinality: 2, prevalidator: [{ validator: "[01]", cardinality: 1 }] }, 'y': { //basic year validator: "(19|20)\\d{2}", cardinality: 4, prevalidator: [ { validator: "[12]", cardinality: 1 }, { validator: "(19|20)", cardinality: 2 }, { validator: "(19|20)\\d", cardinality: 3 } ] } }); $.extend($.inputmask.defaults.aliases, { 'dd/mm/yyyy': { mask: "1/2/y", placeholder: "dd/mm/yyyy", regex: { val1pre: new RegExp("[0-3]"), //daypre val1: new RegExp("0[1-9]|[12][0-9]|3[01]"), //day val2pre: function (separator) { var escapedSeparator = $.inputmask.escapeRegex.call(this, separator); return new RegExp("((0[1-9]|[12][0-9]|3[01])" + escapedSeparator + "[01])"); }, //monthpre val2: function (separator) { var escapedSeparator = $.inputmask.escapeRegex.call(this, separator); return new RegExp("((0[1-9]|[12][0-9])" + escapedSeparator + "(0[1-9]|1[012]))|(30" + escapedSeparator + "(0[13-9]|1[012]))|(31" + escapedSeparator + "(0[13578]|1[02]))"); }//month }, leapday: "29/02/", separator: '/', yearrange: { minyear: 1900, maxyear: 2099 }, isInYearRange: function (chrs, minyear, maxyear) { var enteredyear = parseInt(chrs.concat(minyear.toString().slice(chrs.length))); var enteredyear2 = parseInt(chrs.concat(maxyear.toString().slice(chrs.length))); return (enteredyear != NaN ? minyear <= enteredyear && enteredyear <= maxyear : false) || (enteredyear2 != NaN ? minyear <= enteredyear2 && enteredyear2 <= maxyear : false); }, determinebaseyear: function (minyear, maxyear, hint) { var currentyear = (new Date()).getFullYear(); if (minyear > currentyear) return minyear; if (maxyear < currentyear) { var maxYearPrefix = maxyear.toString().slice(0, 2); var maxYearPostfix = maxyear.toString().slice(2, 4); while (maxyear < maxYearPrefix + hint) { maxYearPrefix--; } var maxxYear = maxYearPrefix + maxYearPostfix; return minyear > maxxYear ? minyear : maxxYear; } return currentyear; }, onKeyUp: function (e, buffer, opts) { var $input = $(this); if (e.ctrlKey && e.keyCode == opts.keyCode.RIGHT) { var today = new Date(); $input.val(today.getDate().toString() + (today.getMonth() + 1).toString() + today.getFullYear().toString()); } }, definitions: { '1': { //val1 ~ day or month validator: function (chrs, buffer, pos, strict, opts) { var isValid = opts.regex.val1.test(chrs); if (!strict && !isValid) { if (chrs.charAt(1) == opts.separator || "-./".indexOf(chrs.charAt(1)) != -1) { isValid = opts.regex.val1.test("0" + chrs.charAt(0)); if (isValid) { buffer[pos - 1] = "0"; return { "pos": pos, "c": chrs.charAt(0) }; } } } return isValid; }, cardinality: 2, prevalidator: [{ validator: function (chrs, buffer, pos, strict, opts) { var isValid = opts.regex.val1pre.test(chrs); if (!strict && !isValid) { isValid = opts.regex.val1.test("0" + chrs); if (isValid) { buffer[pos] = "0"; pos++; return { "pos": pos }; } } return isValid; }, cardinality: 1 }] }, '2': { //val2 ~ day or month validator: function (chrs, buffer, pos, strict, opts) { var frontValue = buffer.join('').substr(0, 3); if (frontValue.indexOf(opts.placeholder[0]) != -1) frontValue = "01" + opts.separator; var isValid = opts.regex.val2(opts.separator).test(frontValue + chrs); if (!strict && !isValid) { if (chrs.charAt(1) == opts.separator || "-./".indexOf(chrs.charAt(1)) != -1) { isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0)); if (isValid) { buffer[pos - 1] = "0"; return { "pos": pos, "c": chrs.charAt(0) }; } } } return isValid; }, cardinality: 2, prevalidator: [{ validator: function (chrs, buffer, pos, strict, opts) { var frontValue = buffer.join('').substr(0, 3); if (frontValue.indexOf(opts.placeholder[0]) != -1) frontValue = "01" + opts.separator; var isValid = opts.regex.val2pre(opts.separator).test(frontValue + chrs); if (!strict && !isValid) { isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs); if (isValid) { buffer[pos] = "0"; pos++; return { "pos": pos }; } } return isValid; }, cardinality: 1 }] }, 'y': { //year validator: function (chrs, buffer, pos, strict, opts) { if (opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) { var dayMonthValue = buffer.join('').substr(0, 6); if (dayMonthValue != opts.leapday) return true; else { var year = parseInt(chrs, 10);//detect leap year if (year % 4 === 0) if (year % 100 === 0) if (year % 400 === 0) return true; else return false; else return true; else return false; } } else return false; }, cardinality: 4, prevalidator: [ { validator: function (chrs, buffer, pos, strict, opts) { var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear); if (!strict && !isValid) { var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 1); isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear); if (isValid) { buffer[pos++] = yearPrefix[0]; return { "pos": pos }; } yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 2); isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear); if (isValid) { buffer[pos++] = yearPrefix[0]; buffer[pos++] = yearPrefix[1]; return { "pos": pos }; } } return isValid; }, cardinality: 1 }, { validator: function (chrs, buffer, pos, strict, opts) { var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear); if (!strict && !isValid) { var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2); isValid = opts.isInYearRange(chrs[0] + yearPrefix[1] + chrs[1], opts.yearrange.minyear, opts.yearrange.maxyear); if (isValid) { buffer[pos++] = yearPrefix[1]; return { "pos": pos }; } yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2); if (opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) { var dayMonthValue = buffer.join('').substr(0, 6); if (dayMonthValue != opts.leapday) isValid = true; else { var year = parseInt(chrs, 10);//detect leap year if (year % 4 === 0) if (year % 100 === 0) if (year % 400 === 0) isValid = true; else isValid = false; else isValid = true; else isValid = false; } } else isValid = false; if (isValid) { buffer[pos - 1] = yearPrefix[0]; buffer[pos++] = yearPrefix[1]; buffer[pos++] = chrs[0]; return { "pos": pos }; } } return isValid; }, cardinality: 2 }, { validator: function (chrs, buffer, pos, strict, opts) { return opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear); }, cardinality: 3 } ] } }, insertMode: false, autoUnmask: false }, 'mm/dd/yyyy': { placeholder: "mm/dd/yyyy", alias: "dd/mm/yyyy", //reuse functionality of dd/mm/yyyy alias regex: { val2pre: function (separator) { var escapedSeparator = $.inputmask.escapeRegex.call(this, separator); return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])"); }, //daypre val2: function (separator) { var escapedSeparator = $.inputmask.escapeRegex.call(this, separator); return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)"); }, //day val1pre: new RegExp("[01]"), //monthpre val1: new RegExp("0[1-9]|1[012]") //month }, leapday: "02/29/", onKeyUp: function (e, buffer, opts) { var $input = $(this); if (e.ctrlKey && e.keyCode == opts.keyCode.RIGHT) { var today = new Date(); $input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString()); } } }, 'yyyy/mm/dd': { mask: "y/1/2", placeholder: "yyyy/mm/dd", alias: "mm/dd/yyyy", leapday: "/02/29", onKeyUp: function (e, buffer, opts) { var $input = $(this); if (e.ctrlKey && e.keyCode == opts.keyCode.RIGHT) { var today = new Date(); $input.val(today.getFullYear().toString() + (today.getMonth() + 1).toString() + today.getDate().toString()); } }, definitions: { '2': { //val2 ~ day or month validator: function (chrs, buffer, pos, strict, opts) { var frontValue = buffer.join('').substr(5, 3); if (frontValue.indexOf(opts.placeholder[5]) != -1) frontValue = "01" + opts.separator; var isValid = opts.regex.val2(opts.separator).test(frontValue + chrs); if (!strict && !isValid) { if (chrs.charAt(1) == opts.separator || "-./".indexOf(chrs.charAt(1)) != -1) { isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0)); if (isValid) { buffer[pos - 1] = "0"; return { "pos": pos, "c": chrs.charAt(0) }; } } } //check leap yeap if (isValid) { var dayMonthValue = buffer.join('').substr(4, 4) + chrs; if (dayMonthValue != opts.leapday) return true; else { var year = parseInt(buffer.join('').substr(0, 4), 10); //detect leap year if (year % 4 === 0) if (year % 100 === 0) if (year % 400 === 0) return true; else return false; else return true; else return false; } } return isValid; }, cardinality: 2, prevalidator: [{ validator: function (chrs, buffer, pos, strict, opts) { var frontValue = buffer.join('').substr(5, 3); if (frontValue.indexOf(opts.placeholder[5]) != -1) frontValue = "01" + opts.separator; var isValid = opts.regex.val2pre(opts.separator).test(frontValue + chrs); if (!strict && !isValid) { isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs); if (isValid) { buffer[pos] = "0"; pos++; return { "pos": pos }; } } return isValid; }, cardinality: 1 }] } } }, 'dd.mm.yyyy': { mask: "1.2.y", placeholder: "dd.mm.yyyy", leapday: "29.02.", separator: '.', alias: "dd/mm/yyyy" }, 'dd-mm-yyyy': { mask: "1-2-y", placeholder: "dd-mm-yyyy", leapday: "29-02-", separator: '-', alias: "dd/mm/yyyy" }, 'mm.dd.yyyy': { mask: "1.2.y", placeholder: "mm.dd.yyyy", leapday: "02.29.", separator: '.', alias: "mm/dd/yyyy" }, 'mm-dd-yyyy': { mask: "1-2-y", placeholder: "mm-dd-yyyy", leapday: "02-29-", separator: '-', alias: "mm/dd/yyyy" }, 'yyyy.mm.dd': { mask: "y.1.2", placeholder: "yyyy.mm.dd", leapday: ".02.29", separator: '.', alias: "yyyy/mm/dd" }, 'yyyy-mm-dd': { mask: "y-1-2", placeholder: "yyyy-mm-dd", leapday: "-02-29", separator: '-', alias: "yyyy/mm/dd" }, 'datetime': { mask: "1/2/y h:s", placeholder: "dd/mm/yyyy hh:mm", alias: "dd/mm/yyyy", regex: { hrspre: new RegExp("[012]"), //hours pre hrs24: new RegExp("2[0-9]|1[3-9]"), hrs: new RegExp("[01][0-9]|2[0-3]"), //hours ampm: new RegExp("^[a|p|A|P][m|M]") }, timeseparator: ':', hourFormat: "24", // or 12 definitions: { 'h': { //hours validator: function (chrs, buffer, pos, strict, opts) { var isValid = opts.regex.hrs.test(chrs); if (!strict && !isValid) { if (chrs.charAt(1) == opts.timeseparator || "-.:".indexOf(chrs.charAt(1)) != -1) { isValid = opts.regex.hrs.test("0" + chrs.charAt(0)); if (isValid) { buffer[pos - 1] = "0"; buffer[pos] = chrs.charAt(0); pos++; return { "pos": pos }; } } } if (isValid && opts.hourFormat !== "24" && opts.regex.hrs24.test(chrs)) { var tmp = parseInt(chrs, 10); if (tmp == 24) { buffer[pos + 5] = "a"; buffer[pos + 6] = "m"; } else { buffer[pos + 5] = "p"; buffer[pos + 6] = "m"; } tmp = tmp - 12; if (tmp < 10) { buffer[pos] = tmp.toString(); buffer[pos - 1] = "0"; } else { buffer[pos] = tmp.toString().charAt(1); buffer[pos - 1] = tmp.toString().charAt(0); } return { "pos": pos, "c": buffer[pos] }; } return isValid; }, cardinality: 2, prevalidator: [{ validator: function (chrs, buffer, pos, strict, opts) { var isValid = opts.regex.hrspre.test(chrs); if (!strict && !isValid) { isValid = opts.regex.hrs.test("0" + chrs); if (isValid) { buffer[pos] = "0"; pos++; return { "pos": pos }; } } return isValid; }, cardinality: 1 }] }, 't': { //am/pm validator: function (chrs, buffer, pos, strict, opts) { return opts.regex.ampm.test(chrs + "m"); }, casing: "lower", cardinality: 1 } }, insertMode: false, autoUnmask: false }, 'datetime12': { mask: "1/2/y h:s t\\m", placeholder: "dd/mm/yyyy hh:mm xm", alias: "datetime", hourFormat: "12" }, 'hh:mm t': { mask: "h:s t\\m", placeholder: "hh:mm xm", alias: "datetime", hourFormat: "12" }, 'h:s t': { mask: "h:s t\\m", placeholder: "hh:mm xm", alias: "datetime", hourFormat: "12" }, 'hh:mm:ss': { mask: "h:s:s", autoUnmask: false }, 'hh:mm': { mask: "h:s", autoUnmask: false }, 'date': { alias: "dd/mm/yyyy" // "mm/dd/yyyy" }, 'mm/yyyy': { mask: "1/y", placeholder: "mm/yyyy", leapday: "donotuse", separator: '/', alias: "mm/dd/yyyy" } }); })(jQuery);
2881099/FreeScheduler
9,392
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/input-mask/jquery.inputmask.regex.extensions.js
/* Input Mask plugin extensions http://github.com/RobinHerbots/jquery.inputmask Copyright (c) 2010 - 2014 Robin Herbots Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) Version: 0.0.0 Regex extensions on the jquery.inputmask base Allows for using regular expressions as a mask */ (function ($) { $.extend($.inputmask.defaults.aliases, { // $(selector).inputmask("Regex", { regex: "[0-9]*"} 'Regex': { mask: "r", greedy: false, repeat: "*", regex: null, regexTokens: null, //Thx to https://github.com/slevithan/regex-colorizer for the tokenizer regex tokenizer: /\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g, quantifierFilter: /[0-9]+[^,]/, definitions: { 'r': { validator: function (chrs, buffer, pos, strict, opts) { function regexToken() { this.matches = []; this.isGroup = false; this.isQuantifier = false; this.isLiteral = false; } function analyseRegex() { var currentToken = new regexToken(), match, m, opengroups = []; opts.regexTokens = []; // The tokenizer regex does most of the tokenization grunt work while (match = opts.tokenizer.exec(opts.regex)) { m = match[0]; switch (m.charAt(0)) { case "[": // Character class case "\\": // Escape or backreference if (opengroups.length > 0) { opengroups[opengroups.length - 1]["matches"].push(m); } else { currentToken.matches.push(m); } break; case "(": // Group opening if (!currentToken.isGroup && currentToken.matches.length > 0) opts.regexTokens.push(currentToken); currentToken = new regexToken(); currentToken.isGroup = true; opengroups.push(currentToken); break; case ")": // Group closing var groupToken = opengroups.pop(); if (opengroups.length > 0) { opengroups[opengroups.length - 1]["matches"].push(groupToken); } else { opts.regexTokens.push(groupToken); currentToken = new regexToken(); } break; case "{": //Quantifier var quantifier = new regexToken(); quantifier.isQuantifier = true; quantifier.matches.push(m); if (opengroups.length > 0) { opengroups[opengroups.length - 1]["matches"].push(quantifier); } else { currentToken.matches.push(quantifier); } break; default: // Vertical bar (alternator) // ^ or $ anchor // Dot (.) // Literal character sequence var literal = new regexToken(); literal.isLiteral = true; literal.matches.push(m); if (opengroups.length > 0) { opengroups[opengroups.length - 1]["matches"].push(literal); } else { currentToken.matches.push(literal); } } } if (currentToken.matches.length > 0) opts.regexTokens.push(currentToken); } function validateRegexToken(token, fromGroup) { var isvalid = false; if (fromGroup) { regexPart += "("; openGroupCount++; } for (var mndx = 0; mndx < token["matches"].length; mndx++) { var matchToken = token["matches"][mndx]; if (matchToken["isGroup"] == true) { isvalid = validateRegexToken(matchToken, true); } else if (matchToken["isQuantifier"] == true) { matchToken = matchToken["matches"][0]; var quantifierMax = opts.quantifierFilter.exec(matchToken)[0].replace("}", ""); var testExp = regexPart + "{1," + quantifierMax + "}"; //relax quantifier validation for (var j = 0; j < openGroupCount; j++) { testExp += ")"; } var exp = new RegExp("^(" + testExp + ")$"); isvalid = exp.test(bufferStr); regexPart += matchToken; } else if (matchToken["isLiteral"] == true) { matchToken = matchToken["matches"][0]; var testExp = regexPart, openGroupCloser = ""; for (var j = 0; j < openGroupCount; j++) { openGroupCloser += ")"; } for (var k = 0; k < matchToken.length; k++) { //relax literal validation testExp = (testExp + matchToken[k]).replace(/\|$/, ""); var exp = new RegExp("^(" + testExp + openGroupCloser + ")$"); isvalid = exp.test(bufferStr); if (isvalid) break; } regexPart += matchToken; //console.log(bufferStr + " " + exp + " " + isvalid); } else { regexPart += matchToken; var testExp = regexPart.replace(/\|$/, ""); for (var j = 0; j < openGroupCount; j++) { testExp += ")"; } var exp = new RegExp("^(" + testExp + ")$"); isvalid = exp.test(bufferStr); //console.log(bufferStr + " " + exp + " " + isvalid); } if (isvalid) break; } if (fromGroup) { regexPart += ")"; openGroupCount--; } return isvalid; } if (opts.regexTokens == null) { analyseRegex(); } var cbuffer = buffer.slice(), regexPart = "", isValid = false, openGroupCount = 0; cbuffer.splice(pos, 0, chrs); var bufferStr = cbuffer.join(''); for (var i = 0; i < opts.regexTokens.length; i++) { var regexToken = opts.regexTokens[i]; isValid = validateRegexToken(regexToken, regexToken["isGroup"]); if (isValid) break; } return isValid; }, cardinality: 1 } } } }); })(jQuery);
2881099/FreeScheduler
5,315
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/input-mask/jquery.inputmask.extensions.js
/* Input Mask plugin extensions http://github.com/RobinHerbots/jquery.inputmask Copyright (c) 2010 - 2014 Robin Herbots Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) Version: 0.0.0 Optional extensions on the jquery.inputmask base */ (function ($) { //extra definitions $.extend($.inputmask.defaults.definitions, { 'A': { validator: "[A-Za-z]", cardinality: 1, casing: "upper" //auto uppercasing }, '#': { validator: "[A-Za-z\u0410-\u044F\u0401\u04510-9]", cardinality: 1, casing: "upper" } }); $.extend($.inputmask.defaults.aliases, { 'url': { mask: "ir", placeholder: "", separator: "", defaultPrefix: "http://", regex: { urlpre1: new RegExp("[fh]"), urlpre2: new RegExp("(ft|ht)"), urlpre3: new RegExp("(ftp|htt)"), urlpre4: new RegExp("(ftp:|http|ftps)"), urlpre5: new RegExp("(ftp:/|ftps:|http:|https)"), urlpre6: new RegExp("(ftp://|ftps:/|http:/|https:)"), urlpre7: new RegExp("(ftp://|ftps://|http://|https:/)"), urlpre8: new RegExp("(ftp://|ftps://|http://|https://)") }, definitions: { 'i': { validator: function (chrs, buffer, pos, strict, opts) { return true; }, cardinality: 8, prevalidator: (function () { var result = [], prefixLimit = 8; for (var i = 0; i < prefixLimit; i++) { result[i] = (function () { var j = i; return { validator: function (chrs, buffer, pos, strict, opts) { if (opts.regex["urlpre" + (j + 1)]) { var tmp = chrs, k; if (((j + 1) - chrs.length) > 0) { tmp = buffer.join('').substring(0, ((j + 1) - chrs.length)) + "" + tmp; } var isValid = opts.regex["urlpre" + (j + 1)].test(tmp); if (!strict && !isValid) { pos = pos - j; for (k = 0; k < opts.defaultPrefix.length; k++) { buffer[pos] = opts.defaultPrefix[k]; pos++; } for (k = 0; k < tmp.length - 1; k++) { buffer[pos] = tmp[k]; pos++; } return { "pos": pos }; } return isValid; } else { return false; } }, cardinality: j }; })(); } return result; })() }, "r": { validator: ".", cardinality: 50 } }, insertMode: false, autoUnmask: false }, "ip": { //ip-address mask mask: ["[[x]y]z.[[x]y]z.[[x]y]z.x[yz]", "[[x]y]z.[[x]y]z.[[x]y]z.[[x]y][z]"], definitions: { 'x': { validator: "[012]", cardinality: 1, definitionSymbol: "i" }, 'y': { validator: function (chrs, buffer, pos, strict, opts) { if (pos - 1 > -1 && buffer[pos - 1] != ".") chrs = buffer[pos - 1] + chrs; else chrs = "0" + chrs; return new RegExp("2[0-5]|[01][0-9]").test(chrs); }, cardinality: 1, definitionSymbol: "i" }, 'z': { validator: function (chrs, buffer, pos, strict, opts) { if (pos - 1 > -1 && buffer[pos - 1] != ".") { chrs = buffer[pos - 1] + chrs; if (pos - 2 > -1 && buffer[pos - 2] != ".") { chrs = buffer[pos - 2] + chrs; } else chrs = "0" + chrs; } else chrs = "00" + chrs; return new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs); }, cardinality: 1, definitionSymbol: "i" } } } }); })(jQuery);
2881099/FreeScheduler
9,118
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/input-mask/jquery.inputmask.numeric.extensions.js
/* Input Mask plugin extensions http://github.com/RobinHerbots/jquery.inputmask Copyright (c) 2010 - 2014 Robin Herbots Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) Version: 0.0.0 Optional extensions on the jquery.inputmask base */ (function ($) { //number aliases $.extend($.inputmask.defaults.aliases, { 'decimal': { mask: "~", placeholder: "", repeat: "*", greedy: false, numericInput: false, isNumeric: true, digits: "*", //number of fractionalDigits groupSeparator: "",//",", // | "." radixPoint: ".", groupSize: 3, autoGroup: false, allowPlus: true, allowMinus: true, //todo integerDigits: "*", //number of integerDigits defaultValue: "", prefix: "", suffix: "", //todo getMaskLength: function (buffer, greedy, repeat, currentBuffer, opts) { //custom getMaskLength to take the groupSeparator into account var calculatedLength = buffer.length; if (!greedy) { if (repeat == "*") { calculatedLength = currentBuffer.length + 1; } else if (repeat > 1) { calculatedLength += (buffer.length * (repeat - 1)); } } var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator); var escapedRadixPoint = $.inputmask.escapeRegex.call(this, opts.radixPoint); var currentBufferStr = currentBuffer.join(''), strippedBufferStr = currentBufferStr.replace(new RegExp(escapedGroupSeparator, "g"), "").replace(new RegExp(escapedRadixPoint), ""), groupOffset = currentBufferStr.length - strippedBufferStr.length; return calculatedLength + groupOffset; }, postFormat: function (buffer, pos, reformatOnly, opts) { if (opts.groupSeparator == "") return pos; var cbuf = buffer.slice(), radixPos = $.inArray(opts.radixPoint, buffer); if (!reformatOnly) { cbuf.splice(pos, 0, "?"); //set position indicator } var bufVal = cbuf.join(''); if (opts.autoGroup || (reformatOnly && bufVal.indexOf(opts.groupSeparator) != -1)) { var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator); bufVal = bufVal.replace(new RegExp(escapedGroupSeparator, "g"), ''); var radixSplit = bufVal.split(opts.radixPoint); bufVal = radixSplit[0]; var reg = new RegExp('([-\+]?[\\d\?]+)([\\d\?]{' + opts.groupSize + '})'); while (reg.test(bufVal)) { bufVal = bufVal.replace(reg, '$1' + opts.groupSeparator + '$2'); bufVal = bufVal.replace(opts.groupSeparator + opts.groupSeparator, opts.groupSeparator); } if (radixSplit.length > 1) bufVal += opts.radixPoint + radixSplit[1]; } buffer.length = bufVal.length; //align the length for (var i = 0, l = bufVal.length; i < l; i++) { buffer[i] = bufVal.charAt(i); } var newPos = $.inArray("?", buffer); if (!reformatOnly) buffer.splice(newPos, 1); return reformatOnly ? pos : newPos; }, regex: { number: function (opts) { var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator); var escapedRadixPoint = $.inputmask.escapeRegex.call(this, opts.radixPoint); var digitExpression = isNaN(opts.digits) ? opts.digits : '{0,' + opts.digits + '}'; var signedExpression = opts.allowPlus || opts.allowMinus ? "[" + (opts.allowPlus ? "\+" : "") + (opts.allowMinus ? "-" : "") + "]?" : ""; return new RegExp("^" + signedExpression + "(\\d+|\\d{1," + opts.groupSize + "}((" + escapedGroupSeparator + "\\d{" + opts.groupSize + "})?)+)(" + escapedRadixPoint + "\\d" + digitExpression + ")?$"); } }, onKeyDown: function (e, buffer, opts) { var $input = $(this), input = this; if (e.keyCode == opts.keyCode.TAB) { var radixPosition = $.inArray(opts.radixPoint, buffer); if (radixPosition != -1) { var masksets = $input.data('_inputmask')['masksets']; var activeMasksetIndex = $input.data('_inputmask')['activeMasksetIndex']; for (var i = 1; i <= opts.digits && i < opts.getMaskLength(masksets[activeMasksetIndex]["_buffer"], masksets[activeMasksetIndex]["greedy"], masksets[activeMasksetIndex]["repeat"], buffer, opts) ; i++) { if (buffer[radixPosition + i] == undefined || buffer[radixPosition + i] == "") buffer[radixPosition + i] = "0"; } input._valueSet(buffer.join('')); } } else if (e.keyCode == opts.keyCode.DELETE || e.keyCode == opts.keyCode.BACKSPACE) { opts.postFormat(buffer, 0, true, opts); input._valueSet(buffer.join('')); return true; } }, definitions: { '~': { //real number validator: function (chrs, buffer, pos, strict, opts) { if (chrs == "") return false; if (!strict && pos <= 1 && buffer[0] === '0' && new RegExp("[\\d-]").test(chrs) && buffer.join('').length == 1) { //handle first char buffer[0] = ""; return { "pos": 0 }; } var cbuf = strict ? buffer.slice(0, pos) : buffer.slice(); cbuf.splice(pos, 0, chrs); var bufferStr = cbuf.join(''); //strip groupseparator var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator); bufferStr = bufferStr.replace(new RegExp(escapedGroupSeparator, "g"), ''); var isValid = opts.regex.number(opts).test(bufferStr); if (!isValid) { //let's help the regex a bit bufferStr += "0"; isValid = opts.regex.number(opts).test(bufferStr); if (!isValid) { //make a valid group var lastGroupSeparator = bufferStr.lastIndexOf(opts.groupSeparator); for (var i = bufferStr.length - lastGroupSeparator; i <= 3; i++) { bufferStr += "0"; } isValid = opts.regex.number(opts).test(bufferStr); if (!isValid && !strict) { if (chrs == opts.radixPoint) { isValid = opts.regex.number(opts).test("0" + bufferStr + "0"); if (isValid) { buffer[pos] = "0"; pos++; return { "pos": pos }; } } } } } if (isValid != false && !strict && chrs != opts.radixPoint) { var newPos = opts.postFormat(buffer, pos, false, opts); return { "pos": newPos }; } return isValid; }, cardinality: 1, prevalidator: null } }, insertMode: true, autoUnmask: false }, 'integer': { regex: { number: function (opts) { var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator); var signedExpression = opts.allowPlus || opts.allowMinus ? "[" + (opts.allowPlus ? "\+" : "") + (opts.allowMinus ? "-" : "") + "]?" : ""; return new RegExp("^" + signedExpression + "(\\d+|\\d{1," + opts.groupSize + "}((" + escapedGroupSeparator + "\\d{" + opts.groupSize + "})?)+)$"); } }, alias: "decimal" } }); })(jQuery);
2881099/FreeScheduler
2,730
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/html5shiv/html5shiv.min.js
/** * @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed */ !function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.3",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b),"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:this,document);
2881099/FreeScheduler
4,110
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/multiple-select/CHANGELOG.md
## Changelog ### 1.2.1 * [bug] Fix #84: single select with Optgroups bug. * [bug] Fix #154: special character problem. * [enh] Added `dropWidth` option. * [enh] Added `open` and `close` methods. * [enh] Fix #139: Added onFilter event. * [enh] Fix #144: added `animate` option to support fade and slide animates. * [bug] Fix #257: <label> element detection. * [bug] Fix jQuery dependency. * [bug] Fixed disable issue. * [enh] Add selected class to 'select all' option. * [enh] Added logic to perform accent insensitive compare when filtering values. * [bug] Fix #264: updated the default of textTemplate to .html(). ### 1.2.0 * [enh] Update `jquery.multiple.select.js` to `multiple-select.js`. * [bug] Fix filter not match bug. * [enh] Trigger change for select after set of new value. * [bug] Prevents `updateSelectAll()` from calling `options.onCheckAll()` on init. * [enh] Added `labelTemplate` option. * [bug] Fix #188: Automatically set Group when all child was selected. * [bug] Fixed filter functionality with 'no-results' label behavior. * [bug] Fix #184: prevented the dropdown handle error. * [enh] INPUT tags should be nameless. * [bug] Fix #48: auto hide when the single option is set to true. * [bug] Fix #65: show selectAll and hide noResults when open. * [bug] Fix #45, #64: update width option to support a percentage setting. * [bug] Trigger the checkbox on the entire line. * [bug] Added `noMatchesFound` option. * [bug] Update `seperator` to `separator`. * [enh] Allow object of options along with initial method. * [enh] Add a `filterAcceptOnEnter` option. * [enh] Put class on ms-parent div instead of ul. * [bug] Fixed #99: connect select back to its label. * [enh] Added `hideOptgroupCheckboxes` option to hide optgroup checkboxes. * [enh] Added `displayValues` and `delimiter` options. * [enh] Added `textTemplate` option to custom the text. * [enh] Added `selectAllDelimiter` option. * [enh] Added `ellipsis` option. * [enh] Get percentage width, if used. * [bug] Fix #134: spelling error. * [bug] Fixed the error when element id's contain colons. * [bug] Fix current selected element not displayed in newer jquery versions. * [bug] Fix #148 plain text stored to HTML. * [bug] Update multiple-select.png. * [enh] Added 'close' to allowedMethods. * [bug] Prevent dropdown from closing occasionally when clicking on checkbox. * [bug] Fixed dropdown not closing when focus was lost. * [enh] Support for add title (tooltip) on the select list. ### 1.1.0 * Fix #63: Add ```keepOpen``` option. * Fix #62: Fix ```isOpen``` and ```filter``` options are both true bug. * Fix #57: Fire onCheckAll event when literally select. * Add data attributes for support. * Fix #55: Add ```name``` option. ### 1.0.9 * Fix #42: Add ```styler``` option to custom item style. * Fix firefox click bug. * Add ```allSelected```, ```minimumCountSelected``` and ```countSelected``` options. * Fix #35: Add ```onFocus``` and ```onBlur``` events. * Fix #25: Add ```focus``` and ```blur``` methods. * Fix #31: Trigger the onCheckAll & onUncheckAll events when use filter to select all. ### 1.0.8 * Update the license to The MIT License. * Fix #47: Add ```No matches found``` message when there are no results found. * Fix #43: Add ```position``` option. ### 1.0.7 * Fix #44: The filters not working bugs. ### 1.0.6 * Fix #21: Add ```single``` option. * Add ```override``` option. * Add ```container``` option. * Fix #29: Update the optgroups select text. * Fix #30: Image is not shown in Firefox 25.0.1. * Fix #22: fix group filter problem. ### 1.0.5 * Update the button text witdh. * Add keyboard support. ### 1.0.4 * Fix #12: Add ```width``` option. * Fix #11: Add callback events. * Add ```maxHeight``` option. ### 1.0.3 * Fix #4: Add ```filter``` option. * Support mobile devices. * Fix #6: Add ```refresh``` method. ### 1.0.2 * Fix #7: Add ```selected``` and ```disabled``` options. * Fix #5: Add ```checkAll``` and ```uncheckAll``` methods. ### 1.0.1 * Fix #3: Add optgroups support. * Add ```placeholder``` option. * Fix #2: use prop method instead of attr. ### 1.0.0 * Initial release
2881099/FreeScheduler
34,149
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/multiple-select/multiple-select.js
/** * @author zhixin wen <wenzhixin2010@gmail.com> * @version 1.2.1 * * http://wenzhixin.net.cn/p/multiple-select/ */ (function ($) { 'use strict'; // it only does '%s', and return '' when arguments are undefined var sprintf = function (str) { var args = arguments, flag = true, i = 1; str = str.replace(/%s/g, function () { var arg = args[i++]; if (typeof arg === 'undefined') { flag = false; return ''; } return arg; }); return flag ? str : ''; }; var removeDiacritics = function (str) { var defaultDiacriticsRemovalMap = [ {'base':'A', 'letters':/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g}, {'base':'AA','letters':/[\uA732]/g}, {'base':'AE','letters':/[\u00C6\u01FC\u01E2]/g}, {'base':'AO','letters':/[\uA734]/g}, {'base':'AU','letters':/[\uA736]/g}, {'base':'AV','letters':/[\uA738\uA73A]/g}, {'base':'AY','letters':/[\uA73C]/g}, {'base':'B', 'letters':/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g}, {'base':'C', 'letters':/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g}, {'base':'D', 'letters':/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g}, {'base':'DZ','letters':/[\u01F1\u01C4]/g}, {'base':'Dz','letters':/[\u01F2\u01C5]/g}, {'base':'E', 'letters':/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g}, {'base':'F', 'letters':/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g}, {'base':'G', 'letters':/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g}, {'base':'H', 'letters':/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g}, {'base':'I', 'letters':/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g}, {'base':'J', 'letters':/[\u004A\u24BF\uFF2A\u0134\u0248]/g}, {'base':'K', 'letters':/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g}, {'base':'L', 'letters':/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g}, {'base':'LJ','letters':/[\u01C7]/g}, {'base':'Lj','letters':/[\u01C8]/g}, {'base':'M', 'letters':/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g}, {'base':'N', 'letters':/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g}, {'base':'NJ','letters':/[\u01CA]/g}, {'base':'Nj','letters':/[\u01CB]/g}, {'base':'O', 'letters':/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g}, {'base':'OI','letters':/[\u01A2]/g}, {'base':'OO','letters':/[\uA74E]/g}, {'base':'OU','letters':/[\u0222]/g}, {'base':'P', 'letters':/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g}, {'base':'Q', 'letters':/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g}, {'base':'R', 'letters':/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g}, {'base':'S', 'letters':/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g}, {'base':'T', 'letters':/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g}, {'base':'TZ','letters':/[\uA728]/g}, {'base':'U', 'letters':/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g}, {'base':'V', 'letters':/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g}, {'base':'VY','letters':/[\uA760]/g}, {'base':'W', 'letters':/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g}, {'base':'X', 'letters':/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g}, {'base':'Y', 'letters':/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g}, {'base':'Z', 'letters':/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g}, {'base':'a', 'letters':/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g}, {'base':'aa','letters':/[\uA733]/g}, {'base':'ae','letters':/[\u00E6\u01FD\u01E3]/g}, {'base':'ao','letters':/[\uA735]/g}, {'base':'au','letters':/[\uA737]/g}, {'base':'av','letters':/[\uA739\uA73B]/g}, {'base':'ay','letters':/[\uA73D]/g}, {'base':'b', 'letters':/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g}, {'base':'c', 'letters':/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g}, {'base':'d', 'letters':/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g}, {'base':'dz','letters':/[\u01F3\u01C6]/g}, {'base':'e', 'letters':/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g}, {'base':'f', 'letters':/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g}, {'base':'g', 'letters':/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g}, {'base':'h', 'letters':/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g}, {'base':'hv','letters':/[\u0195]/g}, {'base':'i', 'letters':/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g}, {'base':'j', 'letters':/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g}, {'base':'k', 'letters':/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g}, {'base':'l', 'letters':/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g}, {'base':'lj','letters':/[\u01C9]/g}, {'base':'m', 'letters':/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g}, {'base':'n', 'letters':/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g}, {'base':'nj','letters':/[\u01CC]/g}, {'base':'o', 'letters':/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g}, {'base':'oi','letters':/[\u01A3]/g}, {'base':'ou','letters':/[\u0223]/g}, {'base':'oo','letters':/[\uA74F]/g}, {'base':'p','letters':/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g}, {'base':'q','letters':/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g}, {'base':'r','letters':/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g}, {'base':'s','letters':/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g}, {'base':'t','letters':/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g}, {'base':'tz','letters':/[\uA729]/g}, {'base':'u','letters':/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g}, {'base':'v','letters':/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g}, {'base':'vy','letters':/[\uA761]/g}, {'base':'w','letters':/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g}, {'base':'x','letters':/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g}, {'base':'y','letters':/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g}, {'base':'z','letters':/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g} ]; for (var i = 0; i < defaultDiacriticsRemovalMap.length; i++) { str = str.replace(defaultDiacriticsRemovalMap[i].letters, defaultDiacriticsRemovalMap[i].base); } return str; }; function MultipleSelect($el, options) { var that = this, name = $el.attr('name') || options.name || ''; this.options = options; // hide select element this.$el = $el.hide(); // label element this.$label = this.$el.closest('label'); if (this.$label.length === 0 && this.$el.attr('id')) { this.$label = $(sprintf('label[for="%s"]', this.$el.attr('id').replace(/:/g, '\\:'))); } // restore class and title from select element this.$parent = $(sprintf( '<div class="ms-parent %s" %s/>', $el.attr('class') || '', sprintf('title="%s"', $el.attr('title')))); // add placeholder to choice button this.$choice = $(sprintf([ '<button type="button" class="ms-choice">', '<span class="placeholder">%s</span>', '<div></div>', '</button>' ].join(''), this.options.placeholder)); // default position is bottom this.$drop = $(sprintf('<div class="ms-drop %s"%s></div>', this.options.position, sprintf(' style="width: %s"', this.options.dropWidth))); this.$el.after(this.$parent); this.$parent.append(this.$choice); this.$parent.append(this.$drop); if (this.$el.prop('disabled')) { this.$choice.addClass('disabled'); } this.$parent.css('width', this.options.width || this.$el.css('width') || this.$el.outerWidth() + 20); this.selectAllName = 'data-name="selectAll' + name + '"'; this.selectGroupName = 'data-name="selectGroup' + name + '"'; this.selectItemName = 'data-name="selectItem' + name + '"'; if (!this.options.keepOpen) { $(document).click(function (e) { if ($(e.target)[0] === that.$choice[0] || $(e.target).parents('.ms-choice')[0] === that.$choice[0]) { return; } if (($(e.target)[0] === that.$drop[0] || $(e.target).parents('.ms-drop')[0] !== that.$drop[0] && e.target !== $el[0]) && that.options.isOpen) { that.close(); } }); } } MultipleSelect.prototype = { constructor: MultipleSelect, init: function () { var that = this, $ul = $('<ul></ul>'); this.$drop.html(''); if (this.options.filter) { this.$drop.append([ '<div class="ms-search">', '<input type="text" autocomplete="off" autocorrect="off" autocapitilize="off" spellcheck="false">', '</div>'].join('') ); } if (this.options.selectAll && !this.options.single) { $ul.append([ '<li class="ms-select-all">', '<label>', sprintf('<input type="checkbox" %s /> ', this.selectAllName), this.options.selectAllDelimiter[0], this.options.selectAllText, this.options.selectAllDelimiter[1], '</label>', '</li>' ].join('')); } $.each(this.$el.children(), function (i, elm) { $ul.append(that.optionToHtml(i, elm)); }); $ul.append(sprintf('<li class="ms-no-results">%s</li>', this.options.noMatchesFound)); this.$drop.append($ul); this.$drop.find('ul').css('max-height', this.options.maxHeight + 'px'); this.$drop.find('.multiple').css('width', this.options.multipleWidth + 'px'); this.$searchInput = this.$drop.find('.ms-search input'); this.$selectAll = this.$drop.find('input[' + this.selectAllName + ']'); this.$selectGroups = this.$drop.find('input[' + this.selectGroupName + ']'); this.$selectItems = this.$drop.find('input[' + this.selectItemName + ']:enabled'); this.$disableItems = this.$drop.find('input[' + this.selectItemName + ']:disabled'); this.$noResults = this.$drop.find('.ms-no-results'); this.events(); this.updateSelectAll(true); this.update(true); if (this.options.isOpen) { this.open(); } }, optionToHtml: function (i, elm, group, groupDisabled) { var that = this, $elm = $(elm), classes = $elm.attr('class') || '', title = sprintf('title="%s"', $elm.attr('title')), multiple = this.options.multiple ? 'multiple' : '', disabled, type = this.options.single ? 'radio' : 'checkbox'; if ($elm.is('option')) { var value = $elm.val(), text = that.options.textTemplate($elm), selected = $elm.prop('selected'), style = sprintf('style="%s"', this.options.styler(value)), $el; disabled = groupDisabled || $elm.prop('disabled'); $el = $([ sprintf('<li class="%s %s" %s %s>', multiple, classes, title, style), sprintf('<label class="%s">', disabled ? 'disabled' : ''), sprintf('<input type="%s" %s%s%s%s>', type, this.selectItemName, selected ? ' checked="checked"' : '', disabled ? ' disabled="disabled"' : '', sprintf(' data-group="%s"', group)), sprintf('<span>%s</span>', text), '</label>', '</li>' ].join('')); $el.find('input').val(value); return $el; } if ($elm.is('optgroup')) { var label = that.options.labelTemplate($elm), $group = $('<div/>'); group = 'group_' + i; disabled = $elm.prop('disabled'); $group.append([ '<li class="group">', sprintf('<label class="optgroup %s" data-group="%s">', disabled ? 'disabled' : '', group), this.options.hideOptgroupCheckboxes || this.options.single ? '' : sprintf('<input type="checkbox" %s %s>', this.selectGroupName, disabled ? 'disabled="disabled"' : ''), label, '</label>', '</li>' ].join('')); $.each($elm.children(), function (i, elm) { $group.append(that.optionToHtml(i, elm, group, disabled)); }); return $group.html(); } }, events: function () { var that = this, toggleOpen = function (e) { e.preventDefault(); that[that.options.isOpen ? 'close' : 'open'](); }; if (this.$label) { this.$label.off('click').on('click', function (e) { if (e.target.nodeName.toLowerCase() !== 'label' || e.target !== this) { return; } toggleOpen(e); if (!that.options.filter || !that.options.isOpen) { that.focus(); } e.stopPropagation(); // Causes lost focus otherwise }); } this.$choice.off('click').on('click', toggleOpen) .off('focus').on('focus', this.options.onFocus) .off('blur').on('blur', this.options.onBlur); this.$parent.off('keydown').on('keydown', function (e) { switch (e.which) { case 27: // esc key that.close(); that.$choice.focus(); break; } }); this.$searchInput.off('keydown').on('keydown',function (e) { // Ensure shift-tab causes lost focus from filter as with clicking away if (e.keyCode === 9 && e.shiftKey) { that.close(); } }).off('keyup').on('keyup', function (e) { // enter or space // Avoid selecting/deselecting if no choices made if (that.options.filterAcceptOnEnter && (e.which === 13 || e.which == 32) && that.$searchInput.val()) { that.$selectAll.click(); that.close(); that.focus(); return; } that.filter(); }); this.$selectAll.off('click').on('click', function () { var checked = $(this).prop('checked'), $items = that.$selectItems.filter(':visible'); if ($items.length === that.$selectItems.length) { that[checked ? 'checkAll' : 'uncheckAll'](); } else { // when the filter option is true that.$selectGroups.prop('checked', checked); $items.prop('checked', checked); that.options[checked ? 'onCheckAll' : 'onUncheckAll'](); that.update(); } }); this.$selectGroups.off('click').on('click', function () { var group = $(this).parent().attr('data-group'), $items = that.$selectItems.filter(':visible'), $children = $items.filter(sprintf('[data-group="%s"]', group)), checked = $children.length !== $children.filter(':checked').length; $children.prop('checked', checked); that.updateSelectAll(); that.update(); that.options.onOptgroupClick({ label: $(this).parent().text(), checked: checked, children: $children.get(), instance: that }); }); this.$selectItems.off('click').on('click', function () { that.updateSelectAll(); that.update(); that.updateOptGroupSelect(); that.options.onClick({ label: $(this).parent().text(), value: $(this).val(), checked: $(this).prop('checked'), instance: that }); if (that.options.single && that.options.isOpen && !that.options.keepOpen) { that.close(); } if (that.options.single) { var clickedVal = $(this).val(); that.$selectItems.filter(function() { return $(this).val() !== clickedVal; }).each(function() { $(this).prop('checked', false); }); that.update(); } }); }, open: function () { if (this.$choice.hasClass('disabled')) { return; } this.options.isOpen = true; this.$choice.find('>div').addClass('open'); this.$drop[this.animateMethod('show')](); // fix filter bug: no results show this.$selectAll.parent().show(); this.$noResults.hide(); // Fix #77: 'All selected' when no options if (!this.$el.children().length) { this.$selectAll.parent().hide(); this.$noResults.show(); } if (this.options.container) { var offset = this.$drop.offset(); this.$drop.appendTo($(this.options.container)); this.$drop.offset({ top: offset.top, left: offset.left }); } if (this.options.filter) { this.$searchInput.val(''); this.$searchInput.focus(); this.filter(); } this.options.onOpen(); }, close: function () { this.options.isOpen = false; this.$choice.find('>div').removeClass('open'); this.$drop[this.animateMethod('hide')](); if (this.options.container) { this.$parent.append(this.$drop); this.$drop.css({ 'top': 'auto', 'left': 'auto' }); } this.options.onClose(); }, animateMethod: function (method) { var methods = { show: { fade: 'fadeIn', slide: 'slideDown' }, hide: { fade: 'fadeOut', slide: 'slideUp' } }; return methods[method][this.options.animate] || method; }, update: function (isInit) { var selects = this.options.displayValues ? this.getSelects() : this.getSelects('text'), $span = this.$choice.find('>span'), sl = selects.length; if (sl === 0) { $span.addClass('placeholder').html(this.options.placeholder); } else if (this.options.allSelected && sl === this.$selectItems.length + this.$disableItems.length) { $span.removeClass('placeholder').html(this.options.allSelected); } else if (this.options.ellipsis && sl > this.options.minimumCountSelected) { $span.removeClass('placeholder').text(selects.slice(0, this.options.minimumCountSelected) .join(this.options.delimiter) + '...'); } else if (this.options.countSelected && sl > this.options.minimumCountSelected) { $span.removeClass('placeholder').html(this.options.countSelected .replace('#', selects.length) .replace('%', this.$selectItems.length + this.$disableItems.length)); } else { $span.removeClass('placeholder').text(selects.join(this.options.delimiter)); } if (this.options.addTitle) { $span.prop('title', this.getSelects('text')); } // set selects to select this.$el.val(this.getSelects()).trigger('change'); // add selected class to selected li this.$drop.find('li').removeClass('selected'); this.$drop.find('input:checked').each(function () { $(this).parents('li').first().addClass('selected'); }); // trigger <select> change event if (!isInit) { this.$el.trigger('change'); } }, updateSelectAll: function (isInit) { var $items = this.$selectItems; if (!isInit) { $items = $items.filter(':visible'); } this.$selectAll.prop('checked', $items.length && $items.length === $items.filter(':checked').length); if (!isInit && this.$selectAll.prop('checked')) { this.options.onCheckAll(); } }, updateOptGroupSelect: function () { var $items = this.$selectItems.filter(':visible'); $.each(this.$selectGroups, function (i, val) { var group = $(val).parent().attr('data-group'), $children = $items.filter(sprintf('[data-group="%s"]', group)); $(val).prop('checked', $children.length && $children.length === $children.filter(':checked').length); }); }, //value or text, default: 'value' getSelects: function (type) { var that = this, texts = [], values = []; this.$drop.find(sprintf('input[%s]:checked', this.selectItemName)).each(function () { texts.push($(this).parents('li').first().text()); values.push($(this).val()); }); if (type === 'text' && this.$selectGroups.length) { texts = []; this.$selectGroups.each(function () { var html = [], text = $.trim($(this).parent().text()), group = $(this).parent().data('group'), $children = that.$drop.find(sprintf('[%s][data-group="%s"]', that.selectItemName, group)), $selected = $children.filter(':checked'); if (!$selected.length) { return; } html.push('['); html.push(text); if ($children.length > $selected.length) { var list = []; $selected.each(function () { list.push($(this).parent().text()); }); html.push(': ' + list.join(', ')); } html.push(']'); texts.push(html.join('')); }); } return type === 'text' ? texts : values; }, setSelects: function (values) { var that = this; this.$selectItems.prop('checked', false); this.$disableItems.prop('checked', false); $.each(values, function (i, value) { that.$selectItems.filter(sprintf('[value="%s"]', value)).prop('checked', true); that.$disableItems.filter(sprintf('[value="%s"]', value)).prop('checked', true); }); this.$selectAll.prop('checked', this.$selectItems.length === this.$selectItems.filter(':checked').length + this.$disableItems.filter(':checked').length); $.each(that.$selectGroups, function (i, val) { var group = $(val).parent().attr('data-group'), $children = that.$selectItems.filter('[data-group="' + group + '"]'); $(val).prop('checked', $children.length && $children.length === $children.filter(':checked').length); }); this.update(); }, enable: function () { this.$choice.removeClass('disabled'); }, disable: function () { this.$choice.addClass('disabled'); }, checkAll: function () { this.$selectItems.prop('checked', true); this.$selectGroups.prop('checked', true); this.$selectAll.prop('checked', true); this.update(); this.options.onCheckAll(); }, uncheckAll: function () { this.$selectItems.prop('checked', false); this.$selectGroups.prop('checked', false); this.$selectAll.prop('checked', false); this.update(); this.options.onUncheckAll(); }, focus: function () { this.$choice.focus(); this.options.onFocus(); }, blur: function () { this.$choice.blur(); this.options.onBlur(); }, refresh: function () { this.init(); }, filter: function () { var that = this, text = $.trim(this.$searchInput.val()).toLowerCase(); if (text.length === 0) { this.$selectAll.parent().show(); this.$selectItems.parent().show(); this.$disableItems.parent().show(); this.$selectGroups.parent().show(); this.$noResults.hide(); } else { this.$selectItems.each(function () { var $parent = $(this).parent(); $parent[removeDiacritics($parent.text().toLowerCase()).indexOf(removeDiacritics(text)) < 0 ? 'hide' : 'show'](); }); this.$disableItems.parent().hide(); this.$selectGroups.each(function () { var $parent = $(this).parent(); var group = $parent.attr('data-group'), $items = that.$selectItems.filter(':visible'); $parent[$items.filter(sprintf('[data-group="%s"]', group)).length ? 'show' : 'hide'](); }); //Check if no matches found if (this.$selectItems.parent().filter(':visible').length) { this.$selectAll.parent().show(); this.$noResults.hide(); } else { this.$selectAll.parent().hide(); this.$noResults.show(); } } this.updateOptGroupSelect(); this.updateSelectAll(); this.options.onFilter(text); } }; $.fn.multipleSelect = function () { var option = arguments[0], args = arguments, value, allowedMethods = [ 'getSelects', 'setSelects', 'enable', 'disable', 'open', 'close', 'checkAll', 'uncheckAll', 'focus', 'blur', 'refresh', 'close' ]; this.each(function () { var $this = $(this), data = $this.data('multipleSelect'), options = $.extend({}, $.fn.multipleSelect.defaults, $this.data(), typeof option === 'object' && option); if (!data) { data = new MultipleSelect($this, options); $this.data('multipleSelect', data); } if (typeof option === 'string') { if ($.inArray(option, allowedMethods) < 0) { throw 'Unknown method: ' + option; } value = data[option](args[1]); } else { data.init(); if (args[1]) { value = data[args[1]].apply(data, [].slice.call(args, 2)); } } }); return typeof value !== 'undefined' ? value : this; }; $.fn.multipleSelect.defaults = { name: '', isOpen: false, placeholder: '', selectAll: true, selectAllDelimiter: ['[', ']'], minimumCountSelected: 3, ellipsis: false, multiple: false, multipleWidth: 80, single: false, filter: false, width: undefined, dropWidth: undefined, maxHeight: 250, container: null, position: 'bottom', keepOpen: false, animate: 'none', // 'none', 'fade', 'slide' displayValues: false, delimiter: ', ', addTitle: false, filterAcceptOnEnter: false, hideOptgroupCheckboxes: false, selectAllText: 'Select all', allSelected: 'All selected', countSelected: '# of % selected', noMatchesFound: 'No matches found', styler: function () { return false; }, textTemplate: function ($elm) { return $elm.html(); }, labelTemplate: function ($elm) { return $elm.attr('label'); }, onOpen: function () { return false; }, onClose: function () { return false; }, onCheckAll: function () { return false; }, onUncheckAll: function () { return false; }, onFocus: function () { return false; }, onBlur: function () { return false; }, onOptgroupClick: function () { return false; }, onClick: function () { return false; }, onFilter: function () { return false; } }; })(jQuery);
2894638479/fabric-blue-archive-halo
2,872
gradlew.bat
@rem @rem Copyright 2015 the original author or authors. @rem @rem Licensed under the Apache License, Version 2.0 (the "License"); @rem you may not use this file except in compliance with the License. @rem You may obtain a copy of the License at @rem @rem https://www.apache.org/licenses/LICENSE-2.0 @rem @rem Unless required by applicable law or agreed to in writing, software @rem distributed under the License is distributed on an "AS IS" BASIS, @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem @rem SPDX-License-Identifier: Apache-2.0 @rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @rem @rem ########################################################################## @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Resolve any "." and ".." in APP_HOME to make it shorter. for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute echo. 1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 echo. 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo location of your Java installation. 1>&2 goto fail :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute echo. 1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 echo. 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo location of your Java installation. 1>&2 goto fail :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! set EXIT_CODE=%ERRORLEVEL% if %EXIT_CODE% equ 0 set EXIT_CODE=1 if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal :omega
2881099/FreeScheduler
4,282
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/multiple-select/multiple-select.css
/** * @author zhixin wen <wenzhixin2010@gmail.com> */ .ms-parent { display: inline-block; position: relative; vertical-align: middle; } .ms-choice { display: block; width: 100%; height: 26px; padding: 0; overflow: hidden; cursor: pointer; border: 1px solid #aaa; text-align: left; white-space: nowrap; line-height: 26px; color: #444; text-decoration: none; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; background-color: #fff; } .ms-choice.disabled { background-color: #f4f4f4; background-image: none; border: 1px solid #ddd; cursor: default; } .ms-choice > span { position: absolute; top: 0; left: 0; right: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; padding-left: 8px; } .ms-choice > span.placeholder { color: #999; } .ms-choice > div { position: absolute; top: 0; right: 0; width: 20px; height: 25px; background: url('multiple-select.png') left top no-repeat; } .ms-choice > div.open { background: url('multiple-select.png') right top no-repeat; } .ms-drop { width: 100%; overflow: hidden; display: none; margin-top: -1px; padding: 0; position: absolute; z-index: 1000; background: #fff; color: #000; border: 1px solid #aaa; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .ms-drop.bottom { top: 100%; -webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, .15); -moz-box-shadow: 0 4px 5px rgba(0, 0, 0, .15); box-shadow: 0 4px 5px rgba(0, 0, 0, .15); } .ms-drop.top { bottom: 100%; -webkit-box-shadow: 0 -4px 5px rgba(0, 0, 0, .15); -moz-box-shadow: 0 -4px 5px rgba(0, 0, 0, .15); box-shadow: 0 -4px 5px rgba(0, 0, 0, .15); } .ms-search { display: inline-block; margin: 0; min-height: 26px; padding: 4px; position: relative; white-space: nowrap; width: 100%; z-index: 10000; } .ms-search input { width: 100%; height: auto !important; min-height: 24px; padding: 0 20px 0 5px; margin: 0; outline: 0; font-family: sans-serif; font-size: 1em; border: 1px solid #aaa; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; background: #fff url('multiple-select.png') no-repeat 100% -22px; background: url('multiple-select.png') no-repeat 100% -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee)); background: url('multiple-select.png') no-repeat 100% -22px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%); background: url('multiple-select.png') no-repeat 100% -22px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%); background: url('multiple-select.png') no-repeat 100% -22px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%); background: url('multiple-select.png') no-repeat 100% -22px, -ms-linear-gradient(top, #ffffff 85%, #eeeeee 99%); background: url('multiple-select.png') no-repeat 100% -22px, linear-gradient(top, #ffffff 85%, #eeeeee 99%); } .ms-search, .ms-search input { -webkit-box-sizing: border-box; -khtml-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; } .ms-drop ul { overflow: auto; margin: 0; padding: 5px 8px; } .ms-drop ul > li { list-style: none; display: list-item; background-image: none; position: static; } .ms-drop ul > li .disabled { opacity: .35; filter: Alpha(Opacity=35); } .ms-drop ul > li.multiple { display: block; float: left; } .ms-drop ul > li.group { clear: both; } .ms-drop ul > li.multiple label { width: 100%; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .ms-drop ul > li label { font-weight: normal; display: block; white-space: nowrap; } .ms-drop ul > li label.optgroup { font-weight: bold; } .ms-drop input[type="checkbox"] { vertical-align: middle; } .ms-drop .ms-no-results { display: none; }
2881099/FreeScheduler
3,405
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/ionslider/ion.rangeSlider.css
/* Ion.RangeSlider // css version 2.0.3 // © 2013-2014 Denis Ineshin | IonDen.com // ===================================================================================================================*/ /* ===================================================================================================================== // RangeSlider */ .irs { position: relative; display: block; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .irs-line { position: relative; display: block; overflow: hidden; outline: none !important; } .irs-line-left, .irs-line-mid, .irs-line-right { position: absolute; display: block; top: 0; } .irs-line-left { left: 0; width: 11%; } .irs-line-mid { left: 9%; width: 82%; } .irs-line-right { right: 0; width: 11%; } .irs-bar { position: absolute; display: block; left: 0; width: 0; } .irs-bar-edge { position: absolute; display: block; top: 0; left: 0; } .irs-shadow { position: absolute; display: none; left: 0; width: 0; } .irs-slider { position: absolute; display: block; cursor: default; z-index: 1; } .irs-slider.single { } .irs-slider.from { } .irs-slider.to { } .irs-slider.type_last { z-index: 2; } .irs-min { position: absolute; display: block; left: 0; cursor: default; } .irs-max { position: absolute; display: block; right: 0; cursor: default; } .irs-from, .irs-to, .irs-single { position: absolute; display: block; top: 0; left: 0; cursor: default; white-space: nowrap; } .irs-grid { position: absolute; display: none; bottom: 0; left: 0; width: 100%; height: 20px; } .irs-with-grid .irs-grid { display: block; } .irs-grid-pol { position: absolute; top: 0; left: 0; width: 1px; height: 8px; background: #000; } .irs-grid-pol.small { height: 4px; } .irs-grid-text { position: absolute; bottom: 0; left: 0; white-space: nowrap; text-align: center; font-size: 9px; line-height: 9px; padding: 0 3px; color: #000; } .irs-disable-mask { position: absolute; display: block; top: 0; left: -1%; width: 102%; height: 100%; cursor: default; background: rgba(0,0,0,0.0); z-index: 2; } .lt-ie9 .irs-disable-mask { background: #000; filter: alpha(opacity=0); cursor: not-allowed; } .irs-disabled { opacity: 0.4; } .irs-hidden-input { position: absolute !important; display: block !important; top: 0 !important; left: 0 !important; width: 0 !important; height: 0 !important; font-size: 0 !important; line-height: 0 !important; padding: 0 !important; margin: 0 !important; outline: none !important; z-index: -9999 !important; background: none !important; border-style: solid !important; border-color: transparent !important; }
2891954521/LiteLoaderQQNT-OneBotApi-JS
1,182
README.md
# OneBot API JS 在 LiteLoaderQQNT 上添加 OneBot11 协议支持 项目灵感来源于[LiteLoaderQQNT-OneBotApi](https://github.com/linyuchen/LiteLoaderQQNT-OneBotApi),本项目为JS实现 ## 关于 - 本项目为轻量级框架,仅实现了部分核心功能,可能不支持现有的QQ机器人框架 - QQ版本仅在 Windows 下 `9.9.12.25765`([点击下载](https://dldir1.qq.com/qqfile/qq/QQNT/960a88c0/QQ9.9.12.25765_x64.exe)) 测试运行通过 - 框架功能仍在完善中,如在使用时遇到问题或有任何希望改进的地方欢迎提交 Issue ## 安装方法 1. 安装 [LiteLoaderQQNT](https://github.com/LiteLoaderQQNT/LiteLoaderQQNT) 1.0.0 及以上版本 2. 下载本项目插件 [LiteLoaderQQNT-OneBotApi-JS](https://github.com/2891954521/LiteLoaderQQNT-OneBotApi-JS/releases) 并手动放置在LiteLoaderQQNT插件目录下:`./LiteLoaderQQNT/plugins` ## API文档 详见 [OneBot11](https://github.com/botuniverse/onebot-11),所有已实现的 API 如无特殊说明均以 OneBot11 文档为准 - **支持的通信方式** - HTTP API 和 上报 - 正向 WebSocket - 反向 WebSocket - **支持的API** - 收发消息、频道消息、撤回消息、获取好友/群列表等 - 详见 [HTTP API](https://github.com/2891954521/LiteLoaderQQNT-OneBotApi-JS/blob/main/doc/http.md) - **支持的消息类型** - 支持常见消息类型:文本、表情、图片、At、回复、撤回等 - 详见 [Message](https://github.com/2891954521/LiteLoaderQQNT-OneBotApi-JS/blob/main/doc/message.md) 和 [Notice](https://github.com/2891954521/LiteLoaderQQNT-OneBotApi-JS/blob/main/doc/notice.md)
2894638479/fabric-blue-archive-halo
8,740
gradlew
#!/bin/sh # # Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # SPDX-License-Identifier: Apache-2.0 # ############################################################################## # # Gradle start up script for POSIX generated by Gradle. # # Important for running: # # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is # noncompliant, but you have some other compliant shell such as ksh or # bash, then to run this script, type that shell name before the whole # command line, like: # # ksh Gradle # # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», # «${var#prefix}», «${var%suffix}», and «$( cmd )»; # * compound commands having a testable exit status, especially «case»; # * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # # (2) This script targets any POSIX shell, so it avoids extensions provided # by Bash, Ksh, etc; in particular arrays are avoided. # # The "traditional" practice of packing multiple parameters into a # space-separated string is a well documented source of bugs and security # problems, so this is (mostly) avoided, by progressively accumulating # options in "$@", and eventually passing that to Java. # # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; # see the in-line comments for details. # # There are tweaks for specific operating systems such as AIX, CygWin, # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. # ############################################################################## # Attempt to set APP_HOME # Resolve links: $0 may be a link app_path=$0 # Need this for daisy-chained symlinks. while APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path [ -h "$app_path" ] do ls=$( ls -ld "$app_path" ) link=${ls#*' -> '} case $link in #( /*) app_path=$link ;; #( *) app_path=$APP_HOME$link ;; esac done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum warn () { echo "$*" } >&2 die () { echo echo "$*" echo exit 1 } >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false case "$( uname )" in #( CYGWIN* ) cygwin=true ;; #( Darwin* ) darwin=true ;; #( MSYS* | MINGW* ) msys=true ;; #( NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD=$JAVA_HOME/jre/sh/java else JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else JAVACMD=java if ! command -v java >/dev/null 2>&1 then die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi # Collect all arguments for the java command, stacking in reverse order: # * args from the command line # * the main class name # * -classpath # * -D...appname settings # * --module-path (only if needed) # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) # Now convert the arguments - kludge to limit ourselves to /bin/sh for arg do if case $arg in #( -*) false ;; # don't mess with options #( /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath [ -e "$t" ] ;; #( *) false ;; esac then arg=$( cygpath --path --ignore --mixed "$arg" ) fi # Roll the args list around exactly as many times as the number of # args, so each arg winds up back in the position where it started, but # possibly modified. # # NB: a `for` loop captures its iteration list before it begins, so # changing the positional parameters here affects neither the number of # iterations, nor the values presented in `arg`. shift # remove old arg set -- "$@" "$arg" # push replacement arg done fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ org.gradle.wrapper.GradleWrapperMain \ "$@" # Stop when "xargs" is not available. if ! command -v xargs >/dev/null 2>&1 then die "xargs is not available" fi # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. # # In Bash we could simply go: # # readarray ARGS < <( xargs -n1 <<<"$var" ) && # set -- "${ARGS[@]}" "$@" # # but POSIX shell has neither arrays nor command substitution, so instead we # post-process each arg (as a line of input to sed) to backslash-escape any # character that might be a shell metacharacter, then use eval to reverse # that process (while maintaining the separation between arguments), and wrap # the whole thing up as a single "set" statement. # # This will of course break if any of these variables contains a newline or # an unmatched quote. # eval "set -- $( printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | xargs -n1 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | tr '\n' ' ' )" '"$@"' exec "$JAVACMD" "$@"
2894638479/fabric-blue-archive-halo
3,189
build.gradle
plugins { id 'fabric-loom' version "${loom_version}" id 'maven-publish' id "org.jetbrains.kotlin.jvm" version "2.1.10" id 'org.jetbrains.kotlin.plugin.serialization' version '2.1.10' } version = project.mod_version + '-' + project.minecraft_version group = project.maven_group base { archivesName = project.archives_base_name } repositories { // Add repositories to retrieve artifacts from in here. // You should only use this when depending on other mods because // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. // See https://docs.gradle.org/current/userguide/declaring_repositories.html // for more information about repositories. maven { url "https://maven.terraformersmc.com" } } loom { splitEnvironmentSourceSets() mods { "blue-archive-halo" { sourceSet sourceSets.main sourceSet sourceSets.client } } accessWidenerPath = file("src/main/resources/bahalo.accesswidener") } dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modImplementation "net.fabricmc:fabric-language-kotlin:${project.fabric_kotlin_version}" modImplementation "com.terraformersmc:modmenu:${project.mod_menu_version}" implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:${project.kotlin_serialization_version}" } processResources { inputs.property "version", project.version inputs.property "fabric_kotlin_version", project.fabric_kotlin_version filesMatching("fabric.mod.json") { expand ( "version": inputs.properties.version, "fabric_kotlin_version": inputs.properties.fabric_kotlin_version ) } } tasks.withType(JavaCompile).configureEach { it.options.release = 17 } tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { kotlinOptions { jvmTarget = 17 } } java { // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task // if it is present. // If you remove this line, sources will not be generated. withSourcesJar() sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } jar { inputs.property "archivesName", project.base.archivesName from("LICENSE") { rename { "${it}_${inputs.properties.archivesName}"} } } // configure the maven publication publishing { publications { create("mavenJava", MavenPublication) { artifactId = project.archives_base_name from components.java } } // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. repositories { // Add repositories to publish to here. // Notice: This block does NOT have the same function as the block in the top level. // The repositories here will be used for publishing your artifact, not for // retrieving dependencies. } }
2891954521/LiteLoaderQQNT-OneBotApi-JS
9,476
doc/http.md
# HTTP API 目前已实现的API如下表所示 | URL | 是否支持 | 注释 | |-----------------------------------------------------------|:----:|---------------| | 消息处理 | | | | [`send_msg`](#send_msg) | ✓ | 发送消息 | | `send_private_msg` | ✓ | 发送私聊消息 | | `send_group_msg` | ✓ | 发送群消息 | | [`delete_msg`](#delete_msg) | ✓ | 撤回消息 | | [`get_msg`](#get_msg) | ✓ | 获取消息 | | [`get_record`](#get_record) | | 获取语音 | | [`get_image`](#get_image) | | 获取图片 | | [`get_forward_msg`](#get_forward_msg) | ✓ | 获取合并转发消息 | | [`can_send_image`](#can_send_image) | | 检查是否可以发送图片 | | [`can_send_record`](#can_send_record) | | 检查是否可以发送语音 | | 好友信息 | | | | [`get_login_info`](#get_login_info) | ✓ | 获取登录号信息 | | [`get_friend_list`](#get_friend_list) | ✓ | 获取好友列表 | | [`get_stranger_info`](#get_stranger_info) | | 获取陌生人信息 | | 群信息 | | | | [`get_group_list`](#get_group_list) | ✓ | 获取群列表 | | [`get_group_info`](#get_group_info) | ✓ | 获取群信息 | | [`get_group_member_list`](#get_group_member_list) | ✓ | 获取群成员列表 | | [`get_group_member_info`](#get_group_member_info) | ✓ | 获取群成员信息 | | 好友请求 | | | | [`set_friend_add_request`](#set_friend_add_request) | ✓ | 处理加好友请求 | | [`set_group_add_request`](#set_group_add_request) | | 处理加群请求/邀请 | | 好友操作 | | | | [`send_like`](#send_like) | ✓ | 发送好友赞 | | 群操作 | | | | [`set_group_kick`](#set_group_kick) | ✓ | 群组踢人 | | [`set_group_anonymous`](#set_group_anonymous) | | 群组匿名 | | [`set_group_admin`](#set_group_admin) | ✓ | 群组设置管理员 | | [`set_group_ban`](#set_group_ban) | ✓ | 群组单人禁言 | | [`set_group_whole_ban`](#set_group_whole_ban) | ✓ | 群组全员禁言 | | [`set_group_anonymous_ban`](#set_group_anonymous_ban) | | 群组匿名用户禁言 | | [`get_group_honor_info`](#get_group_honor_info) | | 获取群荣誉信息 | | [`set_group_name`](#set_group_name) | ✓ | 设置群名 | | [`set_group_special_title`](#set_group_special_title) | | 设置群组专属头衔 | | [`set_group_card`](#set_group_card) | ✓ | 设置群名片群备注 | | [`set_group_leave`](#set_group_leave) | ✓ | 退出群组 | | 频道 | | | | [`get_guild_service_profile`](#get_guild_service_profile) | ✓ | 获取频道系统内BOT的资料 | | [`get_guild_list`](#get_guild_list) | ✓ | 获取频道列表 | | [`send_guild_channel_msg`](#send_guild_channel_msg) | ✓ | 发送信息到子频道 | | 其他 | | | | [`get_status`](#get_status) | | 获取运行状态 | | [`get_version_info`](#get_version_info) | | 获取版本信息 | | [`set_restart`](#set_restart) | | 重启 OneBot 实现 | | [`clean_cache`](#clean_cache) | | 清理缓存 | ## `send_msg` ### 发送消息 目前 `send_msg`, `send_private_msg`, `send_group_msg` 三个接口可以通用,传入 `group_id` 发送群消息, 传入 `user_id` 发送私聊消息,优先判断 `group_id` **请求体** ```json lines { "user_id": "123456", // 目标QQ号, user_id 和 group_id 二选一,类型可以是 string 也可以是 int "group_id": "123456", // 目标群号 "message": "Hello World" // 发送的消息,可以为字符串,也可以为消息数组 } ``` **响应体** ```json lines { "status": "ok", "retcode": 0, "data": { "message_id": "123456" // 消息msgId } } ``` ## `delete_msg` ### 撤回消息 如有需要可以额外传入被撤回消息所属的 QQ群号 / 好友QQ号,这样即使发送的消息在Bot框架启动之前也可撤回,但是**msgId不存在的话会直接导致QQ崩溃** **请求体** ```json lines { "message_id": "123456", // 消息的msgId, 上报的消息和发送的消息均带有此参数 "group_id": "123456", // (可选)消息所属的群 "user_id": "123456", // (可选)消息所属的好友QQ } ``` **响应体** ```json lines { "status": "ok", "retcode": 0 } ``` ## `get_msg` ### 获取消息 只支持获取Bot框架启动之后收到的消息,无法获取历史消息 **请求体** ```json lines { "message_id": "123456", // 消息的msgId } ``` **响应体** ```json lines { "status": "ok", "retcode": 0, "data": { "time": 0, "self_id": "123456", "post_type": "message", "message_id": "123456", "message_type": "private", "sub_type": "friend", "user_id": "", "group_id": "", "message": [ ] } } ``` ## `get_forward_msg` ### 获取合并转发消息 如果发送的消息在Bot框架启动之前,可以额外传入被撤回消息所属的 QQ群号 / 好友QQ号 来获取消息内容 **请求体** ```json lines { "id": "123456", // 消息的msgId, 上报的消息和发送的消息均带有此参数 "group_id": "123456", // (可选)消息所属的群 "user_id": "123456", // (可选)消息所属的好友QQ } ``` **响应体** ```json lines { "status": "ok", "retcode": 0, "data": { "message": [ { "type": "node", "data": { "user_id": "10001000", "content": [ {"type": "face", "data": {"id": "123"}}, {"type": "text", "data": {"text": "哈喽~"}} ] } } ] } } ``` ## `get_login_info` ### 获取账号信息 **响应体** ```json lines { "status": "ok", "retcode": 0, "data": [ { "user_id": "123456" // QQ 号 } ] } ``` ## `get_friend_list` ### 获取好友列表 **响应体** ```json lines { "status": "ok", "retcode": 0, "data": [ { "user_id": "123456", // 好友QQ号 "nickname": "", // 好友昵称 "remark": "" // 好友备注 } ] } ``` ## `get_group_list` ### 获取群列表 **响应体** ```json lines { status: 'ok', retcode: 0, "data": [ { "group_id": "123456", // 群号 "group_name": "", // 群名称 "member_count": "", // 成员数 "max_member_count": "" // 最大成员数(群容量) } ] } ``` ## `get_group_info` ### 获取群信息 **请求体** ```json lines { "group_id": 123456, // 群号 } ``` **响应体** ```json lines { status: 'ok', retcode: 0, "data": { "group_id": "123456", // 群号 "group_name": "", // 群名称 "member_count": "", // 成员数 "max_member_count": "" // 最大成员数(群容量) } } ``` ## `get_group_member_list` ### 获取群成员列表 **请求体** ```json lines { "group_id": 123456, // 群号 "no_cache": false // 是否使用缓存 } ``` **响应体** ```json lines { status: 'ok', retcode: 0, "data": [ { "group_id": 123456, // 群号 "user_id": 123456, // QQ 号 "nickname": "", // 昵称, "card": "", // 群名片/备注, "role": "", // 角色,owner 或 admin 或 member } ] } ``` ## `get_group_member_info` ### 获取群成员信息 **请求体** ```json lines { "group_id": 123456, // 群号 "user_id": 123456, // QQ号 "no_cache": false // 是否使用缓存 } ``` **响应体** ```json lines { status: 'ok', retcode: 0, "data": { "group_id": 123456, // 群号 "user_id": 123456, // QQ 号 "nickname": "", // 昵称, "card": "", // 群名片/备注, "level": 1, // 群等级 "role": "", // 角色,owner 或 admin 或 member "sex": "male", // 性别,male 或 female 或 unknown "age": 1, // 年龄 "area": "中国 浙江 杭州", // 所在地 "raw": {} // 原始数据,包括群成员信息和用户信息 } } ``` ## `set_friend_add_request` ### 处理好友请求 **请求体** ```json lines { "flag": "xxxxx", // 上报的flag "approve": true // 是否接受 } ``` ## `send_like` ### 发送好友赞 **请求体** ```json lines { "user_id": "123456", // 对方 QQ 号 "times": 1 // 赞的次数,每个好友每天最多 10 次 } ``` ## `set_group_kick` ### 群组踢人 **请求体** ```json lines { "group_id": "123456", // 群号 "user_id": "123456", // 要踢的群成员QQ号 "reject_add_request": false // 拒绝此人的加群请求 } ``` ## `set_group_ban` ### 群组单人禁言 **请求体** ```json lines { "group_id": "123456", // 群号 "user_id": "123456", // 要禁言的群成员QQ号 "duration": 60 // 禁言时长,单位秒,0 表示取消禁言 } ``` ## `set_group_whole_ban` ### 群组全员禁言 **请求体** ```json lines { "group_id": "123456", // 群号 "enable": true, // 是否禁言 } ``` ## `set_group_name` ### 设置群名 **请求体** ```json lines { "group_id": "123456", // 群号 "group_name": "群名称", // 新群名 } ``` # 频道 频道API均参考 [Go-cqhttp](https://docs.go-cqhttp.org/api/guild.html) 文档 ## `get_guild_service_profile` ### 获取频道系统内BOT的资料 ## `get_guild_list` ### 获取频道列表 ## `send_guild_channel_msg` ### 发送信息到子频道 发送消息前请先调用一次`get_guild_list`,否则会报错找不到频道
2891954521/LiteLoaderQQNT-OneBotApi-JS
1,409
doc/notice.md
# 通知消息 ### 支持的消息类型 | 消息类型 | 接收 | 备注 | |--------|:--:|----| | 好友请求 | ✔ | | | | 好友消息撤回 | ✔ | | | | 群消息撤回 | ✔ | | | | 群成员减少 | ✔ | | | | 群成员增加 | ✔ | | | ## 消息结构 ### 收到好友请求 ```json lines { "request_type": "friend", "user_id": "123456", // 好友QQ号 "comment": "我是xxx", // 加好友的验证消息 "flag": "xxxx" // 处理好友请求的flag } ``` ### 好友消息撤回 ```json lines { "time": 1708072121, "self_id": "123456", "post_type": "notice", "notice_type": "friend_recall", "user_id": "123456", "operator_id": "123456", "message_id": "xxxxxx", } ``` ### 群消息撤回 ```json lines { "time": 1708072121, "self_id": "123456", "post_type": "notice", "notice_type": "group_recall", "user_id": "123456", "group_id": "123456", "operator_id": "123456", "message_id": "xxxxxx", } ``` ### 群成员减少 ```json lines { "time": 1708072121, "self_id": "123456", "post_type": "notice", "notice_type": "group_decrease", "sub_type": "leave", "user_id": "123456", "group_id": "123456", "operator_id": "123456" } ``` ### 群成员增加 ```json lines { "time": 1708072121, "self_id": "123456", "post_type": "notice", "notice_type": "group_increase", "sub_type": "invite", "user_id": "123456", "group_id": "123456", "operator_id": "123456" } ```
2881099/FreeScheduler
38,732
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/ionslider/ion.rangeSlider.min.js
// Ion.RangeSlider | version 2.1.2 | https://github.com/IonDen/ion.rangeSlider ;(function(f,r,h,t,v){var u=0,p=function(){var a=t.userAgent,b=/msie\s\d+/i;return 0<a.search(b)&&(a=b.exec(a).toString(),a=a.split(" ")[1],9>a)?(f("html").addClass("lt-ie9"),!0):!1}();Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,d=[].slice;if("function"!=typeof b)throw new TypeError;var c=d.call(arguments,1),e=function(){if(this instanceof e){var g=function(){};g.prototype=b.prototype;var g=new g,l=b.apply(g,c.concat(d.call(arguments)));return Object(l)===l?l:g}return b.apply(a, c.concat(d.call(arguments)))};return e});Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){var d;if(null==this)throw new TypeError('"this" is null or not defined');var c=Object(this),e=c.length>>>0;if(0===e)return-1;d=+b||0;Infinity===Math.abs(d)&&(d=0);if(d>=e)return-1;for(d=Math.max(0<=d?d:e-Math.abs(d),0);d<e;){if(d in c&&c[d]===a)return d;d++}return-1});var q=function(a,b,d){this.VERSION="2.1.2";this.input=a;this.plugin_count=d;this.old_to=this.old_from=this.update_tm=this.calc_count= this.current_plugin=0;this.raf_id=this.old_min_interval=null;this.is_update=this.is_key=this.no_diapason=this.force_redraw=this.dragging=!1;this.is_start=!0;this.is_click=this.is_resize=this.is_active=this.is_finish=!1;this.$cache={win:f(h),body:f(r.body),input:f(a),cont:null,rs:null,min:null,max:null,from:null,to:null,single:null,bar:null,line:null,s_single:null,s_from:null,s_to:null,shad_single:null,shad_from:null,shad_to:null,edge:null,grid:null,grid_labels:[]};this.coords={x_gap:0,x_pointer:0, w_rs:0,w_rs_old:0,w_handle:0,p_gap:0,p_gap_left:0,p_gap_right:0,p_step:0,p_pointer:0,p_handle:0,p_single_fake:0,p_single_real:0,p_from_fake:0,p_from_real:0,p_to_fake:0,p_to_real:0,p_bar_x:0,p_bar_w:0,grid_gap:0,big_num:0,big:[],big_w:[],big_p:[],big_x:[]};this.labels={w_min:0,w_max:0,w_from:0,w_to:0,w_single:0,p_min:0,p_max:0,p_from_fake:0,p_from_left:0,p_to_fake:0,p_to_left:0,p_single_fake:0,p_single_left:0};var c=this.$cache.input;a=c.prop("value");var e;d={type:"single",min:10,max:100,from:null, to:null,step:1,min_interval:0,max_interval:0,drag_interval:!1,values:[],p_values:[],from_fixed:!1,from_min:null,from_max:null,from_shadow:!1,to_fixed:!1,to_min:null,to_max:null,to_shadow:!1,prettify_enabled:!0,prettify_separator:" ",prettify:null,force_edges:!1,keyboard:!1,keyboard_step:5,grid:!1,grid_margin:!0,grid_num:4,grid_snap:!1,hide_min_max:!1,hide_from_to:!1,prefix:"",postfix:"",max_postfix:"",decorate_both:!0,values_separator:" \u2014 ",input_values_separator:";",disable:!1,onStart:null, onChange:null,onFinish:null,onUpdate:null};c={type:c.data("type"),min:c.data("min"),max:c.data("max"),from:c.data("from"),to:c.data("to"),step:c.data("step"),min_interval:c.data("minInterval"),max_interval:c.data("maxInterval"),drag_interval:c.data("dragInterval"),values:c.data("values"),from_fixed:c.data("fromFixed"),from_min:c.data("fromMin"),from_max:c.data("fromMax"),from_shadow:c.data("fromShadow"),to_fixed:c.data("toFixed"),to_min:c.data("toMin"),to_max:c.data("toMax"),to_shadow:c.data("toShadow"), prettify_enabled:c.data("prettifyEnabled"),prettify_separator:c.data("prettifySeparator"),force_edges:c.data("forceEdges"),keyboard:c.data("keyboard"),keyboard_step:c.data("keyboardStep"),grid:c.data("grid"),grid_margin:c.data("gridMargin"),grid_num:c.data("gridNum"),grid_snap:c.data("gridSnap"),hide_min_max:c.data("hideMinMax"),hide_from_to:c.data("hideFromTo"),prefix:c.data("prefix"),postfix:c.data("postfix"),max_postfix:c.data("maxPostfix"),decorate_both:c.data("decorateBoth"),values_separator:c.data("valuesSeparator"), input_values_separator:c.data("inputValuesSeparator"),disable:c.data("disable")};c.values=c.values&&c.values.split(",");for(e in c)c.hasOwnProperty(e)&&(c[e]||0===c[e]||delete c[e]);a&&(a=a.split(c.input_values_separator||b.input_values_separator||";"),a[0]&&a[0]==+a[0]&&(a[0]=+a[0]),a[1]&&a[1]==+a[1]&&(a[1]=+a[1]),b&&b.values&&b.values.length?(d.from=a[0]&&b.values.indexOf(a[0]),d.to=a[1]&&b.values.indexOf(a[1])):(d.from=a[0]&&+a[0],d.to=a[1]&&+a[1]));f.extend(d,b);f.extend(d,c);this.options=d;this.validate(); this.result={input:this.$cache.input,slider:null,min:this.options.min,max:this.options.max,from:this.options.from,from_percent:0,from_value:null,to:this.options.to,to_percent:0,to_value:null};this.init()};q.prototype={init:function(a){this.no_diapason=!1;this.coords.p_step=this.convertToPercent(this.options.step,!0);this.target="base";this.toggleInput();this.append();this.setMinMax();a?(this.force_redraw=!0,this.calc(!0),this.callOnUpdate()):(this.force_redraw=!0,this.calc(!0),this.callOnStart()); this.updateScene()},append:function(){this.$cache.input.before('<span class="irs js-irs-'+this.plugin_count+'"></span>');this.$cache.input.prop("readonly",!0);this.$cache.cont=this.$cache.input.prev();this.result.slider=this.$cache.cont;this.$cache.cont.html('<span class="irs"><span class="irs-line" tabindex="-1"><span class="irs-line-left"></span><span class="irs-line-mid"></span><span class="irs-line-right"></span></span><span class="irs-min">0</span><span class="irs-max">1</span><span class="irs-from">0</span><span class="irs-to">0</span><span class="irs-single">0</span></span><span class="irs-grid"></span><span class="irs-bar"></span>'); this.$cache.rs=this.$cache.cont.find(".irs");this.$cache.min=this.$cache.cont.find(".irs-min");this.$cache.max=this.$cache.cont.find(".irs-max");this.$cache.from=this.$cache.cont.find(".irs-from");this.$cache.to=this.$cache.cont.find(".irs-to");this.$cache.single=this.$cache.cont.find(".irs-single");this.$cache.bar=this.$cache.cont.find(".irs-bar");this.$cache.line=this.$cache.cont.find(".irs-line");this.$cache.grid=this.$cache.cont.find(".irs-grid");"single"===this.options.type?(this.$cache.cont.append('<span class="irs-bar-edge"></span><span class="irs-shadow shadow-single"></span><span class="irs-slider single"></span>'), this.$cache.edge=this.$cache.cont.find(".irs-bar-edge"),this.$cache.s_single=this.$cache.cont.find(".single"),this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden",this.$cache.shad_single=this.$cache.cont.find(".shadow-single")):(this.$cache.cont.append('<span class="irs-shadow shadow-from"></span><span class="irs-shadow shadow-to"></span><span class="irs-slider from"></span><span class="irs-slider to"></span>'),this.$cache.s_from=this.$cache.cont.find(".from"), this.$cache.s_to=this.$cache.cont.find(".to"),this.$cache.shad_from=this.$cache.cont.find(".shadow-from"),this.$cache.shad_to=this.$cache.cont.find(".shadow-to"),this.setTopHandler());this.options.hide_from_to&&(this.$cache.from[0].style.display="none",this.$cache.to[0].style.display="none",this.$cache.single[0].style.display="none");this.appendGrid();this.options.disable?(this.appendDisableMask(),this.$cache.input[0].disabled=!0):(this.$cache.cont.removeClass("irs-disabled"),this.$cache.input[0].disabled= !1,this.bindEvents());this.options.drag_interval&&(this.$cache.bar[0].style.cursor="ew-resize")},setTopHandler:function(){var a=this.options.max,b=this.options.to;this.options.from>this.options.min&&b===a?this.$cache.s_from.addClass("type_last"):b<a&&this.$cache.s_to.addClass("type_last")},changeLevel:function(a){switch(a){case "single":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_single_fake);break;case "from":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_from_fake); this.$cache.s_from.addClass("state_hover");this.$cache.s_from.addClass("type_last");this.$cache.s_to.removeClass("type_last");break;case "to":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_to_fake);this.$cache.s_to.addClass("state_hover");this.$cache.s_to.addClass("type_last");this.$cache.s_from.removeClass("type_last");break;case "both":this.coords.p_gap_left=this.toFixed(this.coords.p_pointer-this.coords.p_from_fake),this.coords.p_gap_right=this.toFixed(this.coords.p_to_fake- this.coords.p_pointer),this.$cache.s_to.removeClass("type_last"),this.$cache.s_from.removeClass("type_last")}},appendDisableMask:function(){this.$cache.cont.append('<span class="irs-disable-mask"></span>');this.$cache.cont.addClass("irs-disabled")},remove:function(){this.$cache.cont.remove();this.$cache.cont=null;this.$cache.line.off("keydown.irs_"+this.plugin_count);this.$cache.body.off("touchmove.irs_"+this.plugin_count);this.$cache.body.off("mousemove.irs_"+this.plugin_count);this.$cache.win.off("touchend.irs_"+ this.plugin_count);this.$cache.win.off("mouseup.irs_"+this.plugin_count);p&&(this.$cache.body.off("mouseup.irs_"+this.plugin_count),this.$cache.body.off("mouseleave.irs_"+this.plugin_count));this.$cache.grid_labels=[];this.coords.big=[];this.coords.big_w=[];this.coords.big_p=[];this.coords.big_x=[];cancelAnimationFrame(this.raf_id)},bindEvents:function(){if(!this.no_diapason){this.$cache.body.on("touchmove.irs_"+this.plugin_count,this.pointerMove.bind(this));this.$cache.body.on("mousemove.irs_"+this.plugin_count, this.pointerMove.bind(this));this.$cache.win.on("touchend.irs_"+this.plugin_count,this.pointerUp.bind(this));this.$cache.win.on("mouseup.irs_"+this.plugin_count,this.pointerUp.bind(this));this.$cache.line.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"));this.$cache.line.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"));this.options.drag_interval&&"double"===this.options.type?(this.$cache.bar.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this, "both")),this.$cache.bar.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"both"))):(this.$cache.bar.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.bar.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")));"single"===this.options.type?(this.$cache.single.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.s_single.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")), this.$cache.shad_single.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.s_single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.edge.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_single.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"))):(this.$cache.single.on("touchstart.irs_"+ this.plugin_count,this.pointerDown.bind(this,null)),this.$cache.single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,null)),this.$cache.from.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.s_from.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.to.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.s_to.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")), this.$cache.shad_from.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_to.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.from.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.s_from.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.to.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.s_to.on("mousedown.irs_"+ this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.shad_from.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_to.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")));if(this.options.keyboard)this.$cache.line.on("keydown.irs_"+this.plugin_count,this.key.bind(this,"keyboard"));p&&(this.$cache.body.on("mouseup.irs_"+this.plugin_count,this.pointerUp.bind(this)),this.$cache.body.on("mouseleave.irs_"+this.plugin_count,this.pointerUp.bind(this)))}}, pointerMove:function(a){this.dragging&&(this.coords.x_pointer=(a.pageX||a.originalEvent.touches&&a.originalEvent.touches[0].pageX)-this.coords.x_gap,this.calc())},pointerUp:function(a){if(this.current_plugin===this.plugin_count&&this.is_active){this.is_active=!1;this.$cache.cont.find(".state_hover").removeClass("state_hover");this.force_redraw=!0;p&&f("*").prop("unselectable",!1);this.updateScene();this.restoreOriginalMinInterval();if(f.contains(this.$cache.cont[0],a.target)||this.dragging)this.is_finish= !0,this.callOnFinish();this.dragging=!1}},pointerDown:function(a,b){b.preventDefault();var d=b.pageX||b.originalEvent.touches&&b.originalEvent.touches[0].pageX;2!==b.button&&("both"===a&&this.setTempMinInterval(),a||(a=this.target),this.current_plugin=this.plugin_count,this.target=a,this.dragging=this.is_active=!0,this.coords.x_gap=this.$cache.rs.offset().left,this.coords.x_pointer=d-this.coords.x_gap,this.calcPointerPercent(),this.changeLevel(a),p&&f("*").prop("unselectable",!0),this.$cache.line.trigger("focus"), this.updateScene())},pointerClick:function(a,b){b.preventDefault();var d=b.pageX||b.originalEvent.touches&&b.originalEvent.touches[0].pageX;2!==b.button&&(this.current_plugin=this.plugin_count,this.target=a,this.is_click=!0,this.coords.x_gap=this.$cache.rs.offset().left,this.coords.x_pointer=+(d-this.coords.x_gap).toFixed(),this.force_redraw=!0,this.calc(),this.$cache.line.trigger("focus"))},key:function(a,b){if(!(this.current_plugin!==this.plugin_count||b.altKey||b.ctrlKey||b.shiftKey||b.metaKey)){switch(b.which){case 83:case 65:case 40:case 37:b.preventDefault(); this.moveByKey(!1);break;case 87:case 68:case 38:case 39:b.preventDefault(),this.moveByKey(!0)}return!0}},moveByKey:function(a){var b=this.coords.p_pointer,b=a?b+this.options.keyboard_step:b-this.options.keyboard_step;this.coords.x_pointer=this.toFixed(this.coords.w_rs/100*b);this.is_key=!0;this.calc()},setMinMax:function(){this.options&&(this.options.hide_min_max?(this.$cache.min[0].style.display="none",this.$cache.max[0].style.display="none"):(this.options.values.length?(this.$cache.min.html(this.decorate(this.options.p_values[this.options.min])), this.$cache.max.html(this.decorate(this.options.p_values[this.options.max]))):(this.$cache.min.html(this.decorate(this._prettify(this.options.min),this.options.min)),this.$cache.max.html(this.decorate(this._prettify(this.options.max),this.options.max))),this.labels.w_min=this.$cache.min.outerWidth(!1),this.labels.w_max=this.$cache.max.outerWidth(!1)))},setTempMinInterval:function(){var a=this.result.to-this.result.from;null===this.old_min_interval&&(this.old_min_interval=this.options.min_interval); this.options.min_interval=a},restoreOriginalMinInterval:function(){null!==this.old_min_interval&&(this.options.min_interval=this.old_min_interval,this.old_min_interval=null)},calc:function(a){if(this.options){this.calc_count++;if(10===this.calc_count||a)this.calc_count=0,this.coords.w_rs=this.$cache.rs.outerWidth(!1),this.calcHandlePercent();if(this.coords.w_rs){this.calcPointerPercent();a=this.getHandleX();"click"===this.target&&(this.coords.p_gap=this.coords.p_handle/2,a=this.getHandleX(),this.target= this.options.drag_interval?"both_one":this.chooseHandle(a));switch(this.target){case "base":var b=(this.options.max-this.options.min)/100;a=(this.result.from-this.options.min)/b;b=(this.result.to-this.options.min)/b;this.coords.p_single_real=this.toFixed(a);this.coords.p_from_real=this.toFixed(a);this.coords.p_to_real=this.toFixed(b);this.coords.p_single_real=this.checkDiapason(this.coords.p_single_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real, this.options.from_min,this.options.from_max);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_single_fake=this.convertToFakePercent(this.coords.p_single_real);this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);this.target=null;break;case "single":if(this.options.from_fixed)break;this.coords.p_single_real=this.convertToRealPercent(a);this.coords.p_single_real= this.calcWithStep(this.coords.p_single_real);this.coords.p_single_real=this.checkDiapason(this.coords.p_single_real,this.options.from_min,this.options.from_max);this.coords.p_single_fake=this.convertToFakePercent(this.coords.p_single_real);break;case "from":if(this.options.from_fixed)break;this.coords.p_from_real=this.convertToRealPercent(a);this.coords.p_from_real=this.calcWithStep(this.coords.p_from_real);this.coords.p_from_real>this.coords.p_to_real&&(this.coords.p_from_real=this.coords.p_to_real); this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkMinInterval(this.coords.p_from_real,this.coords.p_to_real,"from");this.coords.p_from_real=this.checkMaxInterval(this.coords.p_from_real,this.coords.p_to_real,"from");this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);break;case "to":if(this.options.to_fixed)break;this.coords.p_to_real=this.convertToRealPercent(a);this.coords.p_to_real= this.calcWithStep(this.coords.p_to_real);this.coords.p_to_real<this.coords.p_from_real&&(this.coords.p_to_real=this.coords.p_from_real);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_real=this.checkMinInterval(this.coords.p_to_real,this.coords.p_from_real,"to");this.coords.p_to_real=this.checkMaxInterval(this.coords.p_to_real,this.coords.p_from_real,"to");this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real); break;case "both":if(this.options.from_fixed||this.options.to_fixed)break;a=this.toFixed(a+.1*this.coords.p_handle);this.coords.p_from_real=this.convertToRealPercent(a)-this.coords.p_gap_left;this.coords.p_from_real=this.calcWithStep(this.coords.p_from_real);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkMinInterval(this.coords.p_from_real,this.coords.p_to_real,"from");this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real); this.coords.p_to_real=this.convertToRealPercent(a)+this.coords.p_gap_right;this.coords.p_to_real=this.calcWithStep(this.coords.p_to_real);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_real=this.checkMinInterval(this.coords.p_to_real,this.coords.p_from_real,"to");this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);break;case "both_one":if(this.options.from_fixed||this.options.to_fixed)break;var d=this.convertToRealPercent(a); a=this.result.to_percent-this.result.from_percent;var c=a/2,b=d-c,d=d+c;0>b&&(b=0,d=b+a);100<d&&(d=100,b=d-a);this.coords.p_from_real=this.calcWithStep(b);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);this.coords.p_to_real=this.calcWithStep(d);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_fake= this.convertToFakePercent(this.coords.p_to_real)}"single"===this.options.type?(this.coords.p_bar_x=this.coords.p_handle/2,this.coords.p_bar_w=this.coords.p_single_fake,this.result.from_percent=this.coords.p_single_real,this.result.from=this.convertToValue(this.coords.p_single_real),this.options.values.length&&(this.result.from_value=this.options.values[this.result.from])):(this.coords.p_bar_x=this.toFixed(this.coords.p_from_fake+this.coords.p_handle/2),this.coords.p_bar_w=this.toFixed(this.coords.p_to_fake- this.coords.p_from_fake),this.result.from_percent=this.coords.p_from_real,this.result.from=this.convertToValue(this.coords.p_from_real),this.result.to_percent=this.coords.p_to_real,this.result.to=this.convertToValue(this.coords.p_to_real),this.options.values.length&&(this.result.from_value=this.options.values[this.result.from],this.result.to_value=this.options.values[this.result.to]));this.calcMinMax();this.calcLabels()}}},calcPointerPercent:function(){this.coords.w_rs?(0>this.coords.x_pointer||isNaN(this.coords.x_pointer)? this.coords.x_pointer=0:this.coords.x_pointer>this.coords.w_rs&&(this.coords.x_pointer=this.coords.w_rs),this.coords.p_pointer=this.toFixed(this.coords.x_pointer/this.coords.w_rs*100)):this.coords.p_pointer=0},convertToRealPercent:function(a){return a/(100-this.coords.p_handle)*100},convertToFakePercent:function(a){return a/100*(100-this.coords.p_handle)},getHandleX:function(){var a=100-this.coords.p_handle,b=this.toFixed(this.coords.p_pointer-this.coords.p_gap);0>b?b=0:b>a&&(b=a);return b},calcHandlePercent:function(){this.coords.w_handle= "single"===this.options.type?this.$cache.s_single.outerWidth(!1):this.$cache.s_from.outerWidth(!1);this.coords.p_handle=this.toFixed(this.coords.w_handle/this.coords.w_rs*100)},chooseHandle:function(a){return"single"===this.options.type?"single":a>=this.coords.p_from_real+(this.coords.p_to_real-this.coords.p_from_real)/2?this.options.to_fixed?"from":"to":this.options.from_fixed?"to":"from"},calcMinMax:function(){this.coords.w_rs&&(this.labels.p_min=this.labels.w_min/this.coords.w_rs*100,this.labels.p_max= this.labels.w_max/this.coords.w_rs*100)},calcLabels:function(){this.coords.w_rs&&!this.options.hide_from_to&&("single"===this.options.type?(this.labels.w_single=this.$cache.single.outerWidth(!1),this.labels.p_single_fake=this.labels.w_single/this.coords.w_rs*100,this.labels.p_single_left=this.coords.p_single_fake+this.coords.p_handle/2-this.labels.p_single_fake/2):(this.labels.w_from=this.$cache.from.outerWidth(!1),this.labels.p_from_fake=this.labels.w_from/this.coords.w_rs*100,this.labels.p_from_left= this.coords.p_from_fake+this.coords.p_handle/2-this.labels.p_from_fake/2,this.labels.p_from_left=this.toFixed(this.labels.p_from_left),this.labels.p_from_left=this.checkEdges(this.labels.p_from_left,this.labels.p_from_fake),this.labels.w_to=this.$cache.to.outerWidth(!1),this.labels.p_to_fake=this.labels.w_to/this.coords.w_rs*100,this.labels.p_to_left=this.coords.p_to_fake+this.coords.p_handle/2-this.labels.p_to_fake/2,this.labels.p_to_left=this.toFixed(this.labels.p_to_left),this.labels.p_to_left= this.checkEdges(this.labels.p_to_left,this.labels.p_to_fake),this.labels.w_single=this.$cache.single.outerWidth(!1),this.labels.p_single_fake=this.labels.w_single/this.coords.w_rs*100,this.labels.p_single_left=(this.labels.p_from_left+this.labels.p_to_left+this.labels.p_to_fake)/2-this.labels.p_single_fake/2,this.labels.p_single_left=this.toFixed(this.labels.p_single_left)),this.labels.p_single_left=this.checkEdges(this.labels.p_single_left,this.labels.p_single_fake))},updateScene:function(){this.raf_id&& (cancelAnimationFrame(this.raf_id),this.raf_id=null);clearTimeout(this.update_tm);this.update_tm=null;this.options&&(this.drawHandles(),this.is_active?this.raf_id=requestAnimationFrame(this.updateScene.bind(this)):this.update_tm=setTimeout(this.updateScene.bind(this),300))},drawHandles:function(){this.coords.w_rs=this.$cache.rs.outerWidth(!1);if(this.coords.w_rs){this.coords.w_rs!==this.coords.w_rs_old&&(this.target="base",this.is_resize=!0);if(this.coords.w_rs!==this.coords.w_rs_old||this.force_redraw)this.setMinMax(), this.calc(!0),this.drawLabels(),this.options.grid&&(this.calcGridMargin(),this.calcGridLabels()),this.force_redraw=!0,this.coords.w_rs_old=this.coords.w_rs,this.drawShadow();if(this.coords.w_rs&&(this.dragging||this.force_redraw||this.is_key)){if(this.old_from!==this.result.from||this.old_to!==this.result.to||this.force_redraw||this.is_key){this.drawLabels();this.$cache.bar[0].style.left=this.coords.p_bar_x+"%";this.$cache.bar[0].style.width=this.coords.p_bar_w+"%";if("single"===this.options.type)this.$cache.s_single[0].style.left= this.coords.p_single_fake+"%",this.$cache.single[0].style.left=this.labels.p_single_left+"%",this.options.values.length?this.$cache.input.prop("value",this.result.from_value):this.$cache.input.prop("value",this.result.from),this.$cache.input.data("from",this.result.from);else{this.$cache.s_from[0].style.left=this.coords.p_from_fake+"%";this.$cache.s_to[0].style.left=this.coords.p_to_fake+"%";if(this.old_from!==this.result.from||this.force_redraw)this.$cache.from[0].style.left=this.labels.p_from_left+ "%";if(this.old_to!==this.result.to||this.force_redraw)this.$cache.to[0].style.left=this.labels.p_to_left+"%";this.$cache.single[0].style.left=this.labels.p_single_left+"%";this.options.values.length?this.$cache.input.prop("value",this.result.from_value+this.options.input_values_separator+this.result.to_value):this.$cache.input.prop("value",this.result.from+this.options.input_values_separator+this.result.to);this.$cache.input.data("from",this.result.from);this.$cache.input.data("to",this.result.to)}this.old_from=== this.result.from&&this.old_to===this.result.to||this.is_start||this.$cache.input.trigger("change");this.old_from=this.result.from;this.old_to=this.result.to;this.is_resize||this.is_update||this.is_start||this.is_finish||this.callOnChange();if(this.is_key||this.is_click)this.is_click=this.is_key=!1,this.callOnFinish();this.is_finish=this.is_resize=this.is_update=!1}this.force_redraw=this.is_click=this.is_key=this.is_start=!1}}},drawLabels:function(){if(this.options){var a=this.options.values.length, b=this.options.p_values,d;if(!this.options.hide_from_to)if("single"===this.options.type)a=a?this.decorate(b[this.result.from]):this.decorate(this._prettify(this.result.from),this.result.from),this.$cache.single.html(a),this.calcLabels(),this.$cache.min[0].style.visibility=this.labels.p_single_left<this.labels.p_min+1?"hidden":"visible",this.$cache.max[0].style.visibility=this.labels.p_single_left+this.labels.p_single_fake>100-this.labels.p_max-1?"hidden":"visible";else{a?(this.options.decorate_both? (a=this.decorate(b[this.result.from]),a+=this.options.values_separator,a+=this.decorate(b[this.result.to])):a=this.decorate(b[this.result.from]+this.options.values_separator+b[this.result.to]),d=this.decorate(b[this.result.from]),b=this.decorate(b[this.result.to])):(this.options.decorate_both?(a=this.decorate(this._prettify(this.result.from),this.result.from),a+=this.options.values_separator,a+=this.decorate(this._prettify(this.result.to),this.result.to)):a=this.decorate(this._prettify(this.result.from)+ this.options.values_separator+this._prettify(this.result.to),this.result.to),d=this.decorate(this._prettify(this.result.from),this.result.from),b=this.decorate(this._prettify(this.result.to),this.result.to));this.$cache.single.html(a);this.$cache.from.html(d);this.$cache.to.html(b);this.calcLabels();b=Math.min(this.labels.p_single_left,this.labels.p_from_left);a=this.labels.p_single_left+this.labels.p_single_fake;d=this.labels.p_to_left+this.labels.p_to_fake;var c=Math.max(a,d);this.labels.p_from_left+ this.labels.p_from_fake>=this.labels.p_to_left?(this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden",this.$cache.single[0].style.visibility="visible",this.result.from===this.result.to?("from"===this.target?this.$cache.from[0].style.visibility="visible":"to"===this.target&&(this.$cache.to[0].style.visibility="visible"),this.$cache.single[0].style.visibility="hidden",c=d):(this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden", this.$cache.single[0].style.visibility="visible",c=Math.max(a,d))):(this.$cache.from[0].style.visibility="visible",this.$cache.to[0].style.visibility="visible",this.$cache.single[0].style.visibility="hidden");this.$cache.min[0].style.visibility=b<this.labels.p_min+1?"hidden":"visible";this.$cache.max[0].style.visibility=c>100-this.labels.p_max-1?"hidden":"visible"}}},drawShadow:function(){var a=this.options,b=this.$cache,d="number"===typeof a.from_min&&!isNaN(a.from_min),c="number"===typeof a.from_max&& !isNaN(a.from_max),e="number"===typeof a.to_min&&!isNaN(a.to_min),g="number"===typeof a.to_max&&!isNaN(a.to_max);"single"===a.type?a.from_shadow&&(d||c)?(d=this.convertToPercent(d?a.from_min:a.min),c=this.convertToPercent(c?a.from_max:a.max)-d,d=this.toFixed(d-this.coords.p_handle/100*d),c=this.toFixed(c-this.coords.p_handle/100*c),d+=this.coords.p_handle/2,b.shad_single[0].style.display="block",b.shad_single[0].style.left=d+"%",b.shad_single[0].style.width=c+"%"):b.shad_single[0].style.display="none": (a.from_shadow&&(d||c)?(d=this.convertToPercent(d?a.from_min:a.min),c=this.convertToPercent(c?a.from_max:a.max)-d,d=this.toFixed(d-this.coords.p_handle/100*d),c=this.toFixed(c-this.coords.p_handle/100*c),d+=this.coords.p_handle/2,b.shad_from[0].style.display="block",b.shad_from[0].style.left=d+"%",b.shad_from[0].style.width=c+"%"):b.shad_from[0].style.display="none",a.to_shadow&&(e||g)?(e=this.convertToPercent(e?a.to_min:a.min),a=this.convertToPercent(g?a.to_max:a.max)-e,e=this.toFixed(e-this.coords.p_handle/ 100*e),a=this.toFixed(a-this.coords.p_handle/100*a),e+=this.coords.p_handle/2,b.shad_to[0].style.display="block",b.shad_to[0].style.left=e+"%",b.shad_to[0].style.width=a+"%"):b.shad_to[0].style.display="none")},callOnStart:function(){if(this.options.onStart&&"function"===typeof this.options.onStart)this.options.onStart(this.result)},callOnChange:function(){if(this.options.onChange&&"function"===typeof this.options.onChange)this.options.onChange(this.result)},callOnFinish:function(){if(this.options.onFinish&& "function"===typeof this.options.onFinish)this.options.onFinish(this.result)},callOnUpdate:function(){if(this.options.onUpdate&&"function"===typeof this.options.onUpdate)this.options.onUpdate(this.result)},toggleInput:function(){this.$cache.input.toggleClass("irs-hidden-input")},convertToPercent:function(a,b){var d=this.options.max-this.options.min;return d?this.toFixed((b?a:a-this.options.min)/(d/100)):(this.no_diapason=!0,0)},convertToValue:function(a){var b=this.options.min,d=this.options.max, c=b.toString().split(".")[1],e=d.toString().split(".")[1],g,l,k=0,f=0;if(0===a)return this.options.min;if(100===a)return this.options.max;c&&(k=g=c.length);e&&(k=l=e.length);g&&l&&(k=g>=l?g:l);0>b&&(f=Math.abs(b),b=+(b+f).toFixed(k),d=+(d+f).toFixed(k));a=(d-b)/100*a+b;(b=this.options.step.toString().split(".")[1])?a=+a.toFixed(b.length):(a/=this.options.step,a*=this.options.step,a=+a.toFixed(0));f&&(a-=f);f=b?+a.toFixed(b.length):this.toFixed(a);f<this.options.min?f=this.options.min:f>this.options.max&& (f=this.options.max);return f},calcWithStep:function(a){var b=Math.round(a/this.coords.p_step)*this.coords.p_step;100<b&&(b=100);100===a&&(b=100);return this.toFixed(b)},checkMinInterval:function(a,b,d){var c=this.options;if(!c.min_interval)return a;a=this.convertToValue(a);b=this.convertToValue(b);"from"===d?b-a<c.min_interval&&(a=b-c.min_interval):a-b<c.min_interval&&(a=b+c.min_interval);return this.convertToPercent(a)},checkMaxInterval:function(a,b,d){var c=this.options;if(!c.max_interval)return a; a=this.convertToValue(a);b=this.convertToValue(b);"from"===d?b-a>c.max_interval&&(a=b-c.max_interval):a-b>c.max_interval&&(a=b+c.max_interval);return this.convertToPercent(a)},checkDiapason:function(a,b,d){a=this.convertToValue(a);var c=this.options;"number"!==typeof b&&(b=c.min);"number"!==typeof d&&(d=c.max);a<b&&(a=b);a>d&&(a=d);return this.convertToPercent(a)},toFixed:function(a){a=a.toFixed(9);return+a},_prettify:function(a){return this.options.prettify_enabled?this.options.prettify&&"function"=== typeof this.options.prettify?this.options.prettify(a):this.prettify(a):a},prettify:function(a){return a.toString().replace(/(\d{1,3}(?=(?:\d\d\d)+(?!\d)))/g,"$1"+this.options.prettify_separator)},checkEdges:function(a,b){if(!this.options.force_edges)return this.toFixed(a);0>a?a=0:a>100-b&&(a=100-b);return this.toFixed(a)},validate:function(){var a=this.options,b=this.result,d=a.values,c=d.length,e,g;"string"===typeof a.min&&(a.min=+a.min);"string"===typeof a.max&&(a.max=+a.max);"string"===typeof a.from&& (a.from=+a.from);"string"===typeof a.to&&(a.to=+a.to);"string"===typeof a.step&&(a.step=+a.step);"string"===typeof a.from_min&&(a.from_min=+a.from_min);"string"===typeof a.from_max&&(a.from_max=+a.from_max);"string"===typeof a.to_min&&(a.to_min=+a.to_min);"string"===typeof a.to_max&&(a.to_max=+a.to_max);"string"===typeof a.keyboard_step&&(a.keyboard_step=+a.keyboard_step);"string"===typeof a.grid_num&&(a.grid_num=+a.grid_num);a.max<a.min&&(a.max=a.min);if(c)for(a.p_values=[],a.min=0,a.max=c-1,a.step= 1,a.grid_num=a.max,a.grid_snap=!0,g=0;g<c;g++)e=+d[g],isNaN(e)?e=d[g]:(d[g]=e,e=this._prettify(e)),a.p_values.push(e);if("number"!==typeof a.from||isNaN(a.from))a.from=a.min;if("number"!==typeof a.to||isNaN(a.from))a.to=a.max;if("single"===a.type)a.from<a.min&&(a.from=a.min),a.from>a.max&&(a.from=a.max);else{if(a.from<a.min||a.from>a.max)a.from=a.min;if(a.to>a.max||a.to<a.min)a.to=a.max;a.from>a.to&&(a.from=a.to)}if("number"!==typeof a.step||isNaN(a.step)||!a.step||0>a.step)a.step=1;if("number"!== typeof a.keyboard_step||isNaN(a.keyboard_step)||!a.keyboard_step||0>a.keyboard_step)a.keyboard_step=5;"number"===typeof a.from_min&&a.from<a.from_min&&(a.from=a.from_min);"number"===typeof a.from_max&&a.from>a.from_max&&(a.from=a.from_max);"number"===typeof a.to_min&&a.to<a.to_min&&(a.to=a.to_min);"number"===typeof a.to_max&&a.from>a.to_max&&(a.to=a.to_max);if(b){b.min!==a.min&&(b.min=a.min);b.max!==a.max&&(b.max=a.max);if(b.from<b.min||b.from>b.max)b.from=a.from;if(b.to<b.min||b.to>b.max)b.to=a.to}if("number"!== typeof a.min_interval||isNaN(a.min_interval)||!a.min_interval||0>a.min_interval)a.min_interval=0;if("number"!==typeof a.max_interval||isNaN(a.max_interval)||!a.max_interval||0>a.max_interval)a.max_interval=0;a.min_interval&&a.min_interval>a.max-a.min&&(a.min_interval=a.max-a.min);a.max_interval&&a.max_interval>a.max-a.min&&(a.max_interval=a.max-a.min)},decorate:function(a,b){var d="",c=this.options;c.prefix&&(d+=c.prefix);d+=a;c.max_postfix&&(c.values.length&&a===c.p_values[c.max]?(d+=c.max_postfix, c.postfix&&(d+=" ")):b===c.max&&(d+=c.max_postfix,c.postfix&&(d+=" ")));c.postfix&&(d+=c.postfix);return d},updateFrom:function(){this.result.from=this.options.from;this.result.from_percent=this.convertToPercent(this.result.from);this.options.values&&(this.result.from_value=this.options.values[this.result.from])},updateTo:function(){this.result.to=this.options.to;this.result.to_percent=this.convertToPercent(this.result.to);this.options.values&&(this.result.to_value=this.options.values[this.result.to])}, updateResult:function(){this.result.min=this.options.min;this.result.max=this.options.max;this.updateFrom();this.updateTo()},appendGrid:function(){if(this.options.grid){var a=this.options,b,d;b=a.max-a.min;var c=a.grid_num,e=0,g=0,f=4,k,h,m=0,n="";this.calcGridMargin();a.grid_snap?(c=b/a.step,e=this.toFixed(a.step/(b/100))):e=this.toFixed(100/c);4<c&&(f=3);7<c&&(f=2);14<c&&(f=1);28<c&&(f=0);for(b=0;b<c+1;b++){k=f;g=this.toFixed(e*b);100<g&&(g=100,k-=2,0>k&&(k=0));this.coords.big[b]=g;h=(g-e*(b-1))/ (k+1);for(d=1;d<=k&&0!==g;d++)m=this.toFixed(g-h*d),n+='<span class="irs-grid-pol small" style="left: '+m+'%"></span>';n+='<span class="irs-grid-pol" style="left: '+g+'%"></span>';m=this.convertToValue(g);m=a.values.length?a.p_values[m]:this._prettify(m);n+='<span class="irs-grid-text js-grid-text-'+b+'" style="left: '+g+'%">'+m+"</span>"}this.coords.big_num=Math.ceil(c+1);this.$cache.cont.addClass("irs-with-grid");this.$cache.grid.html(n);this.cacheGridLabels()}},cacheGridLabels:function(){var a, b,d=this.coords.big_num;for(b=0;b<d;b++)a=this.$cache.grid.find(".js-grid-text-"+b),this.$cache.grid_labels.push(a);this.calcGridLabels()},calcGridLabels:function(){var a,b;b=[];var d=[],c=this.coords.big_num;for(a=0;a<c;a++)this.coords.big_w[a]=this.$cache.grid_labels[a].outerWidth(!1),this.coords.big_p[a]=this.toFixed(this.coords.big_w[a]/this.coords.w_rs*100),this.coords.big_x[a]=this.toFixed(this.coords.big_p[a]/2),b[a]=this.toFixed(this.coords.big[a]-this.coords.big_x[a]),d[a]=this.toFixed(b[a]+ this.coords.big_p[a]);this.options.force_edges&&(b[0]<-this.coords.grid_gap&&(b[0]=-this.coords.grid_gap,d[0]=this.toFixed(b[0]+this.coords.big_p[0]),this.coords.big_x[0]=this.coords.grid_gap),d[c-1]>100+this.coords.grid_gap&&(d[c-1]=100+this.coords.grid_gap,b[c-1]=this.toFixed(d[c-1]-this.coords.big_p[c-1]),this.coords.big_x[c-1]=this.toFixed(this.coords.big_p[c-1]-this.coords.grid_gap)));this.calcGridCollision(2,b,d);this.calcGridCollision(4,b,d);for(a=0;a<c;a++)b=this.$cache.grid_labels[a][0], b.style.marginLeft=-this.coords.big_x[a]+"%"},calcGridCollision:function(a,b,d){var c,e,g,f=this.coords.big_num;for(c=0;c<f;c+=a){e=c+a/2;if(e>=f)break;g=this.$cache.grid_labels[e][0];g.style.visibility=d[c]<=b[e]?"visible":"hidden"}},calcGridMargin:function(){this.options.grid_margin&&(this.coords.w_rs=this.$cache.rs.outerWidth(!1),this.coords.w_rs&&(this.coords.w_handle="single"===this.options.type?this.$cache.s_single.outerWidth(!1):this.$cache.s_from.outerWidth(!1),this.coords.p_handle=this.toFixed(this.coords.w_handle/ this.coords.w_rs*100),this.coords.grid_gap=this.toFixed(this.coords.p_handle/2-.1),this.$cache.grid[0].style.width=this.toFixed(100-this.coords.p_handle)+"%",this.$cache.grid[0].style.left=this.coords.grid_gap+"%"))},update:function(a){this.input&&(this.is_update=!0,this.options.from=this.result.from,this.options.to=this.result.to,this.options=f.extend(this.options,a),this.validate(),this.updateResult(a),this.toggleInput(),this.remove(),this.init(!0))},reset:function(){this.input&&(this.updateResult(), this.update())},destroy:function(){this.input&&(this.toggleInput(),this.$cache.input.prop("readonly",!1),f.data(this.input,"ionRangeSlider",null),this.remove(),this.options=this.input=null)}};f.fn.ionRangeSlider=function(a){return this.each(function(){f.data(this,"ionRangeSlider")||f.data(this,"ionRangeSlider",new q(this,a,u++))})};(function(){for(var a=0,b=["ms","moz","webkit","o"],d=0;d<b.length&&!h.requestAnimationFrame;++d)h.requestAnimationFrame=h[b[d]+"RequestAnimationFrame"],h.cancelAnimationFrame= h[b[d]+"CancelAnimationFrame"]||h[b[d]+"CancelRequestAnimationFrame"];h.requestAnimationFrame||(h.requestAnimationFrame=function(b,d){var g=(new Date).getTime(),f=Math.max(0,16-(g-a)),k=h.setTimeout(function(){b(g+f)},f);a=g+f;return k});h.cancelAnimationFrame||(h.cancelAnimationFrame=function(a){clearTimeout(a)})})()})(jQuery,document,window,navigator);
2894638479/fabric-blue-archive-halo
482
readme.md
纯客户端模组,同时修复了信标光束会重复渲染的bug。 # forge版本仓库 [forge-blue-archive-halo](https://github.com/2894638479/forge-blue-archive-halo) 由于多分支维护比architectury框架更方便,上述仓库已经废弃。forge在本仓库中单独的分支中进行适配。 neoforge由于使用yarn mapping时无法正确处理mixin,适配受阻。 # 光影适配 兼容大部分光影。可以调节透明度达到合适的显示效果。如果某光影无法出现渐变效果,是光影自身问题。 # 显示规则: ### 等级 光环样式会随信标等级变化,可以使用彩色玻璃染色。等级不一定等于光环数。 ### 等级衰减 光环大小和圈数会随信标等阶增加,为控制实际显示圈数,等级会减去信标往上连续的 **无色透明玻璃/板** 个数。 ### 染色 从前述的最后一个透明玻璃往上,每格 **信标光柱的颜色** ,依次从外环到内环染色。 不使用玻璃本身的颜色而是光柱的颜色,是为了防止颜色变化过于突兀。
2881099/FreeScheduler
2,083
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/ionslider/ion.rangeSlider.skinNice.css
/* Ion.RangeSlider, Nice Skin // css version 2.0.3 // © Denis Ineshin, 2014 https://github.com/IonDen // ===================================================================================================================*/ /* ===================================================================================================================== // Skin details */ .irs-line-mid, .irs-line-left, .irs-line-right, .irs-bar, .irs-bar-edge, .irs-slider { background: url(img/sprite-skin-nice.png) repeat-x; } .irs { height: 40px; } .irs-with-grid { height: 60px; } .irs-line { height: 8px; top: 25px; } .irs-line-left { height: 8px; background-position: 0 -30px; } .irs-line-mid { height: 8px; background-position: 0 0; } .irs-line-right { height: 8px; background-position: 100% -30px; } .irs-bar { height: 8px; top: 25px; background-position: 0 -60px; } .irs-bar-edge { top: 25px; height: 8px; width: 11px; background-position: 0 -90px; } .irs-shadow { height: 1px; top: 34px; background: #000; opacity: 0.15; } .lt-ie9 .irs-shadow { filter: alpha(opacity=15); } .irs-slider { width: 22px; height: 22px; top: 17px; background-position: 0 -120px; } .irs-slider.state_hover, .irs-slider:hover { background-position: 0 -150px; } .irs-min, .irs-max { color: #999; font-size: 10px; line-height: 1.333; text-shadow: none; top: 0; padding: 1px 3px; background: rgba(0,0,0,0.1); -moz-border-radius: 3px; border-radius: 3px; } .lt-ie9 .irs-min, .lt-ie9 .irs-max { background: #ccc; } .irs-from, .irs-to, .irs-single { color: #fff; font-size: 10px; line-height: 1.333; text-shadow: none; padding: 1px 5px; background: rgba(0,0,0,0.3); -moz-border-radius: 3px; border-radius: 3px; } .lt-ie9 .irs-from, .lt-ie9 .irs-to, .lt-ie9 .irs-single { background: #999; } .irs-grid-pol { background: #99a4ac; } .irs-grid-text { color: #99a4ac; } .irs-disabled { }
2891954521/LiteLoaderQQNT-OneBotApi-JS
3,372
doc/message.md
# 聊天消息 ### 支持的消息类型 | 消息类型 | 接收 | 发送 | 备注 | |---------|:--:|:--:|-----------------------| | 文字 | ✔ | ✔ | | | QQ表情 | ✔ | ✔ | | | 图片 | ✔ | ✔ | 发送目前仅支持本地图片 | | 语音 | | | 短视频 | | | at | ✔ | ✔ | | | 猜拳魔法表情 | | | 掷骰子魔法表情 | | | 窗口抖动 | | | 戳一戳 | ❌ | ❌ | QQNT并没有戳一戳功能,所以该功能不支持 | | 链接分享 | | | 推荐好友 | | | 推荐群 | | | 回复 | ✔ | ✔ | 只能回复Bot框架启动后收到的消息 | | 合并转发 | ✔ | | JSON 消息 | ✔ | ✔ | | | XML 消息 | | ### 消息上报结构 #### 好友消息 ```json lines { "time": 1711698307, "message_id": "7351688249283856975", "self_id": "123456", "post_type": "message", "user_id": "123456", "font": 0, "message": [ { "type": "text", "data": { "text": "hello" } } ], "raw_message": "hello", "message_type": "private", "sub_type": "friend", "sender": { "user_id": "123456", "nickname": "", "sex": "unknown", "age": 0 } } ``` #### 群消息 ```json lines { "time": 1711698530, "message_id": "7351689208262640341", "self_id": "123456", "post_type": "message", "user_id": "123456", "font": 0, "message": [ { "type": "image", "data": { "file": "file:///C:\\xxxx\\123456.jpg", "url": "https://xxxxxxx", "md5": "6BC2CAB569525B992398376BA7B3D8D4" } } ], "raw_message": "[CQ:image,md5=6BC2CAB569525B992398376BA7B3D8D4]", "group_id": "123456", "message_type": "group", "sub_type": "group", "sender": { "user_id": "123456", "nickname": "", "card": "", "sex": "unknown", "age": 0, "area": "", "level": "0", "role": "", "title": "" } } ``` #### 频道消息 **注意:只有QQ打开某一具体频道的聊天界面才能接受到频道消息** ```json lines { "time": 1711698669, "message_id": "7351689810098904374", "self_id": "123456", "post_type": "message", "font": 0, "message": [ { "type": "text", "data": { "text": "hello" } } ], "raw_message": "hello", "guild_id": "123456", "channel_id": "123456", "tiny_id": "123456", "message_type": "guild", "sub_type": "message" } ``` ## 消息结构 ### 纯文本 ```json lines { "type": "text", "data": { "text": "纯文本内容" } } ``` ### QQ 表情 ```json lines { "type": "face", "data": { "id": "123" // string int 均可 } } ``` ### 图片 ```json lines { "type": "image", "data": { "file": "path", // 图片文件本地路径 "url": "https://xxx", // 图片URL "md5": "3F7D797BE1AF0A" // 图片md5 (大写) } } ``` ### at ```json lines { "type": "at", "data": { "qq": "123456" // at全体成员时是 "all" } } ``` ### 回复 ```json lines { "type": "reply", "data": { "id": "123456" // 回复的消息的msgId } } ``` ### 转发消息 ```json lines { "type": "forward", "data": { "id": "123456" // 消息的msgId } } ``` ### Json消息 ```json lines { "type": "json", "data": { "data": "{\"app\":\"com.tencent.miniapp_01\" ... }" // Json消息内容(字符串) } } ```
2881099/FreeScheduler
2,202
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/ionslider/ion.rangeSlider.skinFlat.css
/* Ion.RangeSlider, Flat UI Skin // css version 2.0.3 // © Denis Ineshin, 2014 https://github.com/IonDen // ===================================================================================================================*/ /* ===================================================================================================================== // Skin details */ .irs-line-mid, .irs-line-left, .irs-line-right, .irs-bar, .irs-bar-edge, .irs-slider { background: url(img/sprite-skin-flat.png) repeat-x; } .irs { height: 40px; } .irs-with-grid { height: 60px; } .irs-line { height: 12px; top: 25px; } .irs-line-left { height: 12px; background-position: 0 -30px; } .irs-line-mid { height: 12px; background-position: 0 0; } .irs-line-right { height: 12px; background-position: 100% -30px; } .irs-bar { height: 12px; top: 25px; background-position: 0 -60px; } .irs-bar-edge { top: 25px; height: 12px; width: 9px; background-position: 0 -90px; } .irs-shadow { height: 3px; top: 34px; background: #000; opacity: 0.25; } .lt-ie9 .irs-shadow { filter: alpha(opacity=25); } .irs-slider { width: 16px; height: 18px; top: 22px; background-position: 0 -120px; } .irs-slider.state_hover, .irs-slider:hover { background-position: 0 -150px; } .irs-min, .irs-max { color: #999; font-size: 10px; line-height: 1.333; text-shadow: none; top: 0; padding: 1px 3px; background: #e1e4e9; -moz-border-radius: 4px; border-radius: 4px; } .irs-from, .irs-to, .irs-single { color: #fff; font-size: 10px; line-height: 1.333; text-shadow: none; padding: 1px 5px; background: #ed5565; -moz-border-radius: 4px; border-radius: 4px; } .irs-from:after, .irs-to:after, .irs-single:after { position: absolute; display: block; content: ""; bottom: -6px; left: 50%; width: 0; height: 0; margin-left: -3px; overflow: hidden; border: 3px solid transparent; border-top-color: #ed5565; } .irs-grid-pol { background: #e1e4e9; } .irs-grid-text { color: #999; } .irs-disabled { }
2891954521/LiteLoaderQQNT-OneBotApi-JS
3,966
src/logger.js
// const fs = require('fs'); // const path = require("path"); // const WebSocket = require('./lib/websocket'); class Log { static isDebug = false; static isDebugIPC = false; static logPath = './'; static fileStream = null; static ws = null; /** @type IPCDebugger */ static ipcDebugger = null; static setDebug(debug, isDebugIPC, logPath = null){ this.isDebug = debug; this.isDebugIPC = isDebugIPC; if(logPath != null) this.logPath = logPath; if(this.isDebugIPC) this.ipcDebugger = new IPCDebugger(); if(this.fileStream) this.fileStream.end(); if(debug){ // try{ // this.ws = new WebSocket("ws://127.0.0.1:12345", { headers: { 'X-Self-ID': 0, 'X-Client-Role': "" }}); // this.ws.on('open', () => { this.isOpen = true }); // this.ws.on('close', (code) => { this.isOpen = false }); // }catch(e){ } // let d = new Date(); // let logFile = path.join(this.logPath, `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()} ${d.getHours()}-${d.getMinutes()}-${d.getSeconds()}.log`); // this.fileStream = null // this.fileStream = fs.createWriteStream(logFile); // Log.i(`debug mode is on, debug log to ${logFile}`) } } static d(...args){ if(this.isDebug){ console.log("\x1b[36m[OneBotAPI-Debug]\x1b[0m", ...args); const data = args.join('') if(this.ws) this.ws.send("\x1b[36m[Debug]\x1b[0m" + data + '\n'); this.fileStream?.write("[Debug]" + data + '\n'); } } static i(...args){ console.log("\x1b[32m[OneBotAPI-Info]\x1b[0m", ...args); if(this.isDebug){ const data = args.join('') if(this.ws) this.ws.send("\x1b[32m[Info]\x1b[0m" + data + '\n'); this.fileStream?.write("[Info]" + data + '\n'); } } static w(...args){ console.log("\x1b[33m[OneBotAPI-Warn]\x1b[0m", ...args); if(this.isDebug){ const data = args.join('') if(this.ws) this.ws.send("\x1b[33m[Warn]\x1b[0m" + data + '\n'); this.fileStream?.write("[Warn]" + data + '\n'); } } static e(...args){ console.log("\x1b[31m[OneBotAPI-Error]\x1b[0m", ...args); if(this.isDebug){ const data = args.join('') if(this.ws) this.ws.send("\x1b[31m[Error]\x1b[0m" + data + '\n'); this.fileStream?.write("[Error]" + data + '\n'); } } } class IPCDebugger { debugIPC = {}; blackList = [ "nodeIKernelMsgListener/onAddSendMsg", "nodeIKernelMsgListener/onMsgInfoListUpdate", // "nodeIKernelProfileListener/onProfileDetailInfoChanged", "nodeIKernelRecentContactListener/onRecentContactListChangedVer2", ] constructor(){ } IPCSend(_, status, name, ...args) { if(name === '___!log') return; let eventName = args?.[0]?.[0]?.eventName; if(eventName?.startsWith("ns-LoggerApi")) return; let callbackId = args?.[0]?.[0]?.callbackId; if(callbackId){ // if(str.length > 100) str = str.slice(0, 45) + ' ... ' + str.slice(str.length - 45); this.debugIPC[callbackId] = args[0]; // Log.d(`[IPC Call ${callbackId}] -> ${JSON.stringify(args)}`); }else{ Log.d(`[IPC Call] -> ${JSON.stringify(args)}`); } } IPCReceive(channel, ...args){ if(args?.[0]?.eventName?.startsWith("ns-LoggerApi")) return; let callbackId = args?.[0]?.callbackId; if(callbackId){ if(this.debugIPC[callbackId]){ if(args?.[1]){ let str = JSON.stringify(args?.[1]); // if(str.length > 100) str = str.slice(0, 45) + ' ... ' + str.slice(str.length - 45); let ipc = this.debugIPC[callbackId] Log.d(`\x1b[36m[IPC Func]\x1b[0m ${ipc[1][0]}: ${JSON.stringify(ipc[1][1])} \x1b[36m=>\x1b[0m ${str}`); } delete this.debugIPC[callbackId]; }else{ if(args?.[1]){ let str = JSON.stringify(args?.[1]); Log.d(`[IPC Resp ${callbackId}] <- ${str}`); } } }else{ let cmdName = args?.[1]?.[0]?.cmdName; if(cmdName){ if(cmdName.includes("onBuddyListChange")) return; else if(cmdName in this.blackList) return; Log.d(`[IPC Resp] <- ${cmdName}: ${JSON.stringify(args[1][0]?.["payload"])}`); } } } } module.exports = { Log, }
2881099/FreeScheduler
18,278
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/colorpicker/bootstrap-colorpicker.min.js
!function(a){"use strict";"object"==typeof exports?module.exports=a(window.jQuery):"function"==typeof define&&define.amd?define(["jquery"],a):window.jQuery&&!window.jQuery.fn.colorpicker&&a(window.jQuery)}(function(a){"use strict";var b=function(b,c){this.value={h:0,s:0,b:0,a:1},this.origFormat=null,c&&a.extend(this.colors,c),b&&(void 0!==b.toLowerCase?(b+="",this.setColor(b)):void 0!==b.h&&(this.value=b))};b.prototype={constructor:b,colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32",transparent:"transparent"},_sanitizeNumber:function(a){return"number"==typeof a?a:isNaN(a)||null===a||""===a||void 0===a?1:void 0!==a.toLowerCase?parseFloat(a):1},isTransparent:function(a){return a?(a=a.toLowerCase().trim(),"transparent"===a||a.match(/#?00000000/)||a.match(/(rgba|hsla)\(0,0,0,0?\.?0\)/)):!1},rgbaIsTransparent:function(a){return 0===a.r&&0===a.g&&0===a.b&&0===a.a},setColor:function(a){a=a.toLowerCase().trim(),a&&(this.isTransparent(a)?this.value={h:0,s:0,b:0,a:0}:this.value=this.stringToHSB(a)||{h:0,s:0,b:0,a:1})},stringToHSB:function(b){b=b.toLowerCase();var c;"undefined"!=typeof this.colors[b]&&(b=this.colors[b],c="alias");var d=this,e=!1;return a.each(this.stringParsers,function(a,f){var g=f.re.exec(b),h=g&&f.parse.apply(d,[g]),i=c||f.format||"rgba";return h?(e=i.match(/hsla?/)?d.RGBtoHSB.apply(d,d.HSLtoRGB.apply(d,h)):d.RGBtoHSB.apply(d,h),d.origFormat=i,!1):!0}),e},setHue:function(a){this.value.h=1-a},setSaturation:function(a){this.value.s=a},setBrightness:function(a){this.value.b=1-a},setAlpha:function(a){this.value.a=parseInt(100*(1-a),10)/100},toRGB:function(a,b,c,d){a||(a=this.value.h,b=this.value.s,c=this.value.b),a*=360;var e,f,g,h,i;return a=a%360/60,i=c*b,h=i*(1-Math.abs(a%2-1)),e=f=g=c-i,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a],{r:Math.round(255*e),g:Math.round(255*f),b:Math.round(255*g),a:d||this.value.a}},toHex:function(a,b,c,d){var e=this.toRGB(a,b,c,d);return this.rgbaIsTransparent(e)?"transparent":"#"+(1<<24|parseInt(e.r)<<16|parseInt(e.g)<<8|parseInt(e.b)).toString(16).substr(1)},toHSL:function(a,b,c,d){a=a||this.value.h,b=b||this.value.s,c=c||this.value.b,d=d||this.value.a;var e=a,f=(2-b)*c,g=b*c;return g/=f>0&&1>=f?f:2-f,f/=2,g>1&&(g=1),{h:isNaN(e)?0:e,s:isNaN(g)?0:g,l:isNaN(f)?0:f,a:isNaN(d)?0:d}},toAlias:function(a,b,c,d){var e=this.toHex(a,b,c,d);for(var f in this.colors)if(this.colors[f]===e)return f;return!1},RGBtoHSB:function(a,b,c,d){a/=255,b/=255,c/=255;var e,f,g,h;return g=Math.max(a,b,c),h=g-Math.min(a,b,c),e=0===h?null:g===a?(b-c)/h:g===b?(c-a)/h+2:(a-b)/h+4,e=(e+360)%6*60/360,f=0===h?0:h/g,{h:this._sanitizeNumber(e),s:f,b:g,a:this._sanitizeNumber(d)}},HueToRGB:function(a,b,c){return 0>c?c+=1:c>1&&(c-=1),1>6*c?a+(b-a)*c*6:1>2*c?b:2>3*c?a+(b-a)*(2/3-c)*6:a},HSLtoRGB:function(a,b,c,d){0>b&&(b=0);var e;e=.5>=c?c*(1+b):c+b-c*b;var f=2*c-e,g=a+1/3,h=a,i=a-1/3,j=Math.round(255*this.HueToRGB(f,e,g)),k=Math.round(255*this.HueToRGB(f,e,h)),l=Math.round(255*this.HueToRGB(f,e,i));return[j,k,l,this._sanitizeNumber(d)]},toString:function(a){a=a||"rgba";var b=!1;switch(a){case"rgb":return b=this.toRGB(),this.rgbaIsTransparent(b)?"transparent":"rgb("+b.r+","+b.g+","+b.b+")";case"rgba":return b=this.toRGB(),"rgba("+b.r+","+b.g+","+b.b+","+b.a+")";case"hsl":return b=this.toHSL(),"hsl("+Math.round(360*b.h)+","+Math.round(100*b.s)+"%,"+Math.round(100*b.l)+"%)";case"hsla":return b=this.toHSL(),"hsla("+Math.round(360*b.h)+","+Math.round(100*b.s)+"%,"+Math.round(100*b.l)+"%,"+b.a+")";case"hex":return this.toHex();case"alias":return this.toAlias()||this.toHex();default:return b}},stringParsers:[{re:/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*?\)/,format:"rgb",parse:function(a){return[a[1],a[2],a[3],1]}},{re:/rgb\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*?\)/,format:"rgb",parse:function(a){return[2.55*a[1],2.55*a[2],2.55*a[3],1]}},{re:/rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,format:"rgba",parse:function(a){return[a[1],a[2],a[3],a[4]]}},{re:/rgba\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,format:"rgba",parse:function(a){return[2.55*a[1],2.55*a[2],2.55*a[3],a[4]]}},{re:/hsl\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*?\)/,format:"hsl",parse:function(a){return[a[1]/360,a[2]/100,a[3]/100,a[4]]}},{re:/hsla\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,format:"hsla",parse:function(a){return[a[1]/360,a[2]/100,a[3]/100,a[4]]}},{re:/#?([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,format:"hex",parse:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16),1]}},{re:/#?([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/,format:"hex",parse:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16),1]}}],colorNameToHex:function(a){return"undefined"!=typeof this.colors[a.toLowerCase()]?this.colors[a.toLowerCase()]:!1}};var c={horizontal:!1,inline:!1,color:!1,format:!1,input:"input",container:!1,component:".add-on, .input-group-addon",sliders:{saturation:{maxLeft:100,maxTop:100,callLeft:"setSaturation",callTop:"setBrightness"},hue:{maxLeft:0,maxTop:100,callLeft:!1,callTop:"setHue"},alpha:{maxLeft:0,maxTop:100,callLeft:!1,callTop:"setAlpha"}},slidersHorz:{saturation:{maxLeft:100,maxTop:100,callLeft:"setSaturation",callTop:"setBrightness"},hue:{maxLeft:100,maxTop:0,callLeft:"setHue",callTop:!1},alpha:{maxLeft:100,maxTop:0,callLeft:"setAlpha",callTop:!1}},template:'<div class="colorpicker dropdown-menu"><div class="colorpicker-saturation"><i><b></b></i></div><div class="colorpicker-hue"><i></i></div><div class="colorpicker-alpha"><i></i></div><div class="colorpicker-color"><div /></div><div class="colorpicker-selectors"></div></div>',align:"right",customClass:null,colorSelectors:null},d=function(d,e){if(this.element=a(d).addClass("colorpicker-element"),this.options=a.extend(!0,{},c,this.element.data(),e),this.component=this.options.component,this.component=this.component!==!1?this.element.find(this.component):!1,this.component&&0===this.component.length&&(this.component=!1),this.container=this.options.container===!0?this.element:this.options.container,this.container=this.container!==!1?a(this.container):!1,this.input=this.element.is("input")?this.element:this.options.input?this.element.find(this.options.input):!1,this.input&&0===this.input.length&&(this.input=!1),this.color=new b(this.options.color!==!1?this.options.color:this.getValue(),this.options.colorSelectors),this.format=this.options.format!==!1?this.options.format:this.color.origFormat,this.picker=a(this.options.template),this.options.customClass&&this.picker.addClass(this.options.customClass),this.options.inline?this.picker.addClass("colorpicker-inline colorpicker-visible"):this.picker.addClass("colorpicker-hidden"),this.options.horizontal&&this.picker.addClass("colorpicker-horizontal"),("rgba"===this.format||"hsla"===this.format||this.options.format===!1)&&this.picker.addClass("colorpicker-with-alpha"),"right"===this.options.align&&this.picker.addClass("colorpicker-right"),this.options.colorSelectors){var f=this;a.each(this.options.colorSelectors,function(b,c){var d=a("<i />").css("background-color",c).data("class",b);d.click(function(){f.setValue(a(this).css("background-color"))}),f.picker.find(".colorpicker-selectors").append(d)}),this.picker.find(".colorpicker-selectors").show()}this.picker.on("mousedown.colorpicker touchstart.colorpicker",a.proxy(this.mousedown,this)),this.picker.appendTo(this.container?this.container:a("body")),this.input!==!1&&(this.input.on({"keyup.colorpicker":a.proxy(this.keyup,this)}),this.input.on({"change.colorpicker":a.proxy(this.change,this)}),this.component===!1&&this.element.on({"focus.colorpicker":a.proxy(this.show,this)}),this.options.inline===!1&&this.element.on({"focusout.colorpicker":a.proxy(this.hide,this)})),this.component!==!1&&this.component.on({"click.colorpicker":a.proxy(this.show,this)}),this.input===!1&&this.component===!1&&this.element.on({"click.colorpicker":a.proxy(this.show,this)}),this.input!==!1&&this.component!==!1&&"color"===this.input.attr("type")&&this.input.on({"click.colorpicker":a.proxy(this.show,this),"focus.colorpicker":a.proxy(this.show,this)}),this.update(),a(a.proxy(function(){this.element.trigger("create")},this))};d.Color=b,d.prototype={constructor:d,destroy:function(){this.picker.remove(),this.element.removeData("colorpicker").off(".colorpicker"),this.input!==!1&&this.input.off(".colorpicker"),this.component!==!1&&this.component.off(".colorpicker"),this.element.removeClass("colorpicker-element"),this.element.trigger({type:"destroy"})},reposition:function(){if(this.options.inline!==!1||this.options.container)return!1;var a=this.container&&this.container[0]!==document.body?"position":"offset",b=this.component||this.element,c=b[a]();"right"===this.options.align&&(c.left-=this.picker.outerWidth()-b.outerWidth()),this.picker.css({top:c.top+b.outerHeight(),left:c.left})},show:function(b){return this.isDisabled()?!1:(this.picker.addClass("colorpicker-visible").removeClass("colorpicker-hidden"),this.reposition(),a(window).on("resize.colorpicker",a.proxy(this.reposition,this)),!b||this.hasInput()&&"color"!==this.input.attr("type")||b.stopPropagation&&b.preventDefault&&(b.stopPropagation(),b.preventDefault()),this.options.inline===!1&&a(window.document).on({"mousedown.colorpicker":a.proxy(this.hide,this)}),void this.element.trigger({type:"showPicker",color:this.color}))},hide:function(){this.picker.addClass("colorpicker-hidden").removeClass("colorpicker-visible"),a(window).off("resize.colorpicker",this.reposition),a(document).off({"mousedown.colorpicker":this.hide}),this.update(),this.element.trigger({type:"hidePicker",color:this.color})},updateData:function(a){return a=a||this.color.toString(this.format),this.element.data("color",a),a},updateInput:function(a){if(a=a||this.color.toString(this.format),this.input!==!1){if(this.options.colorSelectors){var c=new b(a,this.options.colorSelectors),d=c.toAlias();"undefined"!=typeof this.options.colorSelectors[d]&&(a=d)}this.input.prop("value",a)}return a},updatePicker:function(a){void 0!==a&&(this.color=new b(a,this.options.colorSelectors));var c=this.options.horizontal===!1?this.options.sliders:this.options.slidersHorz,d=this.picker.find("i");return 0!==d.length?(this.options.horizontal===!1?(c=this.options.sliders,d.eq(1).css("top",c.hue.maxTop*(1-this.color.value.h)).end().eq(2).css("top",c.alpha.maxTop*(1-this.color.value.a))):(c=this.options.slidersHorz,d.eq(1).css("left",c.hue.maxLeft*(1-this.color.value.h)).end().eq(2).css("left",c.alpha.maxLeft*(1-this.color.value.a))),d.eq(0).css({top:c.saturation.maxTop-this.color.value.b*c.saturation.maxTop,left:this.color.value.s*c.saturation.maxLeft}),this.picker.find(".colorpicker-saturation").css("backgroundColor",this.color.toHex(this.color.value.h,1,1,1)),this.picker.find(".colorpicker-alpha").css("backgroundColor",this.color.toHex()),this.picker.find(".colorpicker-color, .colorpicker-color div").css("backgroundColor",this.color.toString(this.format)),a):void 0},updateComponent:function(a){if(a=a||this.color.toString(this.format),this.component!==!1){var b=this.component.find("i").eq(0);b.length>0?b.css({backgroundColor:a}):this.component.css({backgroundColor:a})}return a},update:function(a){var b;return(this.getValue(!1)!==!1||a===!0)&&(b=this.updateComponent(),this.updateInput(b),this.updateData(b),this.updatePicker()),b},setValue:function(a){this.color=new b(a,this.options.colorSelectors),this.update(!0),this.element.trigger({type:"changeColor",color:this.color,value:a})},getValue:function(a){a=void 0===a?"#000000":a;var b;return b=this.hasInput()?this.input.val():this.element.data("color"),(void 0===b||""===b||null===b)&&(b=a),b},hasInput:function(){return this.input!==!1},isDisabled:function(){return this.hasInput()?this.input.prop("disabled")===!0:!1},disable:function(){return this.hasInput()?(this.input.prop("disabled",!0),this.element.trigger({type:"disable",color:this.color,value:this.getValue()}),!0):!1},enable:function(){return this.hasInput()?(this.input.prop("disabled",!1),this.element.trigger({type:"enable",color:this.color,value:this.getValue()}),!0):!1},currentSlider:null,mousePointer:{left:0,top:0},mousedown:function(b){b.pageX||b.pageY||!b.originalEvent||(b.pageX=b.originalEvent.touches[0].pageX,b.pageY=b.originalEvent.touches[0].pageY),b.stopPropagation(),b.preventDefault();var c=a(b.target),d=c.closest("div"),e=this.options.horizontal?this.options.slidersHorz:this.options.sliders;if(!d.is(".colorpicker")){if(d.is(".colorpicker-saturation"))this.currentSlider=a.extend({},e.saturation);else if(d.is(".colorpicker-hue"))this.currentSlider=a.extend({},e.hue);else{if(!d.is(".colorpicker-alpha"))return!1;this.currentSlider=a.extend({},e.alpha)}var f=d.offset();this.currentSlider.guide=d.find("i")[0].style,this.currentSlider.left=b.pageX-f.left,this.currentSlider.top=b.pageY-f.top,this.mousePointer={left:b.pageX,top:b.pageY},a(document).on({"mousemove.colorpicker":a.proxy(this.mousemove,this),"touchmove.colorpicker":a.proxy(this.mousemove,this),"mouseup.colorpicker":a.proxy(this.mouseup,this),"touchend.colorpicker":a.proxy(this.mouseup,this)}).trigger("mousemove")}return!1},mousemove:function(a){a.pageX||a.pageY||!a.originalEvent||(a.pageX=a.originalEvent.touches[0].pageX,a.pageY=a.originalEvent.touches[0].pageY),a.stopPropagation(),a.preventDefault();var b=Math.max(0,Math.min(this.currentSlider.maxLeft,this.currentSlider.left+((a.pageX||this.mousePointer.left)-this.mousePointer.left))),c=Math.max(0,Math.min(this.currentSlider.maxTop,this.currentSlider.top+((a.pageY||this.mousePointer.top)-this.mousePointer.top)));return this.currentSlider.guide.left=b+"px",this.currentSlider.guide.top=c+"px",this.currentSlider.callLeft&&this.color[this.currentSlider.callLeft].call(this.color,b/this.currentSlider.maxLeft),this.currentSlider.callTop&&this.color[this.currentSlider.callTop].call(this.color,c/this.currentSlider.maxTop),"setAlpha"===this.currentSlider.callTop&&this.options.format===!1&&(1!==this.color.value.a?(this.format="rgba",this.color.origFormat="rgba"):(this.format="hex",this.color.origFormat="hex")),this.update(!0),this.element.trigger({type:"changeColor",color:this.color}),!1},mouseup:function(b){return b.stopPropagation(),b.preventDefault(),a(document).off({"mousemove.colorpicker":this.mousemove,"touchmove.colorpicker":this.mousemove,"mouseup.colorpicker":this.mouseup,"touchend.colorpicker":this.mouseup}),!1},change:function(a){this.keyup(a)},keyup:function(a){38===a.keyCode?(this.color.value.a<1&&(this.color.value.a=Math.round(100*(this.color.value.a+.01))/100),this.update(!0)):40===a.keyCode?(this.color.value.a>0&&(this.color.value.a=Math.round(100*(this.color.value.a-.01))/100),this.update(!0)):(this.color=new b(this.input.val(),this.options.colorSelectors),this.color.origFormat&&this.options.format===!1&&(this.format=this.color.origFormat),this.getValue(!1)!==!1&&(this.updateData(),this.updateComponent(),this.updatePicker())),this.element.trigger({type:"changeColor",color:this.color,value:this.input.val()})}},a.colorpicker=d,a.fn.colorpicker=function(b){var c,e=arguments,f=this.each(function(){var f=a(this),g=f.data("colorpicker"),h="object"==typeof b?b:{};g||"string"==typeof b?"string"==typeof b&&(c=g[b].apply(g,Array.prototype.slice.call(e,1))):f.data("colorpicker",new d(this,h))});return"getValue"===b?c:f},a.fn.colorpicker.constructor=d});
2891954521/LiteLoaderQQNT-OneBotApi-JS
3,030
src/utils.js
const fs = require("fs"); const path = require('path'); const crypto = require("crypto"); let settingsPath = './'; /** * 下载文件 * @param {string} uri * @param {string} savePath - 保存的路径 */ async function downloadFile(uri, savePath){ let url = new URL(uri); if(url.protocol === "base64:"){ fs.writeFileSync(savePath, Buffer.from(uri.split("base64://")[1], 'base64')); }else if(url.protocol === "http:" || url.protocol === "https:"){ let res = await fetch(url) let blob = await res.blob(); let buffer = await blob.arrayBuffer(); fs.writeFileSync(savePath, Buffer.from(buffer)); } } /** * 计算文件 md5 * @param {string} filePath * @return {string} */ function md5(filePath){ const hash = crypto.createHash('md5'); hash.update(fs.readFileSync(filePath)); return hash.digest('hex'); } async function wait(ms){ return new Promise(resolve => setTimeout(() => resolve(), ms)); } /** * 从本地文件加载设置信息 * @param plugin */ function loadSetting(plugin){ const pluginDataPath = plugin.path.data; settingsPath = path.join(pluginDataPath, "settings.json"); // 设置文件是否存在判断 if(!fs.existsSync(pluginDataPath)){ fs.mkdirSync(pluginDataPath, { recursive: true }); } if(!fs.existsSync(settingsPath)){ return null; }else{ return JSON.parse(fs.readFileSync(settingsPath, "utf-8")) } } function saveSetting(content){ const new_config = typeof content == "string" ? JSON.stringify(JSON.parse(content), null, 4) : JSON.stringify(content, null, 4) fs.writeFileSync(settingsPath, new_config, "utf-8"); } function logToFile(msg){ let currentDateTime = new Date().toLocaleString(); fs.appendFile("./onebotapi.log", currentDateTime + ":" + msg + "\n", (err) => { }); } function checkAndCompleteKeys(json1, json2){ // 补全缺少的 key const keys1 = Object.keys(json1); const keys2 = Object.keys(json2); for(const key of keys2){ if(keys1.includes(key)){ const keys3 = Object.keys(json1[key]); for(const key1 of Object.keys(json2[key])){ if(!keys3.includes(key1)) json1[key][key1] = json2[key][key1]; } }else{ json1[key] = json2[key]; } } return json1; } class LimitedHashMap{ constructor(capacity){ this.capacity = capacity; this.map = {}; this.keys = []; } put(key, value){ // 如果键不存在,检查容量是否达到上限 if(this.keys.length >= this.capacity){ // 移除最早的数据 const oldestKey = this.keys.shift(); delete this.map[oldestKey]; } // 添加新数据 this.map[key] = value; this.keys.push(key); } get(key){ if(this.map.hasOwnProperty(key)){ return this.map[key]; }else{ return null; } } } module.exports = { md5, wait, downloadFile, logToFile, checkAndCompleteKeys, loadSetting, saveSetting, LimitedHashMap, }
2891954521/LiteLoaderQQNT-OneBotApi-JS
9,277
src/renderer.js
const ipcRenderer = window.OneBotApi.ipcRenderer_OneBot; const pluginPath = LiteLoader.plugins['OneBotApi-JS'].path.plugin; let settingHtml = ""; async function onConfigView(view){ } async function onSettingWindowCreated(view){ const IPCAction = OneBotApi.IPCAction; const configData = await OneBotApi.settingData(); if(settingHtml.length == 0){ settingHtml = await (await fetch(`local:///${pluginPath}/src/common/setting.html`)).text() } view.innerHTML = settingHtml; const wsStatus = view.querySelector('.ws #wsServerStatus'); const httpStatus = view.querySelector('.http #httpServerStatus'); const wsReverse = view.querySelector(".ws #wsReverseStatus"); const wsReverseApi = view.querySelector(".ws #wsReverseApiStatus"); const wsReverseEvent = view.querySelector(".ws #wsReverseEventStatus"); const wsPort = view.querySelector(".ws #wsPort"); const httpPort = view.querySelector(".http .HTTPPort"); const httpReport = view.querySelector(".http .HTTPReport"); const wsReverseUrl = view.querySelector(".ws #wsReverseUrl"); const wsReverseApiUrl = view.querySelector(".ws #wsReverseApiUrl"); const wsReverseEventUrl = view.querySelector(".ws #wsReverseEventUrl"); OneBotApi.invoke(IPCAction.ACTION_GET_FRIENDS).then(friends => { view.querySelector('.data #friendList').innerHTML = `共计: ${friends.length} 个好友`; }); OneBotApi.invoke(IPCAction.ACTION_GET_GROUPS).then(groups => { view.querySelector('.data #groupList').innerHTML = `共计: ${groups.length} 个群聊`; }); function updateServerStatus(){ OneBotApi.invoke(IPCAction.ACTION_SERVER_STATUS).then(data => { updateStatus(httpStatus, data.http); updateStatus(wsStatus, data.ws); updateStatus(wsReverse, data.wsReverse.wss); updateStatus(wsReverseApi, data.wsReverse.api); updateStatus(wsReverseEvent, data.wsReverse.event); }); } updateServerStatus(); function restartServerBtn(selector, label, action, data){ view.querySelector(selector).addEventListener("click", () => { label.innerHTML = "正在重启"; OneBotApi.send(action, data); setTimeout(updateServerStatus, 1000); }); } wsPort.value = configData.ws.port; httpPort.value = configData.http.port; httpReport.value = configData.http.host; wsReverseUrl.value = configData.wsReverse.url; wsReverseApiUrl.value = configData.wsReverse.apiUrl; wsReverseEventUrl.value = configData.wsReverse.eventUrl; // 启用HTTP API bindToggle(view, ".http #enableHttpServer", configData.http.enableServer, (enable) => { configData.http.enableServer = enable; OneBotApi.send(IPCAction.ACTION_SET_CONFIG, configData); setTimeout(updateServerStatus, 1000); }); // 重启HTTP API 按钮 restartServerBtn('.http #restartHTTPServer', httpStatus, IPCAction.ACTION_RESTART_HTTP_SERVER, configData.http.port); // 重启Ws服务端按钮 restartServerBtn('.ws #restartWsServer', wsStatus, IPCAction.ACTION_RESTART_WS_SERVER, configData.ws.port); // 启用HTTP上报 bindToggle(view, ".http #enableHTTPReport", configData.http.enable || configData.http.enableReport, (enable) => { configData.http.enableReport = enable; OneBotApi.send(IPCAction.ACTION_SET_CONFIG, configData); }); // 应用HTTP端口设置 bindButton(view, ".http #updateHTTPPort", () => { configData.http.port = parseInt(httpPort.value); httpStatus.innerHTML = "正在重启"; OneBotApi.send(IPCAction.ACTION_SET_CONFIG, configData); OneBotApi.send(IPCAction.ACTION_RESTART_HTTP_SERVER, configData.port); setTimeout(updateServerStatus, 1000); }); // 应用HTTP上报URL设置 bindButton(view, ".http #updateHTTPReport", () => { configData.http.host = httpReport.value; OneBotApi.send('one_bot_api_set_config', configData); alert("设置成功"); }); // 启用正向Ws bindToggle(view, ".ws #enableWs", configData.ws.enable, (enable) => { configData.ws.enable = enable; OneBotApi.send(IPCAction.ACTION_SET_CONFIG, configData); if(enable){ wsStatus.innerHTML = "正在启动"; OneBotApi.send(IPCAction.ACTION_RESTART_WS_SERVER, configData.ws.port); }else{ wsStatus.innerHTML = "正在关闭"; OneBotApi.send(IPCAction.ACTION_STOP_WS_SERVER); } setTimeout(updateServerStatus, 1000); }); // 应用ws端口设置 bindButton(view, ".ws #applyWsPort", () => { configData.ws.port = parseInt(wsPort.value); OneBotApi.send(IPCAction.ACTION_SET_CONFIG, configData); if(configData.ws.enable){ wsStatus.innerHTML = "正在重启"; OneBotApi.send(IPCAction.ACTION_RESTART_WS_SERVER, configData.ws.port); setTimeout(updateServerStatus, 1000); } }); // 启用反向Ws bindToggle(view, ".ws #enableWsReverse", configData.wsReverse.enable, (enable) => { configData.wsReverse.enable = enable; OneBotApi.send(IPCAction.ACTION_SET_CONFIG, configData); if(enable){ wsReverse.innerHTML = "正在重启"; wsReverseApi.innerHTML = "正在重启"; wsReverseEvent.innerHTML = "正在重启"; OneBotApi.send(IPCAction.ACTION_RESTART_WS_REVERSE_SERVER, configData.wsReverse); }else{ wsReverse.innerHTML = "正在关闭"; wsReverseApi.innerHTML = "正在关闭"; wsReverseEvent.innerHTML = "正在关闭"; OneBotApi.send(IPCAction.ACTION_STOP_WS_REVERSE_SERVER); } setTimeout(updateServerStatus, 3000); }); // 应用ws url bindButton(view, ".ws #applyWsReverseUrl", () => { configData.wsReverse.url = wsReverseUrl.value; OneBotApi.send(IPCAction.ACTION_SET_CONFIG, configData); if(configData.wsReverse.enable){ wsReverse.innerHTML = "正在重启"; OneBotApi.send(IPCAction.ACTION_RESTART_WS_REVERSE_SERVER, configData.wsReverse); setTimeout(updateServerStatus, 3000); } }); // 应用ws api url bindButton(view, ".ws #applyWsReverseApiUrl", () => { configData.wsReverse.apiUrl = wsReverseApiUrl.value; OneBotApi.send(IPCAction.ACTION_SET_CONFIG, configData); if(configData.wsReverse.enable){ wsReverseApi.innerHTML = "正在重启"; OneBotApi.send(IPCAction.ACTION_RESTART_WS_REVERSE_SERVER, configData.wsReverse); setTimeout(updateServerStatus, 3000); } }); // 应用ws event url bindButton(view, ".ws #applyWsReverseEventUrl", () => { configData.wsReverse.eventUrl = wsReverseEventUrl.value; OneBotApi.send(IPCAction.ACTION_SET_CONFIG, configData); if(configData.wsReverse.enable){ wsReverseEvent.innerHTML = "正在重启"; OneBotApi.send(IPCAction.ACTION_RESTART_WS_REVERSE_SERVER, configData.wsReverse); setTimeout(updateServerStatus, 1000); } }); bindButton(view, ".data #updateFriendList", () => { OneBotApi.invoke(IPCAction.ACTION_GET_FRIENDS).then(friends => { view.querySelector('.data #friendList').innerHTML = `共计: ${friends.length} 个好友`; }); }); bindButton(view, ".data #updateGroupList", () => { OneBotApi.invoke(IPCAction.ACTION_GET_GROUPS).then(groups => { view.querySelector('.data #groupList').innerHTML = `共计: ${groups.length} 个群聊`; }); }); // 上报自身消息 bindToggle(view, ".setting #reportSelfMsg", configData.setting.reportSelfMsg, (enable) => { configData.setting.reportSelfMsg = enable; OneBotApi.send(IPCAction.ACTION_SET_CONFIG, configData); }); // 上报启动前的消息 bindToggle(view, ".setting #reportOldMsg", configData.setting.reportOldMsg, (enable) => { configData.setting.reportOldMsg = enable; OneBotApi.send(IPCAction.ACTION_SET_CONFIG, configData); }); // 自动接受好友请求 bindToggle(view, ".setting #autoAcceptFriendRequest", configData.setting.autoAcceptFriendRequest, (enable) => { configData.setting.autoAcceptFriendRequest = enable; OneBotApi.send(IPCAction.ACTION_SET_CONFIG, configData); }); bindToggle(view, ".misc #disableUpdate", configData.misc.disableUpdate, (enable) => { configData.misc.disableUpdate = enable; OneBotApi.send(IPCAction.ACTION_SET_CONFIG, configData); }); bindToggle(view, ".debug #debugMode", configData.debug.debug, (enable) => { configData.debug.debug = enable; OneBotApi.send(IPCAction.ACTION_SET_CONFIG, configData); }); bindToggle(view, ".debug #debugIPC", configData.debug.ipc, (enable) => { configData.debug.ipc = enable; OneBotApi.send(IPCAction.ACTION_SET_CONFIG, configData); }); bindButton(view, ".debug #get_group_msg_mask", () => { OneBotApi.invoke(IPCAction.ACTION_HTTP_TEST, 'get_group_msg_mask').then(result => { view.querySelector('.debug #apiTestResult').innerHTML = JSON.stringify(result, null, 2); }); }); } function bindButton(view, selector, callback){ view.querySelector(selector).addEventListener("click", callback); } function bindToggle(view, selector, value, callback){ const toggle = view.querySelector(selector); toggle.toggleAttribute("is-active", value); toggle.addEventListener("click", () => { callback(toggle.toggleAttribute("is-active")); }); } function updateStatus(view, data){ if(data.status) view.innerHTML = '<font color="green">运行中</font>'; else if(data.msg) { view.title = data.msg; view.innerHTML = `<font color="red">${data.msg}</font>`; }else view.innerHTML = '<font color="gray">未运行</font>'; } const url = location.href; if(url.includes("/index.html") && url.includes("#/main/message")){ OneBotApi.send('one_bot_api_load_main_page'); }else{ navigation.addEventListener("navigatesuccess", function func(event){ const url = event.target.currentEntry.url; // 检测是否为主界面 if(url.includes("/index.html") && url.includes("#/main/message")){ navigation.removeEventListener("navigatesuccess", func); OneBotApi.send('one_bot_api_load_main_page') } }); } export { onConfigView, onSettingWindowCreated }
2881099/FreeScheduler
4,449
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/colorpicker/bootstrap-colorpicker.css
/*! * Bootstrap Colorpicker * http://mjolnic.github.io/bootstrap-colorpicker/ * * Originally written by (c) 2012 Stefan Petre * Licensed under the Apache License v2.0 * http://www.apache.org/licenses/LICENSE-2.0.txt * */ .colorpicker-saturation { float: left; width: 100px; height: 100px; cursor: crosshair; background-image: url("img/saturation.png"); } .colorpicker-saturation i { position: absolute; top: 0; left: 0; display: block; width: 5px; height: 5px; margin: -4px 0 0 -4px; border: 1px solid #000; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; } .colorpicker-saturation i b { display: block; width: 5px; height: 5px; border: 1px solid #fff; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; } .colorpicker-hue, .colorpicker-alpha { float: left; width: 15px; height: 100px; margin-bottom: 4px; margin-left: 4px; cursor: row-resize; } .colorpicker-hue i, .colorpicker-alpha i { position: absolute; top: 0; left: 0; display: block; width: 100%; height: 1px; margin-top: -1px; background: #000; border-top: 1px solid #fff; } .colorpicker-hue { background-image: url("img/hue.png"); } .colorpicker-alpha { display: none; background-image: url("img/alpha.png"); } .colorpicker-saturation, .colorpicker-hue, .colorpicker-alpha { background-size: contain; } .colorpicker { top: 0; left: 0; z-index: 2500; min-width: 130px; padding: 4px; margin-top: 1px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; *zoom: 1; } .colorpicker:before, .colorpicker:after { display: table; line-height: 0; content: ""; } .colorpicker:after { clear: both; } .colorpicker:before { position: absolute; top: -7px; left: 6px; display: inline-block; border-right: 7px solid transparent; border-bottom: 7px solid #ccc; border-left: 7px solid transparent; border-bottom-color: rgba(0, 0, 0, 0.2); content: ''; } .colorpicker:after { position: absolute; top: -6px; left: 7px; display: inline-block; border-right: 6px solid transparent; border-bottom: 6px solid #ffffff; border-left: 6px solid transparent; content: ''; } .colorpicker div { position: relative; } .colorpicker.colorpicker-with-alpha { min-width: 140px; } .colorpicker.colorpicker-with-alpha .colorpicker-alpha { display: block; } .colorpicker-color { height: 10px; margin-top: 5px; clear: both; background-image: url("img/alpha.png"); background-position: 0 100%; } .colorpicker-color div { height: 10px; } .colorpicker-selectors { display: none; height: 10px; margin-top: 5px; clear: both; } .colorpicker-selectors i { float: left; width: 10px; height: 10px; cursor: pointer; } .colorpicker-selectors i + i { margin-left: 3px; } .colorpicker-element .input-group-addon i, .colorpicker-element .add-on i { display: inline-block; width: 16px; height: 16px; vertical-align: text-top; cursor: pointer; } .colorpicker.colorpicker-inline { position: relative; z-index: auto; display: inline-block; float: none; } .colorpicker.colorpicker-horizontal { width: 110px; height: auto; min-width: 110px; } .colorpicker.colorpicker-horizontal .colorpicker-saturation { margin-bottom: 4px; } .colorpicker.colorpicker-horizontal .colorpicker-color { width: 100px; } .colorpicker.colorpicker-horizontal .colorpicker-hue, .colorpicker.colorpicker-horizontal .colorpicker-alpha { float: left; width: 100px; height: 15px; margin-bottom: 4px; margin-left: 0; cursor: col-resize; } .colorpicker.colorpicker-horizontal .colorpicker-hue i, .colorpicker.colorpicker-horizontal .colorpicker-alpha i { position: absolute; top: 0; left: 0; display: block; width: 1px; height: 15px; margin-top: 0; background: #ffffff; border: none; } .colorpicker.colorpicker-horizontal .colorpicker-hue { background-image: url("img/hue-horizontal.png"); } .colorpicker.colorpicker-horizontal .colorpicker-alpha { background-image: url("img/alpha-horizontal.png"); } .colorpicker.colorpicker-hidden { display: none; } .colorpicker.colorpicker-visible { display: block; } .colorpicker-inline.colorpicker-visible { display: inline-block; } .colorpicker-right:before { right: 6px; left: auto; } .colorpicker-right:after { right: 7px; left: auto; }
2894638479/fabric-blue-archive-halo
1,210
src/client/java/name/bluearchivehalo/mixin/MultiPhaseMixin.java
package name.bluearchivehalo.mixin; import name.bluearchivehalo.BlueArchiveHaloClient; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.VertexFormat; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.util.Objects; @Mixin(RenderLayer.MultiPhase.class) public class MultiPhaseMixin { @Inject(method = "<init>",at = @At("TAIL")) void bluearchivehalo$modifyMultiPhase( String name, VertexFormat vertexFormat, VertexFormat.DrawMode drawMode, int expectedBufferSize, boolean hasCrumbling, boolean translucent, RenderLayer.MultiPhaseParameters phases, CallbackInfo ci ){ if(!Objects.equals(name, "beacon_beam")) return; if(!translucent) return; RenderLayer.MultiPhase multiPhase = (RenderLayer.MultiPhase)(Object)this; BlueArchiveHaloClient.INSTANCE.modifyMultiPhase(multiPhase,name,vertexFormat,drawMode,expectedBufferSize,hasCrumbling,translucent,phases); } }
2891954521/LiteLoaderQQNT-OneBotApi-JS
2,848
src/network/httpServer.js
const http = require('http'); const querystring = require('querystring'); const { Log } = require('../logger'); const { oneBot11API} = require("../oneBot11/oneBot11"); let errorMsg = null; let isRunning = false; const server = http.createServer(async (req, res) => { if(req.method !== 'POST'){ res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Http server is running'); return; } let body = ''; req.on('data', (chunk) => { body += chunk; }); req.on('end', async() => { res.statusCode = 200; res.setHeader('Content-Type', 'application/json'); try{ let contentType = req.headers['content-type']; let form; if(contentType === "application/json"){ form = body !== "" ? JSON.parse(body) : {} }else if(contentType === "application/x-www-form-urlencoded"){ form = querystring.parse(body); }else if(contentType === "multipart/form-data"){ res.end('{ "code": 403, "msg": "Unsupport content type" }'); return; }else if(body.length > 0){ res.end('{ "code": 400, "msg": "Wrong content type" }'); return; }else{ form = { }; } const handler = oneBot11API[req.url[0] == '/' ? req.url.slice(1) : req.url]; if(handler){ res.end(JSON.stringify(await handler(form))); }else{ res.end('{ "code": 404, "msg": "Not Found" }'); } }catch(error){ Log.e(error); res.end(`{ "code": 500, "msg": ${error.toString()} }`); } }); }); function startHttpServer(port){ if(isRunning) return; server.on('error', (e) => { if(e.code === 'EADDRINUSE'){ errorMsg = "端口已被占用"; Log.w(`Port ${port} is already in used`); } }); server.listen(port, '0.0.0.0', () => { isRunning = true; Log.i(`HTTP Server running at http://0.0.0.0:${port}/`); }); } async function restartHttpServer(port){ if(isRunning){ await stopHttpServer(); Log.i(`restarting Http Server.`); startHttpServer(port) }else{ startHttpServer(port); } } function stopHttpServer(){ return new Promise((resolve) => { if(isRunning){ server.close(() => { Log.i(`HTTP Server stopped.`); isRunning = false; resolve(); }) }else{ resolve(); } }) } module.exports = { getStatus: () => { return { status: isRunning, msg: errorMsg } }, startHttpServer, restartHttpServer, stopHttpServer }
2881099/FreeScheduler
34,100
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/colorpicker/bootstrap-colorpicker.js
/*! * Bootstrap Colorpicker * http://mjolnic.github.io/bootstrap-colorpicker/ * * Originally written by (c) 2012 Stefan Petre * Licensed under the Apache License v2.0 * http://www.apache.org/licenses/LICENSE-2.0.txt * * @todo Update DOCS */ (function(factory) { "use strict"; if (typeof exports === 'object') { module.exports = factory(window.jQuery); } else if (typeof define === 'function' && define.amd) { define(['jquery'], factory); } else if (window.jQuery && !window.jQuery.fn.colorpicker) { factory(window.jQuery); } } (function($) { 'use strict'; // Color object var Color = function(val, customColors) { this.value = { h: 0, s: 0, b: 0, a: 1 }; this.origFormat = null; // original string format if (customColors) { $.extend(this.colors, customColors); } if (val) { if (val.toLowerCase !== undefined) { // cast to string val = val + ''; this.setColor(val); } else if (val.h !== undefined) { this.value = val; } } }; Color.prototype = { constructor: Color, // 140 predefined colors from the HTML Colors spec colors: { "aliceblue": "#f0f8ff", "antiquewhite": "#faebd7", "aqua": "#00ffff", "aquamarine": "#7fffd4", "azure": "#f0ffff", "beige": "#f5f5dc", "bisque": "#ffe4c4", "black": "#000000", "blanchedalmond": "#ffebcd", "blue": "#0000ff", "blueviolet": "#8a2be2", "brown": "#a52a2a", "burlywood": "#deb887", "cadetblue": "#5f9ea0", "chartreuse": "#7fff00", "chocolate": "#d2691e", "coral": "#ff7f50", "cornflowerblue": "#6495ed", "cornsilk": "#fff8dc", "crimson": "#dc143c", "cyan": "#00ffff", "darkblue": "#00008b", "darkcyan": "#008b8b", "darkgoldenrod": "#b8860b", "darkgray": "#a9a9a9", "darkgreen": "#006400", "darkkhaki": "#bdb76b", "darkmagenta": "#8b008b", "darkolivegreen": "#556b2f", "darkorange": "#ff8c00", "darkorchid": "#9932cc", "darkred": "#8b0000", "darksalmon": "#e9967a", "darkseagreen": "#8fbc8f", "darkslateblue": "#483d8b", "darkslategray": "#2f4f4f", "darkturquoise": "#00ced1", "darkviolet": "#9400d3", "deeppink": "#ff1493", "deepskyblue": "#00bfff", "dimgray": "#696969", "dodgerblue": "#1e90ff", "firebrick": "#b22222", "floralwhite": "#fffaf0", "forestgreen": "#228b22", "fuchsia": "#ff00ff", "gainsboro": "#dcdcdc", "ghostwhite": "#f8f8ff", "gold": "#ffd700", "goldenrod": "#daa520", "gray": "#808080", "green": "#008000", "greenyellow": "#adff2f", "honeydew": "#f0fff0", "hotpink": "#ff69b4", "indianred": "#cd5c5c", "indigo": "#4b0082", "ivory": "#fffff0", "khaki": "#f0e68c", "lavender": "#e6e6fa", "lavenderblush": "#fff0f5", "lawngreen": "#7cfc00", "lemonchiffon": "#fffacd", "lightblue": "#add8e6", "lightcoral": "#f08080", "lightcyan": "#e0ffff", "lightgoldenrodyellow": "#fafad2", "lightgrey": "#d3d3d3", "lightgreen": "#90ee90", "lightpink": "#ffb6c1", "lightsalmon": "#ffa07a", "lightseagreen": "#20b2aa", "lightskyblue": "#87cefa", "lightslategray": "#778899", "lightsteelblue": "#b0c4de", "lightyellow": "#ffffe0", "lime": "#00ff00", "limegreen": "#32cd32", "linen": "#faf0e6", "magenta": "#ff00ff", "maroon": "#800000", "mediumaquamarine": "#66cdaa", "mediumblue": "#0000cd", "mediumorchid": "#ba55d3", "mediumpurple": "#9370d8", "mediumseagreen": "#3cb371", "mediumslateblue": "#7b68ee", "mediumspringgreen": "#00fa9a", "mediumturquoise": "#48d1cc", "mediumvioletred": "#c71585", "midnightblue": "#191970", "mintcream": "#f5fffa", "mistyrose": "#ffe4e1", "moccasin": "#ffe4b5", "navajowhite": "#ffdead", "navy": "#000080", "oldlace": "#fdf5e6", "olive": "#808000", "olivedrab": "#6b8e23", "orange": "#ffa500", "orangered": "#ff4500", "orchid": "#da70d6", "palegoldenrod": "#eee8aa", "palegreen": "#98fb98", "paleturquoise": "#afeeee", "palevioletred": "#d87093", "papayawhip": "#ffefd5", "peachpuff": "#ffdab9", "peru": "#cd853f", "pink": "#ffc0cb", "plum": "#dda0dd", "powderblue": "#b0e0e6", "purple": "#800080", "red": "#ff0000", "rosybrown": "#bc8f8f", "royalblue": "#4169e1", "saddlebrown": "#8b4513", "salmon": "#fa8072", "sandybrown": "#f4a460", "seagreen": "#2e8b57", "seashell": "#fff5ee", "sienna": "#a0522d", "silver": "#c0c0c0", "skyblue": "#87ceeb", "slateblue": "#6a5acd", "slategray": "#708090", "snow": "#fffafa", "springgreen": "#00ff7f", "steelblue": "#4682b4", "tan": "#d2b48c", "teal": "#008080", "thistle": "#d8bfd8", "tomato": "#ff6347", "turquoise": "#40e0d0", "violet": "#ee82ee", "wheat": "#f5deb3", "white": "#ffffff", "whitesmoke": "#f5f5f5", "yellow": "#ffff00", "yellowgreen": "#9acd32", "transparent": "transparent" }, _sanitizeNumber: function(val) { if (typeof val === 'number') { return val; } if (isNaN(val) || (val === null) || (val === '') || (val === undefined)) { return 1; } if (val.toLowerCase !== undefined) { return parseFloat(val); } return 1; }, isTransparent: function(strVal) { if (!strVal) { return false; } strVal = strVal.toLowerCase().trim(); return (strVal === 'transparent') || (strVal.match(/#?00000000/)) || (strVal.match(/(rgba|hsla)\(0,0,0,0?\.?0\)/)); }, rgbaIsTransparent: function(rgba) { return ((rgba.r === 0) && (rgba.g === 0) && (rgba.b === 0) && (rgba.a === 0)); }, //parse a string to HSB setColor: function(strVal) { strVal = strVal.toLowerCase().trim(); if (strVal) { if (this.isTransparent(strVal)) { this.value = { h: 0, s: 0, b: 0, a: 0 }; } else { this.value = this.stringToHSB(strVal) || { h: 0, s: 0, b: 0, a: 1 }; // if parser fails, defaults to black } } }, stringToHSB: function(strVal) { strVal = strVal.toLowerCase(); var alias; if (typeof this.colors[strVal] !== 'undefined') { strVal = this.colors[strVal]; alias = 'alias'; } var that = this, result = false; $.each(this.stringParsers, function(i, parser) { var match = parser.re.exec(strVal), values = match && parser.parse.apply(that, [match]), format = alias || parser.format || 'rgba'; if (values) { if (format.match(/hsla?/)) { result = that.RGBtoHSB.apply(that, that.HSLtoRGB.apply(that, values)); } else { result = that.RGBtoHSB.apply(that, values); } that.origFormat = format; return false; } return true; }); return result; }, setHue: function(h) { this.value.h = 1 - h; }, setSaturation: function(s) { this.value.s = s; }, setBrightness: function(b) { this.value.b = 1 - b; }, setAlpha: function(a) { this.value.a = parseInt((1 - a) * 100, 10) / 100; }, toRGB: function(h, s, b, a) { if (!h) { h = this.value.h; s = this.value.s; b = this.value.b; } h *= 360; var R, G, B, X, C; h = (h % 360) / 60; C = b * s; X = C * (1 - Math.abs(h % 2 - 1)); R = G = B = b - C; h = ~~h; R += [C, X, 0, 0, X, C][h]; G += [X, C, C, X, 0, 0][h]; B += [0, 0, X, C, C, X][h]; return { r: Math.round(R * 255), g: Math.round(G * 255), b: Math.round(B * 255), a: a || this.value.a }; }, toHex: function(h, s, b, a) { var rgb = this.toRGB(h, s, b, a); if (this.rgbaIsTransparent(rgb)) { return 'transparent'; } return '#' + ((1 << 24) | (parseInt(rgb.r) << 16) | (parseInt(rgb.g) << 8) | parseInt(rgb.b)).toString(16).substr(1); }, toHSL: function(h, s, b, a) { h = h || this.value.h; s = s || this.value.s; b = b || this.value.b; a = a || this.value.a; var H = h, L = (2 - s) * b, S = s * b; if (L > 0 && L <= 1) { S /= L; } else { S /= 2 - L; } L /= 2; if (S > 1) { S = 1; } return { h: isNaN(H) ? 0 : H, s: isNaN(S) ? 0 : S, l: isNaN(L) ? 0 : L, a: isNaN(a) ? 0 : a }; }, toAlias: function(r, g, b, a) { var rgb = this.toHex(r, g, b, a); for (var alias in this.colors) { if (this.colors[alias] === rgb) { return alias; } } return false; }, RGBtoHSB: function(r, g, b, a) { r /= 255; g /= 255; b /= 255; var H, S, V, C; V = Math.max(r, g, b); C = V - Math.min(r, g, b); H = (C === 0 ? null : V === r ? (g - b) / C : V === g ? (b - r) / C + 2 : (r - g) / C + 4 ); H = ((H + 360) % 6) * 60 / 360; S = C === 0 ? 0 : C / V; return { h: this._sanitizeNumber(H), s: S, b: V, a: this._sanitizeNumber(a) }; }, HueToRGB: function(p, q, h) { if (h < 0) { h += 1; } else if (h > 1) { h -= 1; } if ((h * 6) < 1) { return p + (q - p) * h * 6; } else if ((h * 2) < 1) { return q; } else if ((h * 3) < 2) { return p + (q - p) * ((2 / 3) - h) * 6; } else { return p; } }, HSLtoRGB: function(h, s, l, a) { if (s < 0) { s = 0; } var q; if (l <= 0.5) { q = l * (1 + s); } else { q = l + s - (l * s); } var p = 2 * l - q; var tr = h + (1 / 3); var tg = h; var tb = h - (1 / 3); var r = Math.round(this.HueToRGB(p, q, tr) * 255); var g = Math.round(this.HueToRGB(p, q, tg) * 255); var b = Math.round(this.HueToRGB(p, q, tb) * 255); return [r, g, b, this._sanitizeNumber(a)]; }, toString: function(format) { format = format || 'rgba'; var c = false; switch (format) { case 'rgb': { c = this.toRGB(); if (this.rgbaIsTransparent(c)) { return 'transparent'; } return 'rgb(' + c.r + ',' + c.g + ',' + c.b + ')'; } break; case 'rgba': { c = this.toRGB(); return 'rgba(' + c.r + ',' + c.g + ',' + c.b + ',' + c.a + ')'; } break; case 'hsl': { c = this.toHSL(); return 'hsl(' + Math.round(c.h * 360) + ',' + Math.round(c.s * 100) + '%,' + Math.round(c.l * 100) + '%)'; } break; case 'hsla': { c = this.toHSL(); return 'hsla(' + Math.round(c.h * 360) + ',' + Math.round(c.s * 100) + '%,' + Math.round(c.l * 100) + '%,' + c.a + ')'; } break; case 'hex': { return this.toHex(); } break; case 'alias': return this.toAlias() || this.toHex(); default: { return c; } break; } }, // a set of RE's that can match strings and generate color tuples. // from John Resig color plugin // https://github.com/jquery/jquery-color/ stringParsers: [{ re: /rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*?\)/, format: 'rgb', parse: function(execResult) { return [ execResult[1], execResult[2], execResult[3], 1 ]; } }, { re: /rgb\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*?\)/, format: 'rgb', parse: function(execResult) { return [ 2.55 * execResult[1], 2.55 * execResult[2], 2.55 * execResult[3], 1 ]; } }, { re: /rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, format: 'rgba', parse: function(execResult) { return [ execResult[1], execResult[2], execResult[3], execResult[4] ]; } }, { re: /rgba\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, format: 'rgba', parse: function(execResult) { return [ 2.55 * execResult[1], 2.55 * execResult[2], 2.55 * execResult[3], execResult[4] ]; } }, { re: /hsl\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*?\)/, format: 'hsl', parse: function(execResult) { return [ execResult[1] / 360, execResult[2] / 100, execResult[3] / 100, execResult[4] ]; } }, { re: /hsla\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, format: 'hsla', parse: function(execResult) { return [ execResult[1] / 360, execResult[2] / 100, execResult[3] / 100, execResult[4] ]; } }, { re: /#?([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/, format: 'hex', parse: function(execResult) { return [ parseInt(execResult[1], 16), parseInt(execResult[2], 16), parseInt(execResult[3], 16), 1 ]; } }, { re: /#?([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/, format: 'hex', parse: function(execResult) { return [ parseInt(execResult[1] + execResult[1], 16), parseInt(execResult[2] + execResult[2], 16), parseInt(execResult[3] + execResult[3], 16), 1 ]; } }], colorNameToHex: function(name) { if (typeof this.colors[name.toLowerCase()] !== 'undefined') { return this.colors[name.toLowerCase()]; } return false; } }; var defaults = { horizontal: false, // horizontal mode layout ? inline: false, //forces to show the colorpicker as an inline element color: false, //forces a color format: false, //forces a format input: 'input', // children input selector container: false, // container selector component: '.add-on, .input-group-addon', // children component selector sliders: { saturation: { maxLeft: 100, maxTop: 100, callLeft: 'setSaturation', callTop: 'setBrightness' }, hue: { maxLeft: 0, maxTop: 100, callLeft: false, callTop: 'setHue' }, alpha: { maxLeft: 0, maxTop: 100, callLeft: false, callTop: 'setAlpha' } }, slidersHorz: { saturation: { maxLeft: 100, maxTop: 100, callLeft: 'setSaturation', callTop: 'setBrightness' }, hue: { maxLeft: 100, maxTop: 0, callLeft: 'setHue', callTop: false }, alpha: { maxLeft: 100, maxTop: 0, callLeft: 'setAlpha', callTop: false } }, template: '<div class="colorpicker dropdown-menu">' + '<div class="colorpicker-saturation"><i><b></b></i></div>' + '<div class="colorpicker-hue"><i></i></div>' + '<div class="colorpicker-alpha"><i></i></div>' + '<div class="colorpicker-color"><div /></div>' + '<div class="colorpicker-selectors"></div>' + '</div>', align: 'right', customClass: null, colorSelectors: null }; var Colorpicker = function(element, options) { this.element = $(element).addClass('colorpicker-element'); this.options = $.extend(true, {}, defaults, this.element.data(), options); this.component = this.options.component; this.component = (this.component !== false) ? this.element.find(this.component) : false; if (this.component && (this.component.length === 0)) { this.component = false; } this.container = (this.options.container === true) ? this.element : this.options.container; this.container = (this.container !== false) ? $(this.container) : false; // Is the element an input? Should we search inside for any input? this.input = this.element.is('input') ? this.element : (this.options.input ? this.element.find(this.options.input) : false); if (this.input && (this.input.length === 0)) { this.input = false; } // Set HSB color this.color = new Color(this.options.color !== false ? this.options.color : this.getValue(), this.options.colorSelectors); this.format = this.options.format !== false ? this.options.format : this.color.origFormat; // Setup picker this.picker = $(this.options.template); if (this.options.customClass) { this.picker.addClass(this.options.customClass); } if (this.options.inline) { this.picker.addClass('colorpicker-inline colorpicker-visible'); } else { this.picker.addClass('colorpicker-hidden'); } if (this.options.horizontal) { this.picker.addClass('colorpicker-horizontal'); } if (this.format === 'rgba' || this.format === 'hsla' || this.options.format === false) { this.picker.addClass('colorpicker-with-alpha'); } if (this.options.align === 'right') { this.picker.addClass('colorpicker-right'); } if (this.options.colorSelectors) { var colorpicker = this; $.each(this.options.colorSelectors, function(name, color) { var $btn = $('<i />').css('background-color', color).data('class', name); $btn.click(function() { colorpicker.setValue($(this).css('background-color')); }); colorpicker.picker.find('.colorpicker-selectors').append($btn); }); this.picker.find('.colorpicker-selectors').show(); } this.picker.on('mousedown.colorpicker touchstart.colorpicker', $.proxy(this.mousedown, this)); this.picker.appendTo(this.container ? this.container : $('body')); // Bind events if (this.input !== false) { this.input.on({ 'keyup.colorpicker': $.proxy(this.keyup, this) }); this.input.on({ 'change.colorpicker': $.proxy(this.change, this) }); if (this.component === false) { this.element.on({ 'focus.colorpicker': $.proxy(this.show, this) }); } if (this.options.inline === false) { this.element.on({ 'focusout.colorpicker': $.proxy(this.hide, this) }); } } if (this.component !== false) { this.component.on({ 'click.colorpicker': $.proxy(this.show, this) }); } if ((this.input === false) && (this.component === false)) { this.element.on({ 'click.colorpicker': $.proxy(this.show, this) }); } // for HTML5 input[type='color'] if ((this.input !== false) && (this.component !== false) && (this.input.attr('type') === 'color')) { this.input.on({ 'click.colorpicker': $.proxy(this.show, this), 'focus.colorpicker': $.proxy(this.show, this) }); } this.update(); $($.proxy(function() { this.element.trigger('create'); }, this)); }; Colorpicker.Color = Color; Colorpicker.prototype = { constructor: Colorpicker, destroy: function() { this.picker.remove(); this.element.removeData('colorpicker').off('.colorpicker'); if (this.input !== false) { this.input.off('.colorpicker'); } if (this.component !== false) { this.component.off('.colorpicker'); } this.element.removeClass('colorpicker-element'); this.element.trigger({ type: 'destroy' }); }, reposition: function() { if (this.options.inline !== false || this.options.container) { return false; } var type = this.container && this.container[0] !== document.body ? 'position' : 'offset'; var element = this.component || this.element; var offset = element[type](); if (this.options.align === 'right') { offset.left -= this.picker.outerWidth() - element.outerWidth(); } this.picker.css({ top: offset.top + element.outerHeight(), left: offset.left }); }, show: function(e) { if (this.isDisabled()) { return false; } this.picker.addClass('colorpicker-visible').removeClass('colorpicker-hidden'); this.reposition(); $(window).on('resize.colorpicker', $.proxy(this.reposition, this)); if (e && (!this.hasInput() || this.input.attr('type') === 'color')) { if (e.stopPropagation && e.preventDefault) { e.stopPropagation(); e.preventDefault(); } } if (this.options.inline === false) { $(window.document).on({ 'mousedown.colorpicker': $.proxy(this.hide, this) }); } this.element.trigger({ type: 'showPicker', color: this.color }); }, hide: function() { this.picker.addClass('colorpicker-hidden').removeClass('colorpicker-visible'); $(window).off('resize.colorpicker', this.reposition); $(document).off({ 'mousedown.colorpicker': this.hide }); this.update(); this.element.trigger({ type: 'hidePicker', color: this.color }); }, updateData: function(val) { val = val || this.color.toString(this.format); this.element.data('color', val); return val; }, updateInput: function(val) { val = val || this.color.toString(this.format); if (this.input !== false) { if (this.options.colorSelectors) { var color = new Color(val, this.options.colorSelectors); var alias = color.toAlias(); if (typeof this.options.colorSelectors[alias] !== 'undefined') { val = alias; } } this.input.prop('value', val); } return val; }, updatePicker: function(val) { if (val !== undefined) { this.color = new Color(val, this.options.colorSelectors); } var sl = (this.options.horizontal === false) ? this.options.sliders : this.options.slidersHorz; var icns = this.picker.find('i'); if (icns.length === 0) { return; } if (this.options.horizontal === false) { sl = this.options.sliders; icns.eq(1).css('top', sl.hue.maxTop * (1 - this.color.value.h)).end() .eq(2).css('top', sl.alpha.maxTop * (1 - this.color.value.a)); } else { sl = this.options.slidersHorz; icns.eq(1).css('left', sl.hue.maxLeft * (1 - this.color.value.h)).end() .eq(2).css('left', sl.alpha.maxLeft * (1 - this.color.value.a)); } icns.eq(0).css({ 'top': sl.saturation.maxTop - this.color.value.b * sl.saturation.maxTop, 'left': this.color.value.s * sl.saturation.maxLeft }); this.picker.find('.colorpicker-saturation').css('backgroundColor', this.color.toHex(this.color.value.h, 1, 1, 1)); this.picker.find('.colorpicker-alpha').css('backgroundColor', this.color.toHex()); this.picker.find('.colorpicker-color, .colorpicker-color div').css('backgroundColor', this.color.toString(this.format)); return val; }, updateComponent: function(val) { val = val || this.color.toString(this.format); if (this.component !== false) { var icn = this.component.find('i').eq(0); if (icn.length > 0) { icn.css({ 'backgroundColor': val }); } else { this.component.css({ 'backgroundColor': val }); } } return val; }, update: function(force) { var val; if ((this.getValue(false) !== false) || (force === true)) { // Update input/data only if the current value is not empty val = this.updateComponent(); this.updateInput(val); this.updateData(val); this.updatePicker(); // only update picker if value is not empty } return val; }, setValue: function(val) { // set color manually this.color = new Color(val, this.options.colorSelectors); this.update(true); this.element.trigger({ type: 'changeColor', color: this.color, value: val }); }, getValue: function(defaultValue) { defaultValue = (defaultValue === undefined) ? '#000000' : defaultValue; var val; if (this.hasInput()) { val = this.input.val(); } else { val = this.element.data('color'); } if ((val === undefined) || (val === '') || (val === null)) { // if not defined or empty, return default val = defaultValue; } return val; }, hasInput: function() { return (this.input !== false); }, isDisabled: function() { if (this.hasInput()) { return (this.input.prop('disabled') === true); } return false; }, disable: function() { if (this.hasInput()) { this.input.prop('disabled', true); this.element.trigger({ type: 'disable', color: this.color, value: this.getValue() }); return true; } return false; }, enable: function() { if (this.hasInput()) { this.input.prop('disabled', false); this.element.trigger({ type: 'enable', color: this.color, value: this.getValue() }); return true; } return false; }, currentSlider: null, mousePointer: { left: 0, top: 0 }, mousedown: function(e) { if (!e.pageX && !e.pageY && e.originalEvent) { e.pageX = e.originalEvent.touches[0].pageX; e.pageY = e.originalEvent.touches[0].pageY; } e.stopPropagation(); e.preventDefault(); var target = $(e.target); //detect the slider and set the limits and callbacks var zone = target.closest('div'); var sl = this.options.horizontal ? this.options.slidersHorz : this.options.sliders; if (!zone.is('.colorpicker')) { if (zone.is('.colorpicker-saturation')) { this.currentSlider = $.extend({}, sl.saturation); } else if (zone.is('.colorpicker-hue')) { this.currentSlider = $.extend({}, sl.hue); } else if (zone.is('.colorpicker-alpha')) { this.currentSlider = $.extend({}, sl.alpha); } else { return false; } var offset = zone.offset(); //reference to guide's style this.currentSlider.guide = zone.find('i')[0].style; this.currentSlider.left = e.pageX - offset.left; this.currentSlider.top = e.pageY - offset.top; this.mousePointer = { left: e.pageX, top: e.pageY }; //trigger mousemove to move the guide to the current position $(document).on({ 'mousemove.colorpicker': $.proxy(this.mousemove, this), 'touchmove.colorpicker': $.proxy(this.mousemove, this), 'mouseup.colorpicker': $.proxy(this.mouseup, this), 'touchend.colorpicker': $.proxy(this.mouseup, this) }).trigger('mousemove'); } return false; }, mousemove: function(e) { if (!e.pageX && !e.pageY && e.originalEvent) { e.pageX = e.originalEvent.touches[0].pageX; e.pageY = e.originalEvent.touches[0].pageY; } e.stopPropagation(); e.preventDefault(); var left = Math.max( 0, Math.min( this.currentSlider.maxLeft, this.currentSlider.left + ((e.pageX || this.mousePointer.left) - this.mousePointer.left) ) ); var top = Math.max( 0, Math.min( this.currentSlider.maxTop, this.currentSlider.top + ((e.pageY || this.mousePointer.top) - this.mousePointer.top) ) ); this.currentSlider.guide.left = left + 'px'; this.currentSlider.guide.top = top + 'px'; if (this.currentSlider.callLeft) { this.color[this.currentSlider.callLeft].call(this.color, left / this.currentSlider.maxLeft); } if (this.currentSlider.callTop) { this.color[this.currentSlider.callTop].call(this.color, top / this.currentSlider.maxTop); } // Change format dynamically // Only occurs if user choose the dynamic format by // setting option format to false if (this.currentSlider.callTop === 'setAlpha' && this.options.format === false) { // Converting from hex / rgb to rgba if (this.color.value.a !== 1) { this.format = 'rgba'; this.color.origFormat = 'rgba'; } // Converting from rgba to hex else { this.format = 'hex'; this.color.origFormat = 'hex'; } } this.update(true); this.element.trigger({ type: 'changeColor', color: this.color }); return false; }, mouseup: function(e) { e.stopPropagation(); e.preventDefault(); $(document).off({ 'mousemove.colorpicker': this.mousemove, 'touchmove.colorpicker': this.mousemove, 'mouseup.colorpicker': this.mouseup, 'touchend.colorpicker': this.mouseup }); return false; }, change: function(e) { this.keyup(e); }, keyup: function(e) { if ((e.keyCode === 38)) { if (this.color.value.a < 1) { this.color.value.a = Math.round((this.color.value.a + 0.01) * 100) / 100; } this.update(true); } else if ((e.keyCode === 40)) { if (this.color.value.a > 0) { this.color.value.a = Math.round((this.color.value.a - 0.01) * 100) / 100; } this.update(true); } else { this.color = new Color(this.input.val(), this.options.colorSelectors); // Change format dynamically // Only occurs if user choose the dynamic format by // setting option format to false if (this.color.origFormat && this.options.format === false) { this.format = this.color.origFormat; } if (this.getValue(false) !== false) { this.updateData(); this.updateComponent(); this.updatePicker(); } } this.element.trigger({ type: 'changeColor', color: this.color, value: this.input.val() }); } }; $.colorpicker = Colorpicker; $.fn.colorpicker = function(option) { var pickerArgs = arguments, rv; var $returnValue = this.each(function() { var $this = $(this), inst = $this.data('colorpicker'), options = ((typeof option === 'object') ? option : {}); if ((!inst) && (typeof option !== 'string')) { $this.data('colorpicker', new Colorpicker(this, options)); } else { if (typeof option === 'string') { rv = inst[option].apply(inst, Array.prototype.slice.call(pickerArgs, 1)); } } }); if (option === 'getValue') { return rv; } return $returnValue; }; $.fn.colorpicker.constructor = Colorpicker; }));
2891954521/LiteLoaderQQNT-OneBotApi-JS
3,237
src/network/wsServer.js
const http = require('http'); const WebSocketServer = require('../lib/websocket-server'); const { Log } = require("../logger"); const { Reporter } = require('../main/core'); const { oneBot11API} = require('../oneBot11/oneBot11') const WsStatus = { CONNECTING: 0, OPEN: 1, CLOSING: 2, CLOSED: 3 }; let errorMsg = null; let isRunning = false; const wss = new WebSocketServer({ noServer: true }); const api = new WebSocketServer({ noServer: true }); const event = new WebSocketServer({ noServer: true }); const server = http.createServer(); function init(){ wss.on('connection', (ws) => { ws.on('error', Log.w); ws.on('message', (data) => handle(ws, data)); }); api.on('connection', (ws) => { ws.on('error', Log.w); ws.on('message', (data) => handle(ws, data)); }); event.on('connection', (ws) => { ws.on('error', Log.w); }); wss.on('error', (err) => Log.w(err)); api.on('error', (err) => Log.w(err)); event.on('error', (err) => Log.w(err)); } function handle(ws, data){ try{ let params = JSON.parse(data); const handler = oneBot11API[params?.action]; if(handler){ new Promise(async(resolve) => { resolve(await handler(params.params || {})) }).then((result) => { result.echo = params.echo; ws.send(JSON.stringify(result)); }, (err) => { Log.e(err.stack); }); }else{ ws.send(`{"status": "failed", "retcode": 1404, "data": null, "echo": "${params.echo}"}`) } }catch(e){ Log.e(e.stack); } } function report(data){ wss.clients.forEach((client) => { if(client.readyState === WsStatus.OPEN) client.send(data); }); event.clients.forEach((client) => { if(client.readyState === WsStatus.OPEN) client.send(data); }); } function startWsServer(port){ if(isRunning) return; server.on('upgrade', function upgrade(request, socket, head) { if(request.url == '/'){ wss.handleUpgrade(request, socket, head, (ws) => wss.emit('connection', ws, request)); }else if(request.url == '/api' || request.url == '/api/'){ api.handleUpgrade(request, socket, head, (ws) => api.emit('connection', ws, request)); }else if(request.url == '/event' || request.url == '/event/'){ event.handleUpgrade(request, socket, head, (ws) => event.emit('connection', ws, request)); }else{ socket.write('HTTP/1.1 404 Not Found\r\n\r\n'); socket.destroy(); } }); server.on('error', (e) => { if(e.code === 'EADDRINUSE'){ errorMsg = "端口已被占用"; Log.w(`Port ${port} is already in used`); } }); server.listen(port, '0.0.0.0', () => { isRunning = true; Reporter.webSocketReporter = report; Log.i(`WebSocket Server running at http://0.0.0.0:${port}/`); }); } async function restartWsServer(port){ if(isRunning){ await stopWsServer(); Log.i(`restarting WebSocket Server.`); startWsServer(port) }else{ startWsServer(port); } } function stopWsServer(){ return new Promise((resolve) => { if(isRunning){ Reporter.webSocketReporter = null; server.close(() => { Log.i(`WebSocket Server stopped.`); isRunning = false; resolve(); }) }else{ resolve(); } }) } init(); module.exports = { getStatus: () => { return { status: isRunning, msg: errorMsg } }, startWsServer, restartWsServer, stopWsServer }
2894638479/fabric-blue-archive-halo
3,579
src/client/kotlin/name/bluearchivehalo/SerializeWrapper.kt
package name.bluearchivehalo import kotlinx.serialization.KSerializer import kotlinx.serialization.descriptors.ClassSerialDescriptorBuilder import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.descriptors.buildClassSerialDescriptor import kotlinx.serialization.descriptors.element import kotlinx.serialization.encoding.CompositeDecoder import kotlinx.serialization.encoding.CompositeEncoder import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder import kotlinx.serialization.encoding.decodeStructure import kotlinx.serialization.encoding.encodeStructure import kotlinx.serialization.serializer abstract class SerializerWrapper<T : Any,D:SerializerWrapper.Descriptor<T>>(name:String, val desc:D):KSerializer<T> { final override val descriptor = buildClassSerialDescriptor(name){ desc.items.forEach { it.run { buildElement() } } } abstract class Descriptor<T:Any>{ abstract class Item <T:Any,E:Any>(val name: String){ abstract fun ClassSerialDescriptorBuilder.buildElement() abstract fun CompositeDecoder.deserialize(descriptor:SerialDescriptor, index:Int):E abstract fun CompositeEncoder.serialize(descriptor: SerialDescriptor, index:Int, value:T) //this logic can only run on single thread internal var _value:E? = null val nonNull get() = _value ?: error("required field $name is null") val nullable get() = _value fun orElse(fallback:E) = _value ?: fallback internal fun CompositeDecoder.setValueByDeserialize(descriptor:SerialDescriptor, index:Int) {_value = deserialize(descriptor, index)} } inline infix fun <reified E:Any> String.from(crossinline serializeValue:T.()->E?) = create(this,serializeValue) inline fun <reified E:Any> create(name:String, crossinline serializeValue:T.()->E?) = object : Item<T, E>(name) { override fun ClassSerialDescriptorBuilder.buildElement() { element<E>(name) } override fun CompositeDecoder.deserialize(descriptor:SerialDescriptor, index:Int) = decodeSerializableElement(descriptor,index,serializer<E>()) override fun CompositeEncoder.serialize(descriptor: SerialDescriptor, index:Int, value:T){ serializeValue(value)?.let { encodeSerializableElement(descriptor,index, serializer<E>(),it) } } }.apply { items += this } val items = mutableListOf<Item<T,*>>() fun clearValue() = items.forEach { it._value = null } } final override fun deserialize(decoder: Decoder): T { var t:T? = null decoder.decodeStructure(descriptor){ desc.clearValue() while(true) { val index = decodeElementIndex(descriptor) if (index == CompositeDecoder.DECODE_DONE) break val item = desc.items.getOrNull(index) ?: error("unexpected index:$index") item.run { setValueByDeserialize(descriptor, index) } } t = desc.generate() desc.clearValue() } return t ?: error("deserialize failed") } final override fun serialize(encoder: Encoder, value: T) { encoder.encodeStructure(descriptor){ desc.items.forEachIndexed { index,it -> it.run { serialize(descriptor,index,value) } } } } abstract fun D.generate():T }
2894638479/fabric-blue-archive-halo
2,066
src/client/kotlin/name/bluearchivehalo/BlueArchiveHaloClient.kt
package name.bluearchivehalo import net.fabricmc.api.ClientModInitializer import net.fabricmc.fabric.impl.client.rendering.BlockEntityRendererRegistryImpl import net.fabricmc.loader.api.FabricLoader import net.minecraft.block.entity.BeaconBlockEntity import net.minecraft.block.entity.BlockEntityType import net.minecraft.client.render.* import net.minecraft.client.render.RenderLayer.MultiPhase import net.minecraft.client.render.RenderLayer.MultiPhaseParameters import net.minecraft.client.render.VertexFormat.DrawMode import net.minecraft.util.Identifier import java.util.* object BlueArchiveHaloClient : ClientModInitializer { val id = "blue-archive-halo" var shrinker:((BeaconBlockEntity) -> Int)? = null private set override fun onInitializeClient() { BlockEntityRendererRegistryImpl.register( BlockEntityType.BEACON, ::BeaconHaloRenderer ) val shrinkers = FabricLoader.getInstance().getEntrypoints("blue_archive_halo_beacon_level_shrinker",Function1::class.java) shrinkers.firstOrNull()?.let { shrinker = it as ((BeaconBlockEntity) -> Int) } } val texture = Identifier(id,"textures/pure_white.png") fun MultiPhase.modifyMultiPhase ( name: String?, vertexFormat: VertexFormat?, drawMode: DrawMode?, expectedBufferSize: Int, hasCrumbling: Boolean, translucent: Boolean, phases: MultiPhaseParameters ) { if (name != "beacon_beam") return if (phases.texture.id.get() != texture) return affectedOutline = Optional.empty() this.phases = MultiPhaseParameters.Builder() .cull(RenderPhase.ENABLE_CULLING) .lightmap(RenderPhase.DISABLE_LIGHTMAP) .program(RenderPhase.ShaderProgram { GameRenderer.getRenderTypeBeaconBeamProgram() }) .texture(phases.texture) .transparency(RenderPhase.TRANSLUCENT_TRANSPARENCY) .build(false) this.vertexFormat = VertexFormats.POSITION_COLOR this.drawMode = DrawMode.TRIANGLE_STRIP beginAction = Runnable { this.phases.phases.forEach(RenderPhase::startDrawing) } endAction = Runnable { this.phases.phases.forEach(RenderPhase::endDrawing) } } }
2891954521/LiteLoaderQQNT-OneBotApi-JS
3,015
src/network/wsReverseServer.js
const WebSocket = require('../lib/websocket'); const { Log } = require("../logger"); const { Reporter, Data} = require('../main/core'); const { oneBot11API} = require('../oneBot11/oneBot11') class WebSocketClient{ constructor(name, handleMsg, role){ this.ws = null; this.error = null; this.isOpen = false; this.name = name; this.role = role; this.handleMsg = handleMsg; } openSocket(url){ try{ this.ws = new WebSocket(url, { headers: { 'X-Self-ID': Data.selfInfo.uin, 'X-Client-Role': this.role } }); this.ws.on('open', () => { Log.i(`${this.name} is connected`); this.error = null; this.isOpen = true; if(this.handleMsg) this.ws.on('message', (data) => handle(this.ws, data)); }); this.ws.on('error', (e) => { Log.e(e.stack); this.error = e.stack; this.isOpen = false; }); this.ws.on('close', (code) => { if(code != 1000){ Log.w(`${this.name} was closed with code ${code}`); this.error = '连接意外关闭'; } this.ws = null; this.isOpen = false; }); }catch(e){ Log.e(e.stack); this.error = e.stack; } } stopSocket(){ if(this.ws && this.isOpen) this.ws.close(); this.ws = null; this.error = null; this.isOpen = false; } } let wss = new WebSocketClient('ws', true, 'Universal'); let api = new WebSocketClient('api', false, 'API'); let event = new WebSocketClient('event', true, 'Event'); function handle(ws, data){ try{ let params = JSON.parse(data); const handler = oneBot11API[params?.action]; if(handler){ new Promise(async(resolve) => { resolve(await handler(params.params || {})) }).then((result) => { result.echo = params.echo; ws.send(JSON.stringify(result)); }, (err) => { Log.e(err.stack); }); }else{ ws.send(`{"status": "failed", "retcode": 1404, "data": null, "echo": "${params.echo}"}`) } }catch(e){ Log.e(e.stack); } } function report(data){ try{ wss.ws?.send(data); event.ws?.send(data); }catch(e){ Log.e(e.stack); } } function startWsClient(params){ Log.i(`Starting WebSocket Client.`); if(params.url && !wss.ws) wss.openSocket(params.url); if(params.apiUrl && !api.ws) api.openSocket(params.apiUrl); if(params.eventUrl && !event.ws) event.openSocket(params.eventUrl); if(wss.ws || event.ws) Reporter.webSocketReverseReporter = report; } function restartWsClient(params){ Log.i(`Restarting WebSocket Client.`); stopWsClient(); startWsClient(params); } function stopWsClient(){ Log.i(`Stopping WebSocket Client.`); Reporter.webSocketReverseReporter = null; wss.stopSocket(); api.stopSocket(); event.stopSocket(); } module.exports = { getStatus: () => { return { "wss": { status: wss.ws != null && wss.error == null, msg: wss.error }, "api": { status: api.ws != null && api.error == null, msg: api.error }, "event": { status: event.ws != null && event.error == null, msg: event.error } } }, startWsClient, restartWsClient, stopWsClient }
2881099/FreeScheduler
3,703
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/colorpicker/bootstrap-colorpicker.min.css
/*! * Bootstrap Colorpicker * http://mjolnic.github.io/bootstrap-colorpicker/ * * Originally written by (c) 2012 Stefan Petre * Licensed under the Apache License v2.0 * http://www.apache.org/licenses/LICENSE-2.0.txt * */.colorpicker-saturation{float:left;width:100px;height:100px;cursor:crosshair;background-image:url("img/saturation.png")}.colorpicker-saturation i{position:absolute;top:0;left:0;display:block;width:5px;height:5px;margin:-4px 0 0 -4px;border:1px solid #000;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.colorpicker-saturation i b{display:block;width:5px;height:5px;border:1px solid #fff;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.colorpicker-hue,.colorpicker-alpha{float:left;width:15px;height:100px;margin-bottom:4px;margin-left:4px;cursor:row-resize}.colorpicker-hue i,.colorpicker-alpha i{position:absolute;top:0;left:0;display:block;width:100%;height:1px;margin-top:-1px;background:#000;border-top:1px solid #fff}.colorpicker-hue{background-image:url("img/hue.png")}.colorpicker-alpha{display:none;background-image:url("img/alpha.png")}.colorpicker-saturation,.colorpicker-hue,.colorpicker-alpha{background-size:contain}.colorpicker{top:0;left:0;z-index:2500;min-width:130px;padding:4px;margin-top:1px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*zoom:1}.colorpicker:before,.colorpicker:after{display:table;line-height:0;content:""}.colorpicker:after{clear:both}.colorpicker:before{position:absolute;top:-7px;left:6px;display:inline-block;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-left:7px solid transparent;border-bottom-color:rgba(0,0,0,0.2);content:''}.colorpicker:after{position:absolute;top:-6px;left:7px;display:inline-block;border-right:6px solid transparent;border-bottom:6px solid #fff;border-left:6px solid transparent;content:''}.colorpicker div{position:relative}.colorpicker.colorpicker-with-alpha{min-width:140px}.colorpicker.colorpicker-with-alpha .colorpicker-alpha{display:block}.colorpicker-color{height:10px;margin-top:5px;clear:both;background-image:url("img/alpha.png");background-position:0 100%}.colorpicker-color div{height:10px}.colorpicker-selectors{display:none;height:10px;margin-top:5px;clear:both}.colorpicker-selectors i{float:left;width:10px;height:10px;cursor:pointer}.colorpicker-selectors i+i{margin-left:3px}.colorpicker-element .input-group-addon i,.colorpicker-element .add-on i{display:inline-block;width:16px;height:16px;vertical-align:text-top;cursor:pointer}.colorpicker.colorpicker-inline{position:relative;z-index:auto;display:inline-block;float:none}.colorpicker.colorpicker-horizontal{width:110px;height:auto;min-width:110px}.colorpicker.colorpicker-horizontal .colorpicker-saturation{margin-bottom:4px}.colorpicker.colorpicker-horizontal .colorpicker-color{width:100px}.colorpicker.colorpicker-horizontal .colorpicker-hue,.colorpicker.colorpicker-horizontal .colorpicker-alpha{float:left;width:100px;height:15px;margin-bottom:4px;margin-left:0;cursor:col-resize}.colorpicker.colorpicker-horizontal .colorpicker-hue i,.colorpicker.colorpicker-horizontal .colorpicker-alpha i{position:absolute;top:0;left:0;display:block;width:1px;height:15px;margin-top:0;background:#fff;border:0}.colorpicker.colorpicker-horizontal .colorpicker-hue{background-image:url("img/hue-horizontal.png")}.colorpicker.colorpicker-horizontal .colorpicker-alpha{background-image:url("img/alpha-horizontal.png")}.colorpicker.colorpicker-hidden{display:none}.colorpicker.colorpicker-visible{display:block}.colorpicker-inline.colorpicker-visible{display:inline-block}.colorpicker-right:before{right:6px;left:auto}.colorpicker-right:after{right:7px;left:auto}
2891954521/LiteLoaderQQNT-OneBotApi-JS
6,706
src/oneBot11/oneBot11.js
const Api = require("./api"); const MessageModel = require("./messageModel"); const { Data } = require("../main/core"); const { QQNtAPI } = require('../qqnt/QQNtAPI'); const { createPeer, parseFromQQNT } = require("./message"); const oneBot11API = { /** * 获取用户信息 * */ '__getUserByUid': async (postData) => { try{ return await QQNtAPI.getUserInfoByUid(postData['uid']); }catch(e){ return e.stack.toString(); } }, '__sendMsg': async (postData) => { return { status: 'ok', retcode: 0, data: await QQNtAPI.ntCall("ns-ntApi", "nodeIKernelMsgService/sendMsg", [{ msgId: "0", peer: postData.peer, msgElements: postData.elements, msgAttributeInfos: new Map() }, null]) } }, /** * 发送消息 * { * "user_id" or "group_id": 123456, * "message": "test" * } * or * { * "user_id" or "group_id": 123456, * "message": [ * "type": "text", * "data": [ * "text": "test" * ] * ] * } */ 'send_msg': async (postData) => { let response = await MessageModel.sendMessage(postData); if(response?.msg){ response.status = 'failed'; response.retcode = 400; }else{ response.status = 'ok'; response.retcode = 0; } return response; }, /** * 发送私聊消息 * { * "user_id": 123456, * "message": "test" * } * or * { * "user_id": 123456, * "message": [ * "type": "text", * "data": [ * "text": "test" * ] * ] * } */ 'send_private_msg': async (postData) => { let response = await MessageModel.sendMessage(postData); if(response?.msg){ response.status = 'failed'; response.retcode = 400; }else{ response.status = 'ok'; response.retcode = 0; } return response; }, /** * 发送群消息 * { * "group_id": 123456, * "message": "test" * } * or * { * "group_id": 123456, * "message": [ * "type": "text", * "data": [ * "text": "test" * ] * ] * } */ 'send_group_msg': async (postData) => { let response = await MessageModel.sendMessage(postData); if(response?.msg){ response.status = 'failed'; response.retcode = 400; }else{ response.status = 'ok'; response.retcode = 0; } return response; }, /** * 下载私聊文件 * { * "user_id": 123456, * "msgId": e.g. 7310952964011716631, * "elementId": e.g. 7311516200489877813 * "downloadPath" (可选): "C:/tmp/fileName" * } */ 'download_file': (postData) => { let userInfo = Data.getInfoByQQ(postData['user_id']); if(userInfo == null){ return { code: 400, msg: `User with QQ ${postData['user_id']} not found.` } } if(!postData["msgId"] || !postData['elementId']){ return { code: 400, msg: "Must provide 'msgId' and 'elementId'." } } QQNtAPI.ntCall("ns-ntApi", "nodeIKernelMsgService/downloadRichMedia",[ { "getReq": { "msgId": postData['msgId'], "chatType": 1, "peerUid": userInfo.uid, "elementId": postData['elementId'], "thumbSize": 0, "downloadType": 1, "filePath": postData['downloadPath'] || "" } } ]).then(); return { status: 'ok', retcode: 0, } }, /** * 撤回消息 */ 'delete_msg': async(postData) => { let peer = null; let msg = Data.historyMessage.get(postData.message_id); if(msg){ peer = { chatType: msg.chatType, peerUid: msg.peerUid, guildId: '' } }else{ let peer = createPeer(postData.group_id, postData.user_id); if(!peer){ return { status: 'failed', retcode: 400, msg: "消息不存在" } } } let result = await QQNtAPI.ntCall( "ns-ntApi", "nodeIKernelMsgService/recallMsg", [{ peer, "msgIds": [ postData.message_id.toString() ] }, null]); if(result.result == 0){ return { status: 'ok', retcode: 0, } }else{ return { status: 'failed', retcode: result.result, msg: result.errMsg, } } }, /** * 获取消息 */ 'get_msg': async(postData) => { if(!postData.message_id){ return { status: 'failed', "retcode": 400, msg: "Must provide 'message_id'." } } let oneBotMsg = Data.historyMessage.get(postData.message_id)?.oneBotMsg; if(oneBotMsg){ return { status: 'ok', retcode: 0, data: { message: oneBotMsg.message } } }else{ return { status: 'failed', retcode: 404, msg: `消息不存在, Can't find message with id: ${postData.message_id}`, } } }, /** * 获取合并转发的消息 */ 'get_forward_msg': async(postData) => { if(!postData.id){ return { status: 'failed', "retcode": 400, msg: "Must provide 'id' (msgId)." } } let peer; let msg = Data.historyMessage.get(postData.id); if(msg){ peer = { chatType: msg.chatType, peerUid: msg.peerUid, guildId: '' } }else{ peer = createPeer(postData.group_id, postData.user_id); if(!peer){ return { status: 'failed', retcode: 400, msg: "消息不存在" } } } let forwardMsg = []; let messages = await QQNtAPI.getMultiMessages(peer, postData.id); for(let message of messages){ let content = []; for(let element of message.elements){ content.push(await parseFromQQNT(message, element)); } forwardMsg.push({ "type": "node", "data": { "user_id": message.senderUid, "content": content } }) } return { status: 'ok', retcode: 0, data: { 'message': forwardMsg } }; }, /** * 获取登录号信息 */ 'get_login_info': () => { return { status: 'ok', retcode: 0, data: { 'user_id': Data.selfInfo.account } }; }, /** * 处理加好友请求 * { * "flag": 加好友请求的 flag(需从上报的数据中获得) * "approve": 是否同意请求(true/false) * } */ 'set_friend_add_request': async (postData) => { if('flag' in postData && 'approve' in postData){ return { status: 'ok', retcode: 0, data: await QQNtAPI.ntCall( "ns-ntApi", "nodeIKernelBuddyService/approvalFriendRequest", [{ "approvalInfo":{ "friendUid": postData["flag"], "accept": postData['approve'] } }, null] ) }; }else{ return { status: 'failed', retcode: 400, msg: "Must provide 'flag' and 'approve'." } } }, // set_group_anonymous_ban 群组匿名用户禁言 // set_group_anonymous 群组匿名 // set_group_card 设置群名片(群备注) // set_group_special_title 设置群组专属头衔 // set_group_add_request 处理加群请求/邀请 // get_stranger_info 获取陌生人信息 // get_group_honor_info 获取群荣誉信息 // get_record 获取语音 // get_image 获取图片 // can_send_image 检查是否可以发送图片 // can_send_record 检查是否可以发送语音 // get_status 获取运行状态 // get_version_info 获取版本信息 // set_restart 重启 OneBot 实现 // clean_cache 清理缓存 } for(let item of Api.api){ oneBot11API[item.url] = item.handle } module.exports = { oneBot11API }
2891954521/LiteLoaderQQNT-OneBotApi-JS
13,557
src/oneBot11/api.js
const {Data} = require("../main/core"); const {Text, createOneBot} = require("./message"); const Event = require("./event"); const {QQNtAPI} = require("../qqnt/QQNtAPI"); const {Log} = require("../logger"); const OneBotOK = { status: "ok", retcode: 0 }; function OneBotFail(code, data = ""){ return { status: 'fail', retcode: code, data: data }; } class BaseApi{ constructor(url){ this.url = url; } async handle(postData){ return OneBotOK; } } class NtCall extends BaseApi{ constructor(){ super("__ntCall") } async handle(postData){ return { code: 200, msg: "OK", data: await QQNtAPI.ntCall(postData['eventName'], postData['cmdName'], postData['args'], postData['webContentsId'] || '2') }; } } class NtCallAsync extends BaseApi{ constructor(){ super("__ntCallAsync") } async handle(postData){ return { code: 200, msg: "OK", data: await QQNtAPI.ntCallAsync( postData['eventName'], postData['cmdName'], postData['args'], postData['callBackCmdName'], () => {return true}, false, postData['webContentsId'] || '2' ) }; } } /** * 获取好友列表<br> * result: * user_id: QQ号, * nickname: 昵称, * remark: 备注 */ class GetFriendList extends BaseApi { constructor(){ super("get_friend_list") } async handle(postData){ return { status: 'ok', retcode: 0, data: Object.values(Data.friends).map(friend => { return { user_id: friend.uin, nickname: friend.nick, remark: friend.remark } }) }; } } class SendLike extends BaseApi{ constructor(){ super("send_like") } async handle(postData){ let user = Data.getInfoByQQ(postData.user_id); if(user == null) return OneBotFail(404, "好友不存在"); let result = (await QQNtAPI.ntCall( "ns-ntApi", "nodeIKernelProfileLikeService/setBuddyProfileLike", [{ "doLikeUserInfo":{ "friendUid": user.uid, "sourceId": 71, "doLikeCount": postData.times || 1, "doLikeTollCount": 0 } }, null] )) if(result.succCounts > 0) return OneBotOK; else return OneBotFail(500, "今日点赞次数已达上限"); } } /** * 获取群信息 * { "group_id": 123456 } * * result: * { * code: 200, * msg: "OK", * data: { * group_id: 群号, * group_name: 群名称, * member_count: 成员数, * max_member_count: 最大成员数(群容量) * } * } */ class GetGroupInfo extends BaseApi{ constructor(){ super("get_group_info") } async handle(postData){ const group = Data.groups[postData.group_id] return { status: 'ok', retcode: 0, data: { 'group_id': group.groupCode, 'group_name': group.groupName, 'member_count': group.memberCount, 'max_member_count': group.maxMember, } }; } } /** * 获取群成员列表 * { "group_id": 123456 } * * result: * { * code: 200, * msg: "OK", * data: [ * * ] */ class GetGroupMemberList extends BaseApi{ constructor(){ super("get_group_member_list") } async handle(postData){ let members = await Data.getGroupMemberList(postData.group_id, (postData?.no_cache || false)); return { status: 'ok', retcode: 0, data: members.map((member) => { return { group_id: postData.group_id,// 群号 user_id: member.uin, // QQ 号 nickname: member.nick, // 昵称 card: member.cardName, // 群名片/备注 role: member.role == 4 ? 'owner' : (member.role == 3 ? 'admin' : (member.role == 2 ? 'member' : 'unknown')), // 角色,owner 或 admin 或 member }}) }; } } class GetGroupMemberInfo extends BaseApi{ constructor(){ super("get_group_member_info") } async handle(postData){ let member = await Data.getGroupMemberByQQ(postData.group_id, postData.user_id, false); if(!member) return OneBotFail(404, "用户在群聊中不存在"); let info = await Data.getGroupMemberInfo(postData.group_id, postData.user_id, false); member.info = info return { status: 'ok', retcode: 0, data: { group_id: postData.group_id,// 群号 user_id: member.uin, // QQ 号 nickname: member.nick, // 昵称 card: member.cardName, // 群名片/备注 level: member.memberRealLevel, // 群等级 role: member.role == 4 ? 'owner' : (member.role == 3 ? 'admin' : (member.role == 2 ? 'member' : 'unknown')), // 角色,owner 或 admin 或 member sex: info?.sex == 1 ? "male" : (info?.sex == 2 ? "female" : "unknown"), age: new Date().getFullYear() - info?.birthday_year, area: `${info?.country} ${info?.province} ${info?.city}`, raw: member } } } } /** * 获取群列表 * result: * { * code: 200, * msg: "OK", * data: [ * { * group_id: 群号, * group_name: 群名称, * member_count: 成员数, * max_member_count: 最大成员数(群容量) * }, * ... * ] * } */ class getGroupList extends BaseApi{ constructor(){ super("get_group_list") } async handle(postData){ return { status: 'ok', retcode: 0, data: Object.values(Data.groups).map(group => { return{ 'group_id': group.groupCode, 'group_name': group.groupName, 'member_count': group.memberCount, 'max_member_count': group.maxMember, } }) }; } } class getGroupMsgMask extends BaseApi{ constructor(){ super("get_group_msg_mask") } async handle(postData){ const type = { 1: "接收并提醒", 2: "收入群助手且不提醒", 3: "屏蔽消息", 4: "接受消息但不提醒", } const groups = Data.groups return { status: 'ok', retcode: 0, data: (await QQNtAPI.ntCallAsync("ns-ntApi", "nodeIKernelGroupService/getGroupMsgMask", [null, null], "nodeIKernelGroupListener/onGroupsMsgMaskResult", () => { return true }, false, '3' )).payload.groupsMsgMask.map(group => { return { 'group_id': group.groupCode, 'group_name': groups[group.groupCode].groupName, 'msg_mask': group.msgMask, 'msg_type': type[group.msgMask], } }) }; } } class KickMember extends BaseApi{ constructor(){ super("set_group_kick") } async handle(postData){ let group = Data.getGroupById(postData.group_id); if(group == null) return OneBotFail(404, '群不存在'); let user = await Data.getGroupMemberByQQ(postData.group_id, postData.user_id); if(user == null) return OneBotFail(404, "群成员不存在"); let result = (await QQNtAPI.ntCall( "ns-ntApi", "nodeIKernelGroupService/kickMember", [{ "groupCode": group.groupCode, "kickUids":[ user.uid ], "refuseForever": !!postData.reject_add_request, "kickReason": "" }, null] )) if(result.errCode == 0) return OneBotOK; else return OneBotFail(result.errCode); } } class setGroupAdmin extends BaseApi{ constructor(){ super("set_group_admin") } async handle(postData){ let group = Data.getGroupById(postData.group_id); if(group == null) return OneBotFail(404, "群不存在"); let user = await Data.getGroupMemberByQQ(postData.group_id, postData.user_id); if(user == null) return OneBotFail(404, "群成员不存在"); let result = (await QQNtAPI.ntCall( "ns-ntApi", "nodeIKernelGroupService/modifyMemberRole", [{ "groupCode": group.groupCode, "uid": user.uid, "role": !!postData.enable ? 3 : 2, }, null] )) if(result.result == 0) return OneBotOK; else return OneBotFail(result.result, result.errMsg); } } class setGroupBan extends BaseApi{ constructor(){ super("set_group_ban") } async handle(postData){ let group = Data.getGroupById(postData.group_id); if(group == null) return OneBotFail(404, '群不存在'); let user = await Data.getGroupMemberByQQ(postData.group_id, postData.user_id); if(user == null) return OneBotFail(404, "群成员不存在"); let result = (await QQNtAPI.ntCall( "ns-ntApi", "nodeIKernelGroupService/setMemberShutUp", [{ groupCode: group.groupCode, memList: [{ uid: user.uid, timeStamp: postData.duration | 0 }] }, null] )) if(result.result == 0) return OneBotOK; else return OneBotFail(500, result); } } class setGroupWholeBan extends BaseApi{ constructor(){ super("set_group_whole_ban") } async handle(postData){ let group = Data.getGroupById(postData.group_id); if(group == null) return OneBotFail(404, '群不存在'); let result = (await QQNtAPI.ntCall( "ns-ntApi", "nodeIKernelGroupService/setGroupShutUp", [{ "groupCode": group.groupCode, "shutUp": !!postData.enable }, null] )) if(result.result == 0) return OneBotOK; else return OneBotFail(500, result); } } class setGroupName extends BaseApi{ constructor(){ super("set_group_name") } async handle(postData){ let group = Data.getGroupById(postData.group_id); if(group == null) return OneBotFail(404, '群不存在'); if(postData.group_name == null || group.group_name == ""){ return { status: 'fail', retcode: 500, data: '群名称不能为空' }; } let result = (await QQNtAPI.ntCall( "ns-ntApi", "nodeIKernelGroupService/modifyGroupName", [{ groupCode: group.groupCode, groupName: postData.group_name, }, null] )) if(result.result == 0) return OneBotOK; else return OneBotFail(500, result); } } class setGroupSpecialTitle extends BaseApi{ constructor(){ super("set_group_special_title") } async handle(postData){ let group = Data.getGroupById(postData.group_id); if(group == null) return OneBotFail(404, '群不存在'); let user = await Data.getGroupMemberByQQ(postData.group_id, postData.user_id); if(user == null) return OneBotFail(404, '群成员不存在'); // {"errCode":0,"errMsg":"success","resultList":[{"uid":"u_uMoA","result":0}]} return OneBotFail(404); } } class setGroupCard extends BaseApi{ constructor(){ super("set_group_card") } async handle(postData){ let group = Data.getGroupById(postData.group_id); if(group == null) return OneBotFail(404, '群不存在'); let user = await Data.getGroupMemberByQQ(postData.group_id, postData.user_id); if(user == null) return OneBotFail(404, '群成员不存在'); let result = (await QQNtAPI.ntCall( "ns-ntApi", "nodeIKernelGroupService/modifyMemberCardName", [{ "groupCode": group.groupCode, "uid": user.uid, "cardName": postData.card || '' }, null] )) if(result.result == 0) return OneBotOK; else return OneBotFail(result.result); } } class setGroupLeave extends BaseApi{ constructor(){ super("set_group_leave") } async handle(postData){ let group = Data.getGroupById(postData.group_id); if(group == null) return OneBotFail(404, '群不存在'); let result = (await QQNtAPI.ntCall( "ns-ntApi", "nodeIKernelGroupService/quitGroup", [{ "groupCode": group.groupCode }, null] )) if(result.errCode == 0) return OneBotOK; else return OneBotFail(result.errCode); } } class SetGroupAddRequest extends BaseApi{ constructor(){ super("set_group_add_request") } async handle(postData){ if(!('flag' in postData)) return OneBotFail(400, "Must provide 'flag'"); return { status: 'ok', retcode: 0, data: await QQNtAPI.ntCall( "ns-ntApi", "nodeIKernelGroupService/operateSysNotify", [{ doubt: false, operateMsg: { operateType: postData.approve ? 1 : 2, targetMsg: { seq: postData.flag, // 通知序列号 type: postData.type || postData.sub_type, // groupCode: notify.group.groupCode, postscript: postData.reason, }, } }, null] ) }; } } /** * 获取频道系统内BOT的资料 */ class getGuildProfile extends BaseApi{ constructor(){ super('get_guild_service_profile'); } async handle(postData){ let data = await QQNtAPI.ntCall("ns-GuildInitApi", "ensureLoginInfo", []) Data.guildInfo.tiny_id = data.tinyId; return { status: 'ok', retcode: 0, data: Data.guildInfo }; } } /** * 获取频道列表 */ class getGuildList extends BaseApi{ constructor(){ super('get_guild_list'); } async handle(postData){ Data.guilds = await QQNtAPI.getGuildList(); return { status: 'ok', retcode: 0, data: Object.values(Data.guilds) } } } /** * 发送信息到子频道 */ class SendGuildMsg extends BaseApi{ constructor(){ super('send_guild_channel_msg'); } async handle(postData){ let guild = Data.guilds[postData.guild_id]; if(!guild && guild.channel_list.includes(postData.channel_id)){ return { status: 'failed', retcode: 404, msg: `找不到频道 (${postData.guild_id}/${postData.channel_id})` } } let peer = { chatType: 4, peerUid: postData.channel_id, guildId: postData.guild_id } let message; if(postData.message.constructor === String){ message = [ new Text(postData.message) ] }else{ message = [] for(let item of postData.message){ message.push(await createOneBot(item, postData.group_id)) } } let oneBotMsg = new Event.MessageEvent(0, "", postData.user_id, message) let qqNtMsg = await QQNtAPI.sendMessage(peer, oneBotMsg.message.map((item) => item.toQQNT())); oneBotMsg.time = parseInt(qqNtMsg?.msgTime || 0); oneBotMsg.message_id = qqNtMsg.msgId; oneBotMsg.message_type = "guild"; oneBotMsg.sub_type = "message"; oneBotMsg.guild_id = qqNtMsg.guildId; oneBotMsg.channel_id = qqNtMsg.channelId; Log.i(`发送频道 (${postData.guildId}/${qqNtMsg.channelId}) 消息:${oneBotMsg.raw_message}`); Data.pushHistoryMessage(qqNtMsg, oneBotMsg); return { status: 'ok', retcode: 0, data: { message_id: qqNtMsg.msgId } }; } } module.exports = { api: [ new BaseApi(''), new NtCall(), new NtCallAsync(), new GetFriendList(), new SendLike(), new GetGroupInfo(), new GetGroupMemberList(), new GetGroupMemberInfo(), new getGroupList(), new getGroupMsgMask(), new KickMember(), new setGroupAdmin(), new setGroupBan(), new setGroupWholeBan(), new setGroupName(), new setGroupCard(), new setGroupLeave(), new SendGuildMsg(), new getGuildList(), new getGuildProfile() ] }
2894638479/fabric-blue-archive-halo
8,957
src/client/kotlin/name/bluearchivehalo/BeaconHaloRenderer.kt
package name.bluearchivehalo import name.bluearchivehalo.BeaconHaloRenderer.Companion.ArgbFloat.Companion.white import name.bluearchivehalo.BlueArchiveHaloClient.texture import name.bluearchivehalo.config.Config import name.bluearchivehalo.config.LevelConfig import name.bluearchivehalo.config.RingStyle import name.bluearchivehalo.config.RingStyle.Companion.FLAT import name.bluearchivehalo.config.RingStyle.Companion.PULSE import name.bluearchivehalo.config.RingStyle.Companion.SPACING import name.bluearchivehalo.config.RingStyle.Companion.STATIC import net.minecraft.block.Blocks import net.minecraft.block.entity.BeaconBlockEntity import net.minecraft.client.MinecraftClient import net.minecraft.client.render.* import net.minecraft.client.render.block.entity.BeaconBlockEntityRenderer import net.minecraft.client.render.block.entity.BlockEntityRendererFactory import net.minecraft.client.util.math.MatrixStack import net.minecraft.util.math.RotationAxis import net.minecraft.util.math.Vec3d import net.minecraft.util.math.random.LocalRandom import org.joml.Matrix4f import kotlin.math.* class BeaconHaloRenderer(ctx: BlockEntityRendererFactory.Context?) : BeaconBlockEntityRenderer(ctx) { override fun render( entity: BeaconBlockEntity, tickDelta: Float, matrices: MatrixStack, vertexConsumers: VertexConsumerProvider, light: Int, overlay: Int ) { val segments = entity.beamSegments.ifEmpty { return } val world = entity.world ?: return val rand = LocalRandom(seed(entity)) fun ring(r:Float,cycleTicks:Int,color:ArgbFloat,height:Float,thickness:Float,style: RingStyle){ val rotation = run { if(cycleTicks == 0) 0.0 else { val abs = cycleTicks.absoluteValue val mod = world.time % cycleTicks + tickDelta val rad = mod / abs * 2 * PI if(cycleTicks > 0) rad else 2*PI - rad } }.toFloat() val angleCount = run { val cameraPos = MinecraftClient.getInstance().gameRenderer.camera.pos val entityPos = entity.pos.toCenterPos() val distance = entityPos.add(0.0,height.toDouble(),0.0).distanceTo(cameraPos) if(distance <= (height + r)) r.toInt() else max(10,((height + r)*r / distance).toInt()) } val colorBy0to1:(Double)-> ArgbFloat = when(style){ PULSE -> { val baseAlpha = Config.instance.baseAlpha.get val pulseTail = Config.instance.pulseTail.get val b = (1-baseAlpha)/pulseTail { val pulseAlpha = if(cycleTicks<0) 1-b*(1-it) else 1-b*it val alpha = max(Config.instance.baseAlpha.get,pulseAlpha.toFloat()) color.alpha(alpha) } } SPACING -> { val spaceCount = Config.instance.spacingCount.get val alpha1 = Config.instance.spacingMidAlpha.get val alpha2 = Config.instance.spacingAlpha.get { val bl = ((it*spaceCount*2).toInt() % 2) != 0 color.alpha(if(bl) alpha2 else alpha1) } } FLAT -> { color.alpha(Config.instance.baseAlpha.get).run{{this}} } STATIC -> {{color}} else -> return } matrices.stack { matrices.translate(0.5, rand.nextDouble() + height, 0.5) matrices.multiply(RotationAxis.POSITIVE_Y.rotation(rotation)) renderHorizontalCircleRing(matrices, vertexConsumers, r,thickness,angleCount,colorBy0to1) } } val levelShrink = entity.levelShrink fun color(index:Int):ArgbFloat{ var sum = 0 val mixWhite = Config.instance.mixWhite.get segments.forEach { sum += it.height if(sum > (index + levelShrink)) return ArgbFloat(it.color).mix(white,mixWhite) } return ArgbFloat(segments.last().color).mix(white,mixWhite) } val renderLevel = entity.level - levelShrink if (renderLevel > 0){ val conf = Config.instance.levels.get[renderLevel] ?: LevelConfig(renderLevel) conf.rings.get.forEach { val colorFrom = (conf.size - it.ringIndex)*conf.colorSpacing.get ring(it.radius.get,it.rotateCycle.get,color(colorFrom),conf.height.get,it.width.get,it.style.get) } } super.render(entity, tickDelta, matrices, vertexConsumers, light, overlay) } override fun getRenderDistance() = Int.MAX_VALUE override fun isInRenderDistance(beaconBlockEntity: BeaconBlockEntity?, vec3d: Vec3d?): Boolean { return beaconBlockEntity?.isRemoved == false } companion object { inline fun MatrixStack.stack(block:()->Unit){ push();block();pop() } val BeaconBlockEntity.levelShrink : Int get() { BlueArchiveHaloClient.shrinker?.let { return it(this) } var shrink = 0 val world = world ?: return 0 val pos = pos ?: return 0 val level = level while(shrink < level){ val block = world.getBlockState(pos.add(0,shrink + 1,0)) val shrinkLevel = block.isOf(Blocks.GLASS) || block.isOf(Blocks.GLASS_PANE) if(shrinkLevel) shrink++ else break } return shrink } fun seed(entity: BeaconBlockEntity) = entity.level * 9439L + entity.pos.run { (x*31+y)*31+z } class ArgbFloat(val a:Float,val r:Float,val g:Float,val b:Float){ constructor(arr:FloatArray):this(1f,arr[0],arr[1],arr[2]) companion object { val white = ArgbFloat(1f,1f,1f,1f) } fun toInt():Int{ val alpha = (a * 255).toInt() shl 24 val red = (r * 255).toInt() shl 16 val green = (g * 255).toInt() shl 8 val blue = (b * 255).toInt() return alpha or red or green or blue } operator fun times(other:ArgbFloat) = ArgbFloat(a*other.a,r*other.r,g*other.g,b*other.b) fun alpha(alpha:Float) = ArgbFloat(alpha * a, r, g, b) fun mix(other:ArgbFloat,rate:Float):ArgbFloat{ if(rate <= 0) return this if(rate >= 1) return other val thisRate = 1 - rate return ArgbFloat(a*thisRate+other.a*rate,r*thisRate+other.r*rate,g*thisRate+other.g*rate,b*thisRate+other.b*rate) } } class AngleInfo( val cos:Float,val sin:Float,val color:Int ){ class Scope(val consumer: VertexConsumer,val modelMatrix: Matrix4f){ fun AngleInfo.vertex(radius:Float,y:Float = 0f) = vertex(consumer,modelMatrix,radius,y) fun AngleInfo.vertex2(radius:Float,y:Float = 0f) = repeat(2) { vertex(consumer, modelMatrix, radius, y) } } fun vertex(consumer: VertexConsumer,modelMatrix: Matrix4f,radius:Float,y:Float){ consumer.vertex(modelMatrix,radius*cos,y,radius*sin).color(color).next() } } fun renderHorizontalCircleRing( matrices: MatrixStack, consumerProvider: VertexConsumerProvider, radius: Float, thickness: Float, segmentCount:Int, colorBy0to1: (Double) -> ArgbFloat ) { val consumer = consumerProvider.getBuffer(RenderLayer.getBeaconBeam(texture,true)) val modelMatrix = matrices.peek().positionMatrix val radiusInner = radius - thickness/2 val radiusOuter = radius + thickness/2 val viewHeight = thickness * 2 / 3 val angles = (0..segmentCount).map { 2 * PI * it / segmentCount }.map { val cos = cos(it).toFloat() val sin = sin(it).toFloat() val color = colorBy0to1(it / (2*PI)).toInt() AngleInfo(cos,sin,color) } AngleInfo.Scope(consumer,modelMatrix).run { angles.firstOrNull()?.vertex2(radiusInner) angles.forEach { it.vertex(radiusInner) it.vertex(radiusOuter) } angles.forEach { it.vertex(radiusOuter) it.vertex(radius, viewHeight) } angles.forEach { it.vertex(radius, viewHeight) it.vertex(radiusInner) } angles.lastOrNull()?.vertex2(radiusInner) } } } }
2894638479/fabric-blue-archive-halo
1,233
src/client/kotlin/name/bluearchivehalo/screen/LevelChooseScreen.kt
package name.bluearchivehalo.screen import name.bluearchivehalo.config.LevelConfig.Companion.ringCount import net.minecraft.client.gui.screen.Screen import net.minecraft.client.gui.widget.ButtonWidget import net.minecraft.client.gui.widget.GridWidget import net.minecraft.client.gui.widget.SimplePositioningWidget import net.minecraft.text.Text class LevelChooseScreen(parent: Screen): MyScreen(Text.of("分等级设置"),parent) { override fun init() { val gridWidget = GridWidget() gridWidget.mainPositioner.marginX(5).marginBottom(4).alignHorizontalCenter() val adder = gridWidget.createAdder(2) for (level in 1..16){ val button = ButtonWidget.builder(Text.of("信标等级${level} 环数${ringCount(level)}")){ client?.setScreen(LevelConfigScreen(this,conf.getLevelConf(level))) }.build() if(level > 4) button tooltip "原版没有的等级,需要与其他服务端模组联动生效" adder.add(button) } adder.add(done,2, adder.copyPositioner().marginTop(6)) gridWidget.refreshPositions() SimplePositioningWidget.setPos(gridWidget, 0, height / 6 - 12,width,height, 0.5f, 0.0f) gridWidget.forEachChild(::addDrawableChild) super.init() } }
2881099/FreeScheduler
2,410
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/timepicker/bootstrap-timepicker.min.css
/*! * Timepicker Component for Twitter Bootstrap * * Copyright 2013 Joris de Wit * * Contributors https://github.com/jdewit/bootstrap-timepicker/graphs/contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */.bootstrap-timepicker{position:relative}.bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu{left:auto;right:0}.bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu:before{left:auto;right:12px}.bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu:after{left:auto;right:13px}.bootstrap-timepicker .add-on{cursor:pointer}.bootstrap-timepicker .add-on i{display:inline-block;width:16px;height:16px}.bootstrap-timepicker-widget.dropdown-menu{padding:2px 3px 2px 2px}.bootstrap-timepicker-widget.dropdown-menu.open{display:inline-block}.bootstrap-timepicker-widget.dropdown-menu:before{border-bottom:7px solid rgba(0,0,0,0.2);border-left:7px solid transparent;border-right:7px solid transparent;content:"";display:inline-block;left:9px;position:absolute;top:-7px}.bootstrap-timepicker-widget.dropdown-menu:after{border-bottom:6px solid #fff;border-left:6px solid transparent;border-right:6px solid transparent;content:"";display:inline-block;left:10px;position:absolute;top:-6px}.bootstrap-timepicker-widget a.btn,.bootstrap-timepicker-widget input{border-radius:4px}.bootstrap-timepicker-widget table{width:100%;margin:0}.bootstrap-timepicker-widget table td{text-align:center;height:30px;margin:0;padding:2px}.bootstrap-timepicker-widget table td:not(.separator){min-width:30px}.bootstrap-timepicker-widget table td span{width:100%}.bootstrap-timepicker-widget table td a{border:1px transparent solid;width:100%;display:inline-block;margin:0;padding:8px 0;outline:0;color:#333}.bootstrap-timepicker-widget table td a:hover{text-decoration:none;background-color:#eee;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;border-color:#ddd}.bootstrap-timepicker-widget table td a i{margin-top:2px}.bootstrap-timepicker-widget table td input{width:25px;margin:0;text-align:center}.bootstrap-timepicker-widget .modal-content{padding:4px}@media(min-width:767px){.bootstrap-timepicker-widget.modal{width:200px;margin-left:-100px}}@media(max-width:767px){.bootstrap-timepicker{width:100%}.bootstrap-timepicker .dropdown-menu{width:100%}}
2891954521/LiteLoaderQQNT-OneBotApi-JS
3,134
src/oneBot11/messageModel.js
/** * 消息处理模块 */ const { Log } = require('../logger'); const { QQNtAPI } = require('../qqnt/QQNtAPI'); const { Data, Setting, Reporter } = require('../main/core'); const { createPeer, createOneBot, Text} = require("./message"); const Event = require("./event") /** * 发送消息 * @param postData */ async function sendMessage(postData){ let peer = createPeer(postData.group_id, postData.user_id); if(!peer){ return { msg: postData.group_id ? `找不到群 (${postData.group_id})` : `找不到好友 (${postData.user_id})`} } let message; if(postData.message.constructor === String){ message = [ new Text(postData.message) ] }else{ message = [] for(let item of postData.message){ message.push(await createOneBot(item, postData.group_id)) } } let oneBotMsg = new Event.MessageEvent(0, "", postData.user_id, message) let qqNtMsg = await QQNtAPI.sendMessage(peer, oneBotMsg.message.map((item) => item.toQQNT())); oneBotMsg.time = parseInt(qqNtMsg?.msgTime || 0); oneBotMsg.message_id = qqNtMsg.msgId; if(postData.group_id){ oneBotMsg.message_type = "group"; oneBotMsg.sub_type = "normal"; oneBotMsg.group_id = postData.group_id; }else{ oneBotMsg.message_type = "private"; oneBotMsg.sub_type = "friend"; } if(postData.group_id) Log.i(`发送群 (${postData.group_id}) 消息:${oneBotMsg.raw_message}`); else Log.i(`发送好友 (${postData.user_id}) 消息:${oneBotMsg.raw_message}`); Data.pushHistoryMessage(qqNtMsg, oneBotMsg); return { data: { message_id: qqNtMsg.msgId } }; } /** * 处理新消息 */ async function handleNewMessage(messages){ for(/** @type QQNTMessage */ let message of messages){ let oneBotMsg = await Event.parseMessage(message) if(oneBotMsg){ switch(oneBotMsg.eventType){ case 1: Log.i(`收到好友 (${oneBotMsg.user_id}) 的消息:${oneBotMsg.raw_message}`); break; case 2: Log.i(`收到群 (${oneBotMsg.group_id}) 内 (${oneBotMsg.user_id}) 的消息:${oneBotMsg.raw_message}`); break; case 4: Log.i(`收到频道 (${oneBotMsg.guild_id}/${oneBotMsg.channel_id}) 内 (${oneBotMsg.tiny_id}) 的消息:${oneBotMsg.raw_message}`); break; } Data.pushHistoryMessage(message, oneBotMsg); if(oneBotMsg.user_id != oneBotMsg.self_id || Setting.setting.setting.reportSelfMsg){ Reporter.reportData(oneBotMsg); } }else{ Log.w(`解析消息失败, 消息内容: ${JSON.stringify(messages)}`) } } } async function recallMessage(message){ let recall = await Event.RecallMessage.parseFromQQNT(message) if(recall.group_id) Log.i(`群 (${recall.group_id}) 内 (${recall.user_id}) 撤回了一条消息`); else Log.i(`好友 (${recall.user_id}) 撤回了一条消息`); Reporter.reportData(recall); } /** * 发送通知上报 * @param {*} postData */ function postNoticeData(postData){ if(!postData.time) postData.time = 0; postData['self_id'] = Data.selfInfo.uin; postData['post_type'] = "notice"; Reporter.reportData(postData); } /** * 发送通知上报 * @param {*} postData */ function postRequestData(postData){ postData['time'] = 0; postData['self_id'] = Data.selfInfo.uin; postData['post_type'] = "request"; Reporter.reportData(postData); } module.exports = { sendMessage, handleNewMessage, recallMessage, postNoticeData, postRequestData, }
2881099/FreeScheduler
2,780
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/timepicker/bootstrap-timepicker.css
/*! * Timepicker Component for Twitter Bootstrap * * Copyright 2013 Joris de Wit * * Contributors https://github.com/jdewit/bootstrap-timepicker/graphs/contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ .bootstrap-timepicker { position: relative; } .bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu { left: auto; right: 0; } .bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu:before { left: auto; right: 12px; } .bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu:after { left: auto; right: 13px; } .bootstrap-timepicker .add-on { cursor: pointer; } .bootstrap-timepicker .add-on i { display: inline-block; width: 16px; height: 16px; } .bootstrap-timepicker-widget.dropdown-menu { padding: 2px 3px 2px 2px; } .bootstrap-timepicker-widget.dropdown-menu.open { display: inline-block; } .bootstrap-timepicker-widget.dropdown-menu:before { border-bottom: 7px solid rgba(0, 0, 0, 0.2); border-left: 7px solid transparent; border-right: 7px solid transparent; content: ""; display: inline-block; left: 9px; position: absolute; top: -7px; } .bootstrap-timepicker-widget.dropdown-menu:after { border-bottom: 6px solid #FFFFFF; border-left: 6px solid transparent; border-right: 6px solid transparent; content: ""; display: inline-block; left: 10px; position: absolute; top: -6px; } .bootstrap-timepicker-widget a.btn, .bootstrap-timepicker-widget input { border-radius: 4px; } .bootstrap-timepicker-widget table { width: 100%; margin: 0; } .bootstrap-timepicker-widget table td { text-align: center; height: 30px; margin: 0; padding: 2px; } .bootstrap-timepicker-widget table td:not(.separator) { min-width: 30px; } .bootstrap-timepicker-widget table td span { width: 100%; } .bootstrap-timepicker-widget table td a { border: 1px transparent solid; width: 100%; display: inline-block; margin: 0; padding: 8px 0; outline: 0; color: #333; } .bootstrap-timepicker-widget table td a:hover { text-decoration: none; background-color: #eee; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; border-color: #ddd; } .bootstrap-timepicker-widget table td a i { margin-top: 2px; } .bootstrap-timepicker-widget table td input { width: 25px; margin: 0; text-align: center; } .bootstrap-timepicker-widget .modal-content { padding: 4px; } @media (min-width: 767px) { .bootstrap-timepicker-widget.modal { width: 200px; margin-left: -100px; } } @media (max-width: 767px) { .bootstrap-timepicker { width: 100%; } .bootstrap-timepicker .dropdown-menu { width: 100%; } }
2891954521/LiteLoaderQQNT-OneBotApi-JS
11,611
src/oneBot11/message.js
const fs = require("fs"); const utils = require("../utils"); const { Data } = require('../main/core'); const { Log } = require("../logger"); const { QQNtAPI } = require('../qqnt/QQNtAPI'); /** * 消息的基类 * @class Message */ class Message{ /** * @param type {string} * @param data {Object} */ constructor(type, data){ this.type = type this.data = data } toCqCode(){ return `[CQ:${this.type}]`; } /** * @return Object */ toQQNT(){ return { elementType: 1, elementId: "", textElement: { content: "", atType: 0, atUid: "", atTinyId: "", atNtUid: "", } } } /** * 从QQNTMsg创建OneBot11Message * @param QQNTMsg {QQNTMessage} * @param element * @return {Promise<Message> | Message} */ static parseFromQQNT(QQNTMsg, element){ return new Message("unsupportType",{raw: element}) } } class Text extends Message{ /** * @param text {string} */ constructor(text){ super("text", { text: text }); } toCqCode(){ return this.data.text; } toQQNT(){ return { elementType: 1, elementId: "", textElement: { content: this.data.text, atType: 0, atUid: "", atTinyId: "", atNtUid: "", } } } static parseFromQQNT(QQNTMsg, element){ return new Text(element.textElement.content) } } /** * 表情消息 */ class Face extends Message{ /** * @param id {number} */ constructor(id){ super("face", { id: id }); } toCqCode(){ return `[CQ:face,id=${this.data.id}]`; } toQQNT(){ return { elementType: 6, elementId: "", faceElement: { faceIndex: this.data.id, faceType: 1, } } } static parseFromQQNT(QQNTMsg, element){ return new Face(element.faceElement.faceIndex) } } class At extends Message{ /** * @param atAll {boolean} * @param member {GroupMember | null} */ constructor(atAll = false, member = null){ super("at", { qq: atAll ? "all" : (member?.uin ? member.uin : "") }); this.member = member; } toCqCode(){ return `[CQ:at,qq=${this.data.qq}]`; } toQQNT(){ if(this.data.qq === 'all'){ return { elementType: 1, elementId: "", textElement: { "content": "@全体成员", "atType": 1, "atUid": "0" } } }else{ return { elementType: 1, elementId: "", textElement: { "content": this.member.cardName, "atType": 2, "atUid": this.member.uid, "atNtUid": this.member.uid, "atTinyId": "", } } } } static async createAt(group, qq){ if(group){ let member = await Data.getGroupMemberByQQ(group, qq); if(member){ return new At(false, member); }else{ throw `群成员 QQ(${qq}) 不在 群(${group}) 里`; } }else{ throw 'Must provide group' } } static async parseFromQQNT(QQNTMsg, element){ if(element.textElement.atType == 1){ return new At(true, null) }else if(element.textElement.atType == 2){ return new At(false, await Data.getGroupMemberByUid(QQNTMsg.peerUid, element.textElement.atNtUid)) }else{ return new At(false, null) } } } class Image extends Message{ /** * @param data {Object} * @param filePath * @param fileName * @param fileSize * @param width * @param height */ constructor(data, filePath = "", fileName = "", fileSize = 0, width = 0, height = 0,){ super("image", data); this.filePath = filePath; this.fileName = fileName; this.fileSize = fileSize; this.width = width; this.height = height; } toCqCode(){ return `[CQ:image,md5=${this.data.md5}]`; } toQQNT(){ return { elementType: 2, elementId: "", picElement: { md5HexStr: this.data.md5, fileSize: this.fileSize, picWidth: this.width, picHeight: this.height, fileName: this.fileName, sourcePath: this.filePath, original: true, picType: 1001, picSubType: 0, fileUuid: "", fileSubId: "", thumbFileSize: 0, summary: "", } }; } /** * @return {Promise<Image> | Promise<Text>} */ static async createImage(url){ let file; if(url.startsWith("file://")){ file = url.split("file://")[1]; }else if(url.startsWith("http://") || url.startsWith("https://")){ Log.e('暂不支持发送非本地图片'); return new Text("[图片]"); }else{ file = url; } if(!fs.existsSync(file)){ Log.e('发送图片失败,图片文件不存在'); return new Text("[图片]"); } const md5 = utils.md5(file); const ext = file.substring(file.lastIndexOf('.') + 1); const fileName = `${md5}.${ext}`; const filePath = await QQNtAPI.ntCall("ns-ntApi", "nodeIKernelMsgService/getRichMediaFilePathForGuild", [ { path_info: { md5HexStr: md5, fileName: fileName, elementType: 2, elementSubType: 0, thumbSize: 0, needCreate: true, downloadType: 1, file_uuid: "" } } ]); if(typeof filePath !== 'string' || filePath.trim() === ''){ Log.e(`发送图片失败,无法创建图片文件, path: ${filePath}, name: ${fileName}`); return new Text("[图片]"); } fs.copyFileSync(file, filePath, fs.constants.COPYFILE_FICLONE); const fileSize = fs.statSync(filePath).size; const imageSize = await QQNtAPI.ntCall("ns-FsApi", "getImageSizeFromPath", [filePath]); if(!imageSize?.width || !imageSize?.height){ Log.e(`发送图片失败,无法获取图片大小, path: ${filePath}, name: ${fileName}`); return new Text("[图片]"); } return new Image({ file: filePath.startsWith("/") ? "file://" : "file:///" + filePath, url: "", md5: md5, }, filePath, fileName, fileSize, imageSize.width, imageSize.height) } static async parseFromQQNT(QQNTMsg, element){ let picElement = element.picElement; // if(!fs.existsSync(picElement.sourcePath)){ // await QQNtAPI.ntCall("ns-ntApi", "nodeIKernelMsgService/downloadRichMedia", [{ // getReq: { // msgId: QQNTMsg.msgId, // elementId: element.elementId, // chatType: QQNTMsg.chatType, // peerUid: QQNTMsg.peerUid, // thumbSize: 0, // downloadType: 2, // filePath: picElement.thumbPath.get(0), // }, // }, undefined, // ]); // } return new Image({ file: picElement.sourcePath.startsWith("/") ? "file://" : "file:///" + picElement.sourcePath, url: 'https://c2cpicdw.qpic.cn' + picElement.originImageUrl, md5: picElement.md5HexStr.toUpperCase() }, picElement.sourcePath, picElement.fileName, picElement.fileSize, picElement.picWidth, picElement.picHeight) } } class File extends Message{ /** * @param data {Object} */ constructor(data){ super("file", data); } toCqCode(){ return `[CQ:file,id=${this.data.name}]`; } toQQNT(){ return new Text("").toQQNT() } static parseFromQQNT(QQNTMsg, element){ let fileElement = element.fileElement if(fileElement){ return new File({ name: fileElement.fileName, size: parseInt(fileElement.fileSize), elementId: element.elementId }) }else{ return new File({}) } } } class Reply extends Message{ /** * @param data {Object} */ constructor(data){ super("reply", data); } toCqCode(){ return `[CQ:reply,id=${this.data.id}]`; } toQQNT(){ let msg = Data.historyMessage.get(this.data.id); if(!msg) throw `无法找到回复的消息`; return { elementType: 7, elementId: "", replyElement: { "replayMsgId": this.data.id, "replayMsgSeq": msg.msgSeq, "sourceMsgText": "", "senderUid": msg.senderUid, "senderUidStr": msg.senderUid, "replyMsgClientSeq": "", "replyMsgTime": "", "replyMsgRevokeType": 0, "sourceMsgTextElems": [], "sourceMsgIsIncPic": false, "sourceMsgExpired": false } } } static parseFromQQNT(QQNTMsg, element){ let replyMsg = QQNTMsg.records?.[0]; if(replyMsg){ return new Reply({ id: replyMsg.msgId }) }else{ Log.w(`无法解析回复消息`); return new Reply({}) } } } /** * 窗口抖动 */ class Shake extends Message{ } /** * Json消息 */ class Ark extends Message{ /** * @param data {Object} */ constructor(data){ super("json", data); } toCqCode(){ return `[CQ:json,data=${this.data.data}]`; } toQQNT(){ return { elementType: 10, elementId: "", arkElement: { "bytesData": JSON.stringify(this.data.data), "linkInfo": null, "subElementType": null } } } static parseFromQQNT(QQNTMsg, element){ return new Ark({ data: element.arkElement.bytesData }) } } /** * 转发消息 */ class Forward extends Message{ /** * @param data {Object} */ constructor(data){ super("forward", data); } toCqCode(){ return `[CQ:forward,id=${this.data.id}]`; } toQQNT(){ return new Text("[聊天记录]").toQQNT() } static parseFromQQNT(QQNTMsg, element){ return new Forward({ id: QQNTMsg.msgId }) } } class MarkDown extends Message{ constructor(content){ super("markdown", { content: content }); } toCqCode(){ return this.data.content; } toQQNT(){ return new Text("[MarkDown消息]").toQQNT() } static parseFromQQNT(QQNTMsg, element){ return new MarkDown(element.markdownElement.content) } } /** * 从Json中创建QQNTMessage * @param oneBotMsg {Object} * @param group_id {number | null} * @return Message */ async function createOneBot(oneBotMsg, group_id = null){ switch(oneBotMsg.type){ case 'text': return new Text(oneBotMsg.data.text); case 'face': return new Face(oneBotMsg.data.id); case 'at': if(oneBotMsg.data.qq == 'all'){ return new At(true); }else{ return (await At.createAt(group_id, oneBotMsg.data.qq)); } case 'image': return (await Image.createImage(oneBotMsg.data.file)); case 'file': return new File(oneBotMsg.data); case 'reply': return new Reply(oneBotMsg.data); case 'json': return new Ark(oneBotMsg.data.data); case 'markdown': return new MarkDown(oneBotMsg.data.content); // case 'shake': // return Shake.OneBot2QQNT(item); default: throw '无法解析的消息类型: ' + oneBotMsg.type; } } /** * @return {Promise<Message>} */ async function parseFromQQNT(QQNTMessage, element){ switch(element.elementType){ // 文本消息和At消息 case 1: { let textElement = element.textElement; if(textElement.atType == 0){ return Text.parseFromQQNT(QQNTMessage, element); }else{ return await At.parseFromQQNT(QQNTMessage, element); } } // 图片消息 case 2: return await Image.parseFromQQNT(QQNTMessage, element); // 文件消息 case 3: return File.parseFromQQNT(QQNTMessage, element); // 表情消息 case 6: let faceElement = element.faceElement; if(faceElement.faceType == 5) return Shake.parseFromQQNT(QQNTMessage, element); return Face.parseFromQQNT(QQNTMessage, element); // 回复消息 case 7: return Reply.parseFromQQNT(QQNTMessage, element); // Json消息 case 10: return Ark.parseFromQQNT(QQNTMessage, element); // MD消息 case 14: return MarkDown.parseFromQQNT(QQNTMessage, element); // 转发消息 case 16: return Forward.parseFromQQNT(QQNTMessage, element) default: return Message.parseFromQQNT(QQNTMessage, element) } } /** * 创建发送消息的对象 * @param group_id * @param user_id * @return { { * peerUid: string, * guildId: string, * chatType: number * } | null } */ function createPeer(group_id, user_id){ if(group_id){ let group = Data.getGroupById(group_id); if(!group){ Log.e(`Unable to find group with ${group_id}`); return null; }else{ return { chatType: 2, peerUid: group.groupCode, guildId: "" } } }else if(user_id){ let friend = Data.getInfoByQQ(user_id); if(!friend){ Log.e(`Unable to find friend with QQ ${user_id}`); return null; }else{ return { chatType: 1, peerUid: friend.uid, guildId: "" } } }else{ return null; } } module.exports = { Text, Face, At, Image, File, Reply, createPeer, createOneBot, parseFromQQNT }
2894638479/fabric-blue-archive-halo
2,064
src/client/kotlin/name/bluearchivehalo/screen/MainScreen.kt
package name.bluearchivehalo.screen import name.bluearchivehalo.config.Config import net.minecraft.client.gui.DrawContext import net.minecraft.client.gui.screen.Screen import net.minecraft.client.gui.widget.ButtonWidget import net.minecraft.client.gui.widget.GridWidget import net.minecraft.client.gui.widget.SimplePositioningWidget import net.minecraft.text.Text class MainScreen(parent: Screen): MyScreen(Text.of("光环设置"),parent) { override fun close() { client?.setScreen(parent) Config.save() } override fun render(context: DrawContext, mouseX: Int, mouseY: Int, delta: Float) { super.render(context, mouseX, mouseY, delta) } val chooseLevel = ButtonWidget.builder(Text.of("分等级设置")){ client?.setScreen(LevelChooseScreen(this)) }.build() tooltip "不同等级的信标的特定配置" val baseAlpha = slider(conf.baseAlpha,0f..1f) { Text.of("基本不透明度") } val mixWhite = slider(conf.mixWhite,0f..1f) { Text.of("色调变白") } tooltip "混入一些白色,使得视觉效果更亮" val pulseTail = slider(conf.pulseTail,0.1f..1f) { Text.of("脉冲拖尾长度") } val spacingMidAlpha = slider(conf.spacingMidAlpha,0f..1f) { Text.of("间隔模式不透明度") } tooltip "间隔模式下,高亮部分的不透明度" val spacingAlpha = slider(conf.spacingAlpha,0f..1f) { Text.of("间隔不透明度") } tooltip "间隔模式下,间隔部分的不透明度" val spacingCount = slider(conf.spacingCount,4..20) { Text.of("间隔数量:${conf.spacingCount.get}") } override fun init() { val gridWidget = GridWidget() gridWidget.mainPositioner.marginX(5).marginBottom(4).alignHorizontalCenter() val adder = gridWidget.createAdder(2) listOf(chooseLevel,baseAlpha,mixWhite,pulseTail,spacingMidAlpha,spacingAlpha,spacingCount) .forEach { adder.add(it) } adder.add(previewButton,2,adder.copyPositioner().marginTop(6)) adder.add(done,2, adder.copyPositioner().marginTop(6)) gridWidget.refreshPositions() SimplePositioningWidget.setPos(gridWidget, 0, height / 6 - 12,width,height, 0.5f, 0.0f) gridWidget.forEachChild(::addDrawableChild) super.init() } }
2894638479/fabric-blue-archive-halo
3,720
src/client/kotlin/name/bluearchivehalo/screen/MyScreen.kt
package name.bluearchivehalo.screen import name.bluearchivehalo.config.Conf import name.bluearchivehalo.config.Config import net.minecraft.client.MinecraftClient import net.minecraft.client.gui.DrawContext import net.minecraft.client.gui.screen.Screen import net.minecraft.client.gui.tooltip.Tooltip import net.minecraft.client.gui.widget.ButtonWidget import net.minecraft.client.gui.widget.ClickableWidget import net.minecraft.client.gui.widget.SliderWidget import net.minecraft.screen.ScreenTexts import net.minecraft.text.Text import kotlin.math.roundToInt import kotlin.reflect.KClass open class MyScreen(title: Text, val parent:Screen): Screen(title) { var pause = true override fun shouldPause() = pause override fun close() { client?.setScreen(parent) } override fun render(context: DrawContext, mouseX: Int, mouseY: Int, delta: Float) { renderBackground(context) super.render(context, mouseX, mouseY, delta) context.drawCenteredTextWithShadow(textRenderer,title,width / 2, 15, 16777215) } val pauseButton get() = ButtonWidget.builder(Text.of("暂停中")){ pause = !pause it.message = Text.of(if(pause) "暂停中" else "运行中") }.width(200).build() tooltip "查看动态效果(会运行游戏内时间)" val previewButton get() = ButtonWidget.builder(Text.of("预览")){ client?.setScreen(object : MyScreen(Text.of("预览中,请自行调整游戏内视角"),this){ val rememberHudStatus = MinecraftClient.getInstance().options.hudHidden init { MinecraftClient.getInstance().options.hudHidden = true } override fun close() { MinecraftClient.getInstance().options.hudHidden = rememberHudStatus super.close() } override fun renderBackground(context: DrawContext) {} override fun init() { val left = width/2 - 155 addDrawableChild(pauseButton.also { it.setPosition(left,height - 32) it.width = 150 }) addDrawableChild(done.also { it.setPosition(left + 160,height - 32) it.width = 150 }) super.init() } }) }.width(200).build().also { it.active = client?.world != null } tooltip "清空界面,便于预览(仅游戏内)" val done get() = ButtonWidget.builder(ScreenTexts.DONE) { close() }.width(200).build() inline fun <reified T> slider(conf: Conf<T>, range:ClosedRange<T>, noinline text:()->Text) where T : Number, T:Comparable<T> = slider(conf,range,text,T::class) val conf get() = Config.instance fun <T> slider(conf: Conf<T>, range:ClosedRange<T>, text:()-> Text, clazz: KClass<T>): SliderWidget where T : Number, T:Comparable<T>{ return object: SliderWidget(100,100, 150,20, text(),run { val start = range.start.toDouble() val end = range.endInclusive.toDouble() (conf.get.toDouble() - start) / (end - start) }){ val start get() = range.start.toDouble() val end get() = range.endInclusive.toDouble() override fun updateMessage() { message = text() } override fun applyValue() { val value = start + (end-start)*value when(clazz){ Int::class -> conf.field = value.roundToInt() as T Float::class -> conf.field = value.toFloat() as T Double::class -> conf.field = value as T else -> error("unknown slider type:$clazz") } } } } infix fun ClickableWidget.tooltip(string:String) = apply { tooltip = Tooltip.of(Text.of(string)) } }
2881099/FreeScheduler
15,452
FreeScheduler_Dashboard/wwwroot/FreeScheduler/htm/plugins/timepicker/bootstrap-timepicker.min.js
/*! bootstrap-timepicker v0.2.3 * http://jdewit.github.com/bootstrap-timepicker * Copyright (c) 2013 Joris de Wit * MIT License */(function(e,t,n,r){"use strict";var i=function(t,n){this.widget="";this.$element=e(t);this.defaultTime=n.defaultTime;this.disableFocus=n.disableFocus;this.isOpen=n.isOpen;this.minuteStep=n.minuteStep;this.modalBackdrop=n.modalBackdrop;this.secondStep=n.secondStep;this.showInputs=n.showInputs;this.showMeridian=n.showMeridian;this.showSeconds=n.showSeconds;this.template=n.template;this.appendWidgetTo=n.appendWidgetTo;this.upArrowStyle=n.upArrowStyle;this.downArrowStyle=n.downArrowStyle;this.containerClass=n.containerClass;this._init()};i.prototype={constructor:i,_init:function(){var t=this;if(this.$element.parent().hasClass("input-append")||this.$element.parent().hasClass("input-prepend")){if(this.$element.parent(".input-append, .input-prepend").find(".add-on").length){this.$element.parent(".input-append, .input-prepend").find(".add-on").on({"click.timepicker":e.proxy(this.showWidget,this)})}else{this.$element.closest(this.containerClass).find(".add-on").on({"click.timepicker":e.proxy(this.showWidget,this)})}this.$element.on({"focus.timepicker":e.proxy(this.highlightUnit,this),"click.timepicker":e.proxy(this.highlightUnit,this),"keydown.timepicker":e.proxy(this.elementKeydown,this),"blur.timepicker":e.proxy(this.blurElement,this)})}else{if(this.template){this.$element.on({"focus.timepicker":e.proxy(this.showWidget,this),"click.timepicker":e.proxy(this.showWidget,this),"blur.timepicker":e.proxy(this.blurElement,this)})}else{this.$element.on({"focus.timepicker":e.proxy(this.highlightUnit,this),"click.timepicker":e.proxy(this.highlightUnit,this),"keydown.timepicker":e.proxy(this.elementKeydown,this),"blur.timepicker":e.proxy(this.blurElement,this)})}}if(this.template!==false){this.$widget=e(this.getTemplate()).prependTo(this.$element.parents(this.appendWidgetTo)).on("click",e.proxy(this.widgetClick,this))}else{this.$widget=false}if(this.showInputs&&this.$widget!==false){this.$widget.find("input").each(function(){e(this).on({"click.timepicker":function(){e(this).select()},"keydown.timepicker":e.proxy(t.widgetKeydown,t)})})}this.setDefaultTime(this.defaultTime)},blurElement:function(){this.highlightedUnit=r;this.updateFromElementVal()},decrementHour:function(){if(this.showMeridian){if(this.hour===1){this.hour=12}else if(this.hour===12){this.hour--;return this.toggleMeridian()}else if(this.hour===0){this.hour=11;return this.toggleMeridian()}else{this.hour--}}else{if(this.hour===0){this.hour=23}else{this.hour--}}this.update()},decrementMinute:function(e){var t;if(e){t=this.minute-e}else{t=this.minute-this.minuteStep}if(t<0){this.decrementHour();this.minute=t+60}else{this.minute=t}this.update()},decrementSecond:function(){var e=this.second-this.secondStep;if(e<0){this.decrementMinute(true);this.second=e+60}else{this.second=e}this.update()},elementKeydown:function(e){switch(e.keyCode){case 9:this.updateFromElementVal();switch(this.highlightedUnit){case"hour":e.preventDefault();this.highlightNextUnit();break;case"minute":if(this.showMeridian||this.showSeconds){e.preventDefault();this.highlightNextUnit()}break;case"second":if(this.showMeridian){e.preventDefault();this.highlightNextUnit()}break}break;case 27:this.updateFromElementVal();break;case 37:e.preventDefault();this.highlightPrevUnit();this.updateFromElementVal();break;case 38:e.preventDefault();switch(this.highlightedUnit){case"hour":this.incrementHour();this.highlightHour();break;case"minute":this.incrementMinute();this.highlightMinute();break;case"second":this.incrementSecond();this.highlightSecond();break;case"meridian":this.toggleMeridian();this.highlightMeridian();break}break;case 39:e.preventDefault();this.updateFromElementVal();this.highlightNextUnit();break;case 40:e.preventDefault();switch(this.highlightedUnit){case"hour":this.decrementHour();this.highlightHour();break;case"minute":this.decrementMinute();this.highlightMinute();break;case"second":this.decrementSecond();this.highlightSecond();break;case"meridian":this.toggleMeridian();this.highlightMeridian();break}break}},formatTime:function(e,t,n,r){e=e<10?"0"+e:e;t=t<10?"0"+t:t;n=n<10?"0"+n:n;return e+":"+t+(this.showSeconds?":"+n:"")+(this.showMeridian?" "+r:"")},getCursorPosition:function(){var e=this.$element.get(0);if("selectionStart"in e){return e.selectionStart}else if(n.selection){e.focus();var t=n.selection.createRange(),r=n.selection.createRange().text.length;t.moveStart("character",-e.value.length);return t.text.length-r}},getTemplate:function(){var e,t,n,r,i,s;if(this.showInputs){t='<input type="text" name="hour" class="bootstrap-timepicker-hour form-control" maxlength="2"/>';n='<input type="text" name="minute" class="bootstrap-timepicker-minute form-control" maxlength="2"/>';r='<input type="text" name="second" class="bootstrap-timepicker-second form-control" maxlength="2"/>';i='<input type="text" name="meridian" class="bootstrap-timepicker-meridian form-control" maxlength="2"/>'}else{t='<span class="bootstrap-timepicker-hour"></span>';n='<span class="bootstrap-timepicker-minute"></span>';r='<span class="bootstrap-timepicker-second"></span>';i='<span class="bootstrap-timepicker-meridian"></span>'}s="<table>"+"<tr>"+'<td><a href="#" data-action="incrementHour"><i class="'+this.upArrowStyle+'"></i></a></td>'+'<td class="separator">&nbsp;</td>'+'<td><a href="#" data-action="incrementMinute"><i class="'+this.upArrowStyle+'"></i></a></td>'+(this.showSeconds?'<td class="separator">&nbsp;</td>'+'<td><a href="#" data-action="incrementSecond"><i class="'+this.upArrowStyle+'"></i></a></td>':"")+(this.showMeridian?'<td class="separator">&nbsp;</td>'+'<td class="meridian-column"><a href="#" data-action="toggleMeridian"><i class="'+this.upArrowStyle+'"></i></a></td>':"")+"</tr>"+"<tr>"+"<td>"+t+"</td> "+'<td class="separator">:</td>'+"<td>"+n+"</td> "+(this.showSeconds?'<td class="separator">:</td>'+"<td>"+r+"</td>":"")+(this.showMeridian?'<td class="separator">&nbsp;</td>'+"<td>"+i+"</td>":"")+"</tr>"+"<tr>"+'<td><a href="#" data-action="decrementHour"><i class="'+this.downArrowStyle+'"></i></a></td>'+'<td class="separator"></td>'+'<td><a href="#" data-action="decrementMinute"><i class="'+this.downArrowStyle+'"></i></a></td>'+(this.showSeconds?'<td class="separator">&nbsp;</td>'+'<td><a href="#" data-action="decrementSecond"><i class="'+this.downArrowStyle+'"></i></a></td>':"")+(this.showMeridian?'<td class="separator">&nbsp;</td>'+'<td><a href="#" data-action="toggleMeridian"><i class="'+this.downArrowStyle+'"></i></a></td>':"")+"</tr>"+"</table>";switch(this.template){case"modal":e='<div class="bootstrap-timepicker-widget modal hide fade in" data-backdrop="'+(this.modalBackdrop?"true":"false")+'">'+'<div class="modal-header">'+'<a href="#" class="close" data-dismiss="modal">×</a>'+"<h3>Pick a Time</h3>"+"</div>"+'<div class="modal-content">'+s+"</div>"+'<div class="modal-footer">'+'<a href="#" class="btn btn-primary" data-dismiss="modal">OK</a>'+"</div>"+"</div>";break;case"dropdown":e='<div class="bootstrap-timepicker-widget dropdown-menu">'+s+"</div>";break}return e},getTime:function(){return this.formatTime(this.hour,this.minute,this.second,this.meridian)},hideWidget:function(){if(this.isOpen===false){return}if(this.showInputs){this.updateFromWidgetInputs()}this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}});if(this.template==="modal"&&this.$widget.modal){this.$widget.modal("hide")}else{this.$widget.removeClass("open")}e(n).off("mousedown.timepicker");this.isOpen=false},highlightUnit:function(){this.position=this.getCursorPosition();if(this.position>=0&&this.position<=2){this.highlightHour()}else if(this.position>=3&&this.position<=5){this.highlightMinute()}else if(this.position>=6&&this.position<=8){if(this.showSeconds){this.highlightSecond()}else{this.highlightMeridian()}}else if(this.position>=9&&this.position<=11){this.highlightMeridian()}},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":if(this.showSeconds){this.highlightSecond()}else if(this.showMeridian){this.highlightMeridian()}else{this.highlightHour()}break;case"second":if(this.showMeridian){this.highlightMeridian()}else{this.highlightHour()}break;case"meridian":this.highlightHour();break}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMeridian();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":if(this.showSeconds){this.highlightSecond()}else{this.highlightMinute()}break}},highlightHour:function(){var e=this.$element.get(0);this.highlightedUnit="hour";if(e.setSelectionRange){setTimeout(function(){e.setSelectionRange(0,2)},0)}},highlightMinute:function(){var e=this.$element.get(0);this.highlightedUnit="minute";if(e.setSelectionRange){setTimeout(function(){e.setSelectionRange(3,5)},0)}},highlightSecond:function(){var e=this.$element.get(0);this.highlightedUnit="second";if(e.setSelectionRange){setTimeout(function(){e.setSelectionRange(6,8)},0)}},highlightMeridian:function(){var e=this.$element.get(0);this.highlightedUnit="meridian";if(e.setSelectionRange){if(this.showSeconds){setTimeout(function(){e.setSelectionRange(9,11)},0)}else{setTimeout(function(){e.setSelectionRange(6,8)},0)}}},incrementHour:function(){if(this.showMeridian){if(this.hour===11){this.hour++;return this.toggleMeridian()}else if(this.hour===12){this.hour=0}}if(this.hour===23){this.hour=0;return}this.hour++;this.update()},incrementMinute:function(e){var t;if(e){t=this.minute+e}else{t=this.minute+this.minuteStep-this.minute%this.minuteStep}if(t>59){this.incrementHour();this.minute=t-60}else{this.minute=t}this.update()},incrementSecond:function(){var e=this.second+this.secondStep-this.second%this.secondStep;if(e>59){this.incrementMinute(true);this.second=e-60}else{this.second=e}this.update()},remove:function(){e("document").off(".timepicker");if(this.$widget){this.$widget.remove()}delete this.$element.data().timepicker},setDefaultTime:function(e){if(!this.$element.val()){if(e==="current"){var t=new Date,n=t.getHours(),r=Math.floor(t.getMinutes()/this.minuteStep)*this.minuteStep,i=Math.floor(t.getSeconds()/this.secondStep)*this.secondStep,s="AM";if(this.showMeridian){if(n===0){n=12}else if(n>=12){if(n>12){n=n-12}s="PM"}else{s="AM"}}this.hour=n;this.minute=r;this.second=i;this.meridian=s;this.update()}else if(e===false){this.hour=0;this.minute=0;this.second=0;this.meridian="AM"}else{this.setTime(e)}}else{this.updateFromElementVal()}},setTime:function(e){var t,n;if(this.showMeridian){t=e.split(" ");n=t[0].split(":");this.meridian=t[1]}else{n=e.split(":")}this.hour=parseInt(n[0],10);this.minute=parseInt(n[1],10);this.second=parseInt(n[2],10);if(isNaN(this.hour)){this.hour=0}if(isNaN(this.minute)){this.minute=0}if(this.showMeridian){if(this.hour>12){this.hour=12}else if(this.hour<1){this.hour=12}if(this.meridian==="am"||this.meridian==="a"){this.meridian="AM"}else if(this.meridian==="pm"||this.meridian==="p"){this.meridian="PM"}if(this.meridian!=="AM"&&this.meridian!=="PM"){this.meridian="AM"}}else{if(this.hour>=24){this.hour=23}else if(this.hour<0){this.hour=0}}if(this.minute<0){this.minute=0}else if(this.minute>=60){this.minute=59}if(this.showSeconds){if(isNaN(this.second)){this.second=0}else if(this.second<0){this.second=0}else if(this.second>=60){this.second=59}}this.update()},showWidget:function(){if(this.isOpen){return}if(this.$element.is(":disabled")){return}var t=this;e(n).on("mousedown.timepicker",function(n){if(e(n.target).closest(".bootstrap-timepicker-widget").length===0){t.hideWidget()}});this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}});if(this.disableFocus){this.$element.blur()}this.updateFromElementVal();if(this.template==="modal"&&this.$widget.modal){this.$widget.modal("show").on("hidden",e.proxy(this.hideWidget,this))}else{if(this.isOpen===false){this.$widget.addClass("open")}}this.isOpen=true},toggleMeridian:function(){this.meridian=this.meridian==="AM"?"PM":"AM";this.update()},update:function(){this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}});this.updateElement();this.updateWidget()},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){var e=this.$element.val();if(e){this.setTime(e)}},updateWidget:function(){if(this.$widget===false){return}var e=this.hour<10?"0"+this.hour:this.hour,t=this.minute<10?"0"+this.minute:this.minute,n=this.second<10?"0"+this.second:this.second;if(this.showInputs){this.$widget.find("input.bootstrap-timepicker-hour").val(e);this.$widget.find("input.bootstrap-timepicker-minute").val(t);if(this.showSeconds){this.$widget.find("input.bootstrap-timepicker-second").val(n)}if(this.showMeridian){this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)}}else{this.$widget.find("span.bootstrap-timepicker-hour").text(e);this.$widget.find("span.bootstrap-timepicker-minute").text(t);if(this.showSeconds){this.$widget.find("span.bootstrap-timepicker-second").text(n)}if(this.showMeridian){this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian)}}},updateFromWidgetInputs:function(){if(this.$widget===false){return}var t=e("input.bootstrap-timepicker-hour",this.$widget).val()+":"+e("input.bootstrap-timepicker-minute",this.$widget).val()+(this.showSeconds?":"+e("input.bootstrap-timepicker-second",this.$widget).val():"")+(this.showMeridian?" "+e("input.bootstrap-timepicker-meridian",this.$widget).val():"");this.setTime(t)},widgetClick:function(t){t.stopPropagation();t.preventDefault();var n=e(t.target).closest("a").data("action");if(n){this[n]()}},widgetKeydown:function(t){var n=e(t.target).closest("input"),r=n.attr("name");switch(t.keyCode){case 9:if(this.showMeridian){if(r==="meridian"){return this.hideWidget()}}else{if(this.showSeconds){if(r==="second"){return this.hideWidget()}}else{if(r==="minute"){return this.hideWidget()}}}this.updateFromWidgetInputs();break;case 27:this.hideWidget();break;case 38:t.preventDefault();switch(r){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian();break}break;case 40:t.preventDefault();switch(r){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian();break}break}}};e.fn.timepicker=function(t){var n=Array.apply(null,arguments);n.shift();return this.each(function(){var r=e(this),s=r.data("timepicker"),o=typeof t==="object"&&t;if(!s){r.data("timepicker",s=new i(this,e.extend({},e.fn.timepicker.defaults,o,e(this).data())))}if(typeof t==="string"){s[t].apply(s,n)}})};e.fn.timepicker.defaults={defaultTime:"current",disableFocus:false,isOpen:false,minuteStep:15,modalBackdrop:false,secondStep:15,showSeconds:false,showInputs:true,showMeridian:true,template:"dropdown",appendWidgetTo:".bootstrap-timepicker",upArrowStyle:"glyphicon glyphicon-chevron-up",downArrowStyle:"glyphicon glyphicon-chevron-down",containerClass:"bootstrap-timepicker"};e.fn.timepicker.Constructor=i})(jQuery,window,document)
2894638479/fabric-blue-archive-halo
4,287
src/client/kotlin/name/bluearchivehalo/screen/LevelConfigScreen.kt
package name.bluearchivehalo.screen import name.bluearchivehalo.config.LevelConfig import net.minecraft.client.gui.DrawContext import net.minecraft.client.gui.screen.Screen import net.minecraft.client.gui.widget.ButtonWidget import net.minecraft.client.gui.widget.ClickableWidget import net.minecraft.client.gui.widget.ElementListWidget import net.minecraft.client.gui.widget.SliderWidget import net.minecraft.text.Text import kotlin.math.roundToInt class LevelConfigScreen(parent: Screen,val levelConf: LevelConfig): MyScreen( Text.of("信标等级${levelConf.level} 环数${levelConf.size}"),parent) { override fun init() { val listWidget = object: ElementListWidget<WidgetEntry>(client,width,height - 67, 32, height - 35, 25){ init { centerListVertically = false setRenderBackground(false) } public override fun addEntry(entry: WidgetEntry) = super.addEntry(entry) override fun getRowWidth() = 310 override fun getScrollbarPositionX() = width/2 + 140 } levelConf.rings.confirm() val left = width/2 - 155 val colorSpacing = slider(levelConf.colorSpacing,1..10){ Text.of("颜色采样间隔:${levelConf.colorSpacing.get}") }.apply { width = 145 setPosition(left,0) tooltip("光环根据光柱颜色染色,从外圈到内圈分别为1,2,3,4...格的光柱颜色。如果采样间隔为2则染上2,4,6,8...格的光柱颜色,依此类推。") } val heightSlider = slider(levelConf.height,levelConf.heightRange){ Text.of("光环高度:${levelConf.height.get.toInt()}") }.apply { width = 145 setPosition(left + 150,0) } listWidget.addEntry(WidgetEntry(mutableListOf(colorSpacing,heightSlider))) levelConf.rings.get.forEach { val typeButton = ButtonWidget.builder(Text.of(it.style.get.text)){ button -> it.style.field = it.style.get.next button.message = Text.of(it.style.get.text) button tooltip it.style.get.description }.position(left,0).size(50,20).build() tooltip it.style.get.description val radius = slider(it.radius,5f..it.maxRadius){Text.of("半径${it.radius.get.toInt()}")}.apply { x = left + 55 y = 0 width = 90 } val width = slider(it.width,1f..5f){Text.of("宽度${String.format("%.2f",it.width.get)}")}.apply { x = left + 150 y = 0 width = 45 } fun speed() = it.rotateCycle.get.let { if(it == 0) 0.0 else 400.0/it } fun speedText() = Text.of("速度${String.format("%.2f",speed())}") val speed = object: SliderWidget(left + 200,0,90,20,speedText(),speed()/5 + 0.5){ override fun updateMessage() { message = speedText() } override fun applyValue() { val speed = (value - 0.5) * 5 val cycle = if(speed == 0.0) 0 else (400/speed).roundToInt() it.rotateCycle.field = cycle } } listWidget.addEntry(WidgetEntry(mutableListOf( typeButton,radius,width,speed ))) } addDrawableChild(listWidget) addDrawableChild(previewButton.also { it.width = 150 it.setPosition(left,height-32) }) addDrawableChild(done.also { it.width = 150 it.setPosition(left + 160,height - 32) }) super.init() } class WidgetEntry(val widgets: MutableList<ClickableWidget>): ElementListWidget.Entry<WidgetEntry>() { override fun render( context: DrawContext, index: Int, y: Int, x: Int, entryWidth: Int, entryHeight: Int, mouseX: Int, mouseY: Int, hovered: Boolean, tickDelta: Float ) { this.widgets.forEach { widget -> widget.y = y widget.render(context, mouseX, mouseY, tickDelta) } } override fun children() = this.widgets override fun selectableChildren() = this.widgets } }