Skip to content

Commit af58072

Browse files
committed
[feature] adding control for page title
1 parent b686334 commit af58072

File tree

7 files changed

+44
-1
lines changed

7 files changed

+44
-1
lines changed

‎index.html‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,10 @@ <h1 class="menu-header">Page</h1>
320320
<inputid="control-layout-scroll-past-end" class="control-layout-scroll-past-end" type="checkbox" tabindex="1">
321321
<labelfor="control-layout-scroll-past-end"><spanclass="label-icon"></span>Scroll past end</label>
322322
</div>
323+
<divclass="input-wrap">
324+
<labelfor="control-layout-title">Title</label>
325+
<inputid="control-layout-title" class="control-layout-title" type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="New Tab" tabindex="1">
326+
</div>
323327
</div>
324328
<divclass="menu-item">
325329
<h1class="menu-header">Theme</h1>
@@ -410,6 +414,7 @@ <h1 class="menu-header">Image</h1>
410414
<scriptsrc="js/version.js"></script>
411415
<scriptsrc="js/keyboard.js"></script>
412416
<scriptsrc="js/background.js"></script>
417+
<scriptsrc="js/title.js"></script>
413418
<scriptsrc="js/init.js"></script>
414419

415420
</html>

‎js/control.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,13 @@ var control = (function(){
383383
func: function(){
384384
render();
385385
}
386+
},{
387+
element: helper.e(".control-layout-title"),
388+
path: "layout.title",
389+
type: "text",
390+
func: function(){
391+
title.render();
392+
}
386393
},{
387394
element: helper.e(".control-layout-theme-random-active"),
388395
path: "layout.theme.random.active",

‎js/init.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,6 @@ background.init();
5151
// render search engine
5252
// focus seach input
5353
search.init();
54+
55+
// render page title
56+
title.init();

‎js/state.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ var state = (function(){
7070
layout: {
7171
width: "wide",
7272
scrollPastEnd: true,
73+
title: "New Tab",
7374
theme: {
7475
current: {
7576
r: 0,

‎js/title.js‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
vartitle=(function(){
2+
3+
varrender=function(){
4+
helper.e("title").textContent=state.get().layout.title;
5+
};
6+
7+
varinit=function(){
8+
render();
9+
};
10+
11+
// exposed methods
12+
return{
13+
render: render,
14+
init: init
15+
};
16+
17+
})();

‎js/update.js‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ var update = (function(){
124124
returndata;
125125
};
126126

127+
var_update_280=function(data){
128+
data.state.layout.title="New Tab";
129+
data.version=2.80;
130+
returndata;
131+
};
132+
127133
// var _update_300 = function(data){
128134
// data.version = 3.00;
129135
// return data;
@@ -158,6 +164,10 @@ var update = (function(){
158164
console.log("\trunning update",2.70);
159165
data=_update_270(data);
160166
};
167+
if(data.version<2.80){
168+
console.log("\trunning update",2.80);
169+
data=_update_280(data);
170+
};
161171
// if (data.version < 3.00){
162172
// console.log("\t# running update", 3.00);
163173
// data = _update_300(data);

‎js/version.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
varversion=(function(){
22

33
// version is normally bumped when the state needs changing or any new functionality is added
4-
varcurrent="2.7.0";
4+
varcurrent="2.8.0";
55

66
varget=function(){
77
varnumber=current.split(".");

0 commit comments

Comments
(0)