Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
ecommerce-ui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
ecommerce-ui
Commits
1b368bf6
Commit
1b368bf6
authored
Jul 19, 2013
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update items to query jio, add pagefooter module
parent
fb25a111
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
132 additions
and
45 deletions
+132
-45
js/plugins/requirejs-plugins/async.js
js/plugins/requirejs-plugins/async.js
+42
-0
modules/items/items.js
modules/items/items.js
+37
-45
modules/pagefooter/pagefooter.html
modules/pagefooter/pagefooter.html
+53
-0
No files found.
js/plugins/requirejs-plugins/async.js
0 → 100644
View file @
1b368bf6
/** @license
* RequireJS plugin for async dependency load like JSONP and Google Maps
* Author: Miller Medeiros
* Version: 0.1.1 (2011/11/17)
* Released under the MIT license
*/
define
(
function
(){
var
DEFAULT_PARAM_NAME
=
'
callback
'
,
_uid
=
0
;
function
injectScript
(
src
){
var
s
,
t
;
s
=
document
.
createElement
(
'
script
'
);
s
.
type
=
'
text/javascript
'
;
s
.
async
=
true
;
s
.
src
=
src
;
t
=
document
.
getElementsByTagName
(
'
script
'
)[
0
];
t
.
parentNode
.
insertBefore
(
s
,
t
);
}
function
formatUrl
(
name
,
id
){
var
paramRegex
=
/!
(
.+
)
/
,
url
=
name
.
replace
(
paramRegex
,
''
),
param
=
(
paramRegex
.
test
(
name
))?
name
.
replace
(
/.+!/
,
''
)
:
DEFAULT_PARAM_NAME
;
url
+=
(
url
.
indexOf
(
'
?
'
)
<
0
)?
'
?
'
:
'
&
'
;
return
url
+
param
+
'
=
'
+
id
;
}
function
uid
()
{
_uid
+=
1
;
return
'
__async_req_
'
+
_uid
+
'
__
'
;
}
return
{
load
:
function
(
name
,
req
,
onLoad
,
config
){
if
(
config
.
isBuild
){
onLoad
(
null
);
//avoid errors on the optimizer
}
else
{
var
id
=
uid
();
window
[
id
]
=
onLoad
;
//create a global variable that stores onLoad so callback function can define new module after async load
injectScript
(
formatUrl
(
name
,
id
));
}
}
};
});
modules/items/items.js
View file @
1b368bf6
...
...
@@ -7,36 +7,26 @@ define([
response
.
data
=
source
;
response
.
mockup
=
function
(
source
,
callback_mockup
)
{
var
gadget
=
RenderJs
.
getSelfGadget
(),
var
markup
,
spec
,
gadget
=
RenderJs
.
getSelfGadget
(),
id
=
gadget
.
dom
.
attr
(
'
id
'
).
split
(
"
__
"
).
splice
(
-
1
)[
0
],
config
=
gadget
.
state
[
0
][
id
].
_config
,
module
=
config
.
datasource
.
module
,
screen
=
window
.
App
.
settings
.
screen_format
,
size
=
screen
===
"
small
"
?
"
small
"
:
"
medium
"
,
shortcut
=
size
.
substring
(
0
,
1
);
// TODO: no fan of pointers (yet)
// pointers keep jio query parameter in storage.js,
// => so they don't need to be with JSON
pointer
=
config
.
datasource
.
pointer
,
// regardless of a pointer, we declare defaults
method
=
pointer
?
undefined
:
config
.
datasource
.
method
||
"
allDocs
"
,
options
=
pointer
?
undefined
:
{
spec
=
{};
spec
.
pointer
=
config
.
datasource
.
pointer
;
spec
.
method
=
spec
.
pointer
?
undefined
:
config
.
datasource
.
method
||
"
allDocs
"
;
spec
.
options
=
spec
.
pointer
?
undefined
:
{
"
limit
"
:
config
.
datasource
.
limit
||
[
0
,
24
],
"
sort_on
"
:
config
.
datasource
.
sort
||
[[
"
_id
"
,
"
descending
"
]],
"
select_list
"
:
config
.
datasource
.
fields
||
undefined
},
data
,
markup
,
screen
=
window
.
App
.
settings
.
screen_format
,
// this defines the size of the images to be displayed
// TODO: this should be customizable
size
=
screen
===
"
small
"
?
"
small
"
:
"
medium
"
,
shortcut
=
size
.
substring
(
0
,
1
);
};
data
=
window
.
App
[
module
].
switchboard
(
pointer
,
method
,
options
,
function
(
response
)
{
spec
.
callback
=
function
(
err
,
response
)
{
var
item
,
i
,
str
=
""
,
price
;
for
(
i
=
0
;
i
<
response
.
total_rows
;
i
+=
1
)
{
...
...
@@ -64,7 +54,9 @@ define([
// this is not response.callback(!!)
callback_mockup
(
markup
);
}
);
// query for items
window
.
App
[
module
].
switchboard
(
spec
);
};
response
.
callback
=
function
(
self
)
{
...
...
modules/pagefooter/pagefooter.html
0 → 100644
View file @
1b368bf6
<!DOCTYPE html>
<html>
<head>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no"
/>
<title>
Pagefooter Module
</title>
<link
rel=
"stylesheet"
href=
"css/main.css"
>
<script
data-main=
"js/main.js"
src=
"js/libs/require/require.js"
></script>
</head>
<body>
<script
type=
"text/javascript"
>
(
function
()
{
var
_gaq
=
_gaq
||
[],
trigAnalytics
;
_gaq
.
push
([
'
_gat._anonymizeIp
'
]);
_gaq
.
push
([
'
_setAccount
'
,
''
]);
//_gaq.push(['b._setAccount',
<
user_id
>
]);
trigAnalytics
=
function
(
trigger
){
$
(
document
).
on
(
'
pageshow
'
,
'
div:jqmData(role="page")
'
,
function
(
event
,
ui
)
{
var
url
=
location
.
href
;
try
{
hash
=
location
.
hash
;
if
(
hash
&&
hash
.
length
>
1
)
{
_gaq
.
push
([
'
_trackPageview
'
,
hash
.
substr
(
1
)]);
// _gaq.push(['_setCustomVar', 1, 'user_id',
<
user_id
>
,
1
]);
// if in app-mode
// _gaq.push(['b._trackPageview']);
}
else
{
_gaq
.
push
([
'
_trackPageview
'
,
url
]);
// set
<
user_id
>
here
// _gaq.push(['_setCustomVar', 1, 'user_id',
<
user_id
>
,
1
]);
// if in app-mode
// _gaq.push(['b._trackPageview', url]);
}
}
catch
(
err
)
{
}
});
if
(
typeof
_gaq
!==
"
undefined
"
&&
_gaq
!==
null
)
{
$
(
document
).
ajaxSend
(
function
(
event
,
xhr
,
settings
){
_gaq
.
push
([
'
_trackPageview
'
,
settings
.
url
]);
// if in app-mode
//_gaq.push(['b._trackPageview', settings.url]);
});
}
};
document
.
addEventListener
(
"
jqm_ready
"
,
function
(){
trigAnalytics
(
"
jqm_ready
"
);
},
false
);
})();
</script>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment